Azure / Azure/bicep

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

Open
#15,504 1 comment 1 reaction 0 assignees View on GitHub
enhancement story: bicep deploy
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 2h
Merged PRs (30d)
79

Description

**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.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how bicepparam files and the az deployment create command currently obtain deployment context, especially the external az account set step. Done means subscriptionId and tenantId can be read from the parameter file when provided, while deployments still use the current Azure CLI context when they are absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.