# AzureBicepResource Methods

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

Represents an Azure Bicep resource.

## GetBicepTemplateFile(string?, bool)

- Name: `GetBicepTemplateFile(string?, bool)`
- Modifiers: `virtual`
- Returns: [BicepTemplateFile](/reference/api/csharp/aspire.hosting.azure/biceptemplatefile.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure/AzureBicepResource.cs#L150-L188)

Gets the path to the bicep file. If the template is a string or embedded resource, it will be written to a temporary file.

```csharp
public class AzureBicepResource
{
    public virtual BicepTemplateFile GetBicepTemplateFile(
        string? directory = null,
        bool deleteTemporaryFileOnDispose = true)
    {
        // ...
    }
}
```

## Parameters

- `directory` (`string?`) `optional`
  The directory where the bicep file will be written to (if it's a temporary file)
- `deleteTemporaryFileOnDispose` (`bool`) `optional`
  A boolean that determines if the file should be deleted on disposal of the [BicepTemplateFile](/reference/api/csharp/aspire.hosting.azure/biceptemplatefile.md).

## Returns

[BicepTemplateFile](/reference/api/csharp/aspire.hosting.azure/biceptemplatefile.md) -- A [BicepTemplateFile](/reference/api/csharp/aspire.hosting.azure/biceptemplatefile.md) that represents the bicep file.

## Exceptions

- `InvalidOperationException`

## GetBicepTemplateString

- Name: `GetBicepTemplateString`
- Modifiers: `virtual`
- Returns: `string`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure/AzureBicepResource.cs#L196-L216)

Get the bicep template as a string. Does not write to disk.

```csharp
public class AzureBicepResource
{
    public virtual string GetBicepTemplateString()
    {
        // ...
    }
}
```

## WriteToManifest(ManifestPublishingContext)

- Name: `WriteToManifest(ManifestPublishingContext)`
- Modifiers: `virtual`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure/AzureBicepResource.cs#L224-L284)

Writes the resource to the manifest.

```csharp
public class AzureBicepResource
{
    public virtual void WriteToManifest(
        ManifestPublishingContext context)
    {
        // ...
    }
}
```

## Parameters

- `context` (`ManifestPublishingContext`)
  The `Publishing.ManifestPublishingContext`.
