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

Simplify Bicep Deployments by Embedding Subscription and Tenant Context in Parameter Files #15504

Open
trylvis opened this issue Nov 5, 2024 · 1 comment
Labels

Comments

@trylvis
Copy link

trylvis commented Nov 5, 2024

Is your feature request related to a problem? Please describe.

In multi-tenant, multi-subscription environments, deploying Bicep templates requires switching Azure contexts frequently. Currently, we maintain a bicepparam file for each deployment, which includes most of the necessary parameters. However, specifying "Subscription ID" and "Tenant ID" is done externally, and we need to use az account set every time we switch tenants or subscriptions. This process can be cumbersome and error-prone.

Describe the solution you'd like

It would be helpful if subscriptionId and tenantId could be specified directly within the bicepparam file. The az deployment create command could then check these values in bicepparam for deployment context, defaulting to the current Azure CLI context if they aren’t provided.

This way, instead of first running az account set to adjust the context, then running az deployment create, we would only need to run az deployment create with context pulled directly from the parameter file, simplifying multi-environment deployments and reducing potential for errors.

@trylvis trylvis added the enhancement New feature or request label Nov 5, 2024
@github-project-automation github-project-automation bot moved this to Todo in Bicep Nov 5, 2024
@trylvis trylvis changed the title Specifying Subscription ID and Tenant ID inbicepparams instead of always needing to run "az account set" Simplify Bicep Deployments by Embedding Subscription and Tenant Context in Parameter Files Nov 5, 2024
@asilverman
Copy link
Contributor

Have you considered using modules to model your scenario? You can start with a management group target scope deployment that triggers modules, each module is downscoped to the subscription and resource group using the scope property of a module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

No branches or pull requests

3 participants