Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does AZD lifecycle support multiple subscriptions #4428

Open
backwind1233 opened this issue Oct 11, 2024 · 4 comments
Open

Does AZD lifecycle support multiple subscriptions #4428

backwind1233 opened this issue Oct 11, 2024 · 4 comments
Assignees
Labels
Milestone

Comments

@backwind1233
Copy link

Question

When I use azd to provision resources, I need to provision some azure resources subscription-A and some other resources in subscription-B,
but it seems when I try to run command azd down, azd can't find all the resources in both subscription-A and subscription-B

Below is the sample infra/main.bicep

targetScope = 'subscription'

param location string

@minLength(1)
@maxLength(64)
@description('Name of the the environment which is used to generate a short unique hash used in all resources.')
param environmentName string

// tags that should be applied to all resources.
var tags = {
  // Tag all resources with the environment name.
  'azd-env-name': environmentName
}

module resourceInSubA './rg-module-1.bicep' = {
  name: 'deployToSubA'
  scope: subscription('subscription-id')
  params: {
    location: location
    rg: 'rgFor1021-SubA'
    tags: tags
  }
}

module resourceInSubB './rg-module-2.bicep' = {
  name: 'deployToSubB'
  scope: subscription('subscription-id')
  params: {
    location: location
    rg: 'rgFor1021-SubB'
    tags: tags
  }
}

@backwind1233 backwind1233 changed the title Does AZD support multiple subscriptions Does AZD lifecycle support multiple subscriptions Oct 11, 2024
@rajeshkamal5050
Copy link
Contributor

@backwind1233 does provision and deploy works fine? only azd down fails? cc @ellismg @wbreza

@backwind1233
Copy link
Author

Hello @rajeshkamal5050
Yes, azd provsion works, I didn't test azd deploy, but azd down failed.

@backwind1233
Copy link
Author

You need to use an account with multiple subscriptions to test this case.

@wbreza
Copy link
Contributor

wbreza commented Oct 17, 2024

Hi @backwind1233 - we recently released an alpha feature that leverages Azure Deployment Stacks which solves some ARM deployments that use more complex configurations.

To opt-in for deployment stacks you can run the following command:

azd config set alpha.deployment.stacks on

Then just run azd provision which will move associate your resources with a deployment stack which makes cleanup (azd down) more predictable.

You can also read more about it from in a recent blog post.

Please try this out with your use case and let us know if this resolves your issue.

@wbreza wbreza self-assigned this Oct 17, 2024
@wbreza wbreza added the needs-triage For new issues label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants