# AzureProvisioningResource

- Kind: `class`
- Package: [Aspire.Hosting.Azure](/reference/api/csharp/aspire.hosting.azure.md)
- Version: `13.4.0`
- Namespace: `Aspire.Hosting.Azure`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/cbc352350f1a9bafbaff10d14a2c8de4ac186a48/src/Aspire.Hosting.Azure/AzureProvisioningResource.cs)
- Inherits: [AzureBicepResource](/reference/api/csharp/aspire.hosting.azure/azurebicepresource.md)

An Aspire resource that supports use of Azure Provisioning APIs to create Azure resources.

## Definition

```csharp
namespace Aspire.Hosting.Azure;

public class AzureProvisioningResource
    : Aspire.Hosting.Azure.AzureBicepResource
{
    // ...
}
```

## Constructors

- [AzureProvisioningResource(string, Action<AzureResourceInfrastructure>)](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource/constructors.md#constructor-string-action-azureresourceinfrastructure) -- An Aspire resource that supports use of Azure Provisioning APIs to create Azure resources.

## Properties

- [ConfigureInfrastructure](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource/properties.md#configureinfrastructure) : `Action<AzureResourceInfrastructure>` `get` -- Callback for configuring the Azure resources.
- [ProvisioningBuildOptions](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource/properties.md#provisioningbuildoptions) : `ProvisioningBuildOptions?` `get; set` -- Gets or sets the `Provisioning.ProvisioningBuildOptions` which contains common settings and functionality for building Azure resources.

## Methods

- [AddAsExistingResource(AzureResourceInfrastructure)](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource/methods.md#addasexistingresource-azureresourceinfrastructure) : `ProvisionableResource` `virtual` -- Adds a new `Primitives.ProvisionableResource` into `infra`. The new resource represents a reference to the current [AzureProvisioningResource](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource.md) via https://learn.microsoft.com/azure/azure-resource-manager/bicep/existing-resource.
- [AddRoleAssignments(IAddRoleAssignmentsContext)](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource/methods.md#addroleassignments-iaddroleassignmentscontext) `virtual` -- Adds role assignments to this Azure resource.
- [CreateExistingOrNewProvisionableResource(AzureResourceInfrastructure, Func<string, BicepValue<string>, T>, Func<AzureResourceInfrastructure, T>)](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource/methods.md#createexistingornewprovisionableresource-azureresourceinfrastructure-func-string-bicepvalue-string-t-func-azureresourceinfrastructure-t) : `T` `static` -- Encapsulates the logic for creating an existing or new `Primitives.ProvisionableResource` based on whether or not the [ExistingAzureResourceAnnotation](/reference/api/csharp/aspire.hosting.azure/existingazureresourceannotation.md) exists on the resource.
- [GetBicepTemplateFile(string?, bool)](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource/methods.md#getbiceptemplatefile-string-bool) : [BicepTemplateFile](/reference/api/csharp/aspire.hosting.azure/biceptemplatefile.md) -- Gets the path to the bicep file. If the template is a string or embedded resource, it will be written to a temporary file.
- [GetBicepTemplateString](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource/methods.md#getbiceptemplatestring) : `string` -- Get the bicep template as a string. Does not write to disk.
- [TryApplyExistingResourceAnnotation(IAzureResource, AzureResourceInfrastructure, ProvisionableResource)](/reference/api/csharp/aspire.hosting.azure/azureprovisioningresource/methods.md#tryapplyexistingresourceannotation-iazureresource-azureresourceinfrastructure-provisionableresource) : `bool` `static` -- Attempts to apply the name and (optionally) the resource group scope for the `Primitives.ProvisionableResource` from an [ExistingAzureResourceAnnotation](/reference/api/csharp/aspire.hosting.azure/existingazureresourceannotation.md) attached to `aspireResource`.
