Add subscription and tenant scope support for Azure resources - #13121
Add subscription and tenant scope support for Azure resources#13121David Fowler (davidfowl) with Copilot wants to merge 6 commits into
Conversation
…implementation Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 13121Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 13121" |
|
Copilot let’s try adding new methods to handle the scenarios. AsExisting is too overloaded, let’s try AsExistingSubscription, AsExistingResourceGroup, AsExistingTenant |
…ResourceGroup, AsExistingInTenant Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com>
Done in c2d4b81. Renamed the overloaded
Same pattern applied to |
|
Will you be able to deploy to multiple tenants at the same time? 😮🫨 |
…WithTenant - Replace awkward boolean constructors with static factory methods: - AzureBicepResourceScope.ForSubscription(subscription) - AzureBicepResourceScope.ForTenant(tenant) - Rename *InTenant methods to *WithTenant to clarify they specify tenant context for resource-group-scoped resources, not tenant-level resources - Update all usages in AzureResourcePreparer and AzureProvisioningResource
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #21242508343 |
|
Closing this stale draft in favor of #17988, which ports the work forward to current main, adds deploy-path fixes and tests, and has been live-validated in Azure. |
Description
Implements subscription and tenant scoping for Azure resources, extending the existing resource group scoping from PR #11150.
Core Changes
API Extensions - Added new methods to
ExistingAzureResourceExtensionswith clearer naming:Subscription-scoped methods:
AsExistingInSubscription(),RunAsExistingInSubscription(),PublishAsExistingInSubscription()Resource group with subscription methods:
AsExistingInResourceGroup(),RunAsExistingInResourceGroup(),PublishAsExistingInResourceGroup()Tenant-scoped methods:
AsExistingInTenant(),RunAsExistingInTenant(),PublishAsExistingInTenant()All methods support both string and
ParameterResourcevariants.Annotations & Scope
ExistingAzureResourceAnnotation: AddedSubscriptionandTenantproperties with constructorsAzureBicepResourceScope: Added subscription-only and tenant-only scope constructorsBicep Generation
subscription(subId)for subscription-scoped resourcesresourceGroup(subId, rgName)for cross-subscription resource groupstenant(tenantId)for tenant-scoped resourcesExample Usage
Implementation Notes
AsExisting(name, resourceGroup)methods unchangedFixes #11150 (partial - adds tenant support on top of subscription support)
Checklist
<remarks />and<code />elements on your triple slash comments?Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.