AzureProvisioningResource.TryApplyExistingResourceAnnotation Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Attempts to apply the name and (optionally) the resource group scope for the ProvisionableResource
from an ExistingAzureResourceAnnotation attached to aspireResource.
public static bool TryApplyExistingResourceAnnotation(Aspire.Hosting.ApplicationModel.IAzureResource aspireResource, Aspire.Hosting.Azure.AzureResourceInfrastructure infra, Azure.Provisioning.Primitives.ProvisionableResource provisionableResource);
static member TryApplyExistingResourceAnnotation : Aspire.Hosting.ApplicationModel.IAzureResource * Aspire.Hosting.Azure.AzureResourceInfrastructure * Azure.Provisioning.Primitives.ProvisionableResource -> bool
Public Shared Function TryApplyExistingResourceAnnotation (aspireResource As IAzureResource, infra As AzureResourceInfrastructure, provisionableResource As ProvisionableResource) As Boolean
Parameters
- aspireResource
- IAzureResource
The Aspire resource that may have an ExistingAzureResourceAnnotation.
The infrastructure used for converting parameters into provisioning expressions.
- provisionableResource
- ProvisionableResource
The ProvisionableResource resource to configure.
Returns
true if an ExistingAzureResourceAnnotation was present and applied; otherwise false.
Remarks
When the annotation includes a resource group, a synthetic scope property is added to the resource's provisionable properties to correctly scope the existing resource in the generated Bicep. The caller is responsible for setting a generated name when the method returns false.