diff --git a/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx b/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx index 1a3aefc9d..53ff46391 100644 --- a/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx +++ b/src/frontend/src/content/docs/integrations/cloud/azure/customize-resources.mdx @@ -552,6 +552,59 @@ await builder.build().run(); +### Set the deployment scope + +By default, Aspire deploys Bicep resources at the resource group scope. Some Bicep templates require a different [deployment scope](https://learn.microsoft.com/azure/azure-resource-manager/bicep/deploy-to-subscription), such as the subscription or the tenant. + + + + +Set the `Scope` property on the Bicep resource using `AzureBicepResourceScope.CreateForSubscription` or `AzureBicepResourceScope.CreateForTenant`: + +```csharp title="AppHost.cs" +var builder = DistributedApplication.CreateBuilder(args); + +var subscriptionId = builder.AddParameter("subscriptionId"); + +var subscriptionScoped = builder.AddBicepTemplateString( + "subscriptionScoped", + """ + targetScope = 'subscription' + + param location string + + output value string = 'subscription' + """); +subscriptionScoped.Resource.Scope = AzureBicepResourceScope.CreateForSubscription(subscriptionId.Resource); + +var tenantScoped = builder.AddBicepTemplateString( + "tenantScoped", + """ + targetScope = 'tenant' + + param location string + + output value string = 'tenant' + """); +tenantScoped.Resource.Scope = AzureBicepResourceScope.CreateForTenant(); + +builder.Build().Run(); +``` + + + + + + + + + + + ### Inspect generated Bicep After customizing with `ConfigureInfrastructure`, inspect the Bicep that Aspire generates: