# AzurePublishingContext Methods

- Package: [Aspire.Hosting.Azure](/reference/api/csharp/aspire.hosting.azure.md)
- Type: [AzurePublishingContext](/reference/api/csharp/aspire.hosting.azure/azurepublishingcontext.md)
- Kind: `Methods`
- Members: `1`

Represents a context for publishing Azure bicep templates for a distributed application.

## WriteModelAsync(DistributedApplicationModel, AzureEnvironmentResource, CancellationToken)

- Name: `WriteModelAsync(DistributedApplicationModel, AzureEnvironmentResource, CancellationToken)`
- Returns: `Task`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure/AzurePublishingContext.cs#L85-L114)

Writes the specified distributed application model to the output path using Bicep templates.

```csharp
public sealed class AzurePublishingContext
{
    public Task WriteModelAsync(
        DistributedApplicationModel model,
        AzureEnvironmentResource environment,
        CancellationToken cancellationToken = default(CancellationToken))
    {
        // ...
    }
}
```

## Parameters

- `model` (`DistributedApplicationModel`)
  The distributed application model to write to the output path.
- `environment` ([AzureEnvironmentResource](/reference/api/csharp/aspire.hosting.azure/azureenvironmentresource.md))
  The Azure environment resource.
- `cancellationToken` (`CancellationToken`) `optional`
  A token to monitor for cancellation requests.

## Returns

`Task` -- A task that represents the async operation.
