Azure / Azure/bicep

Bicep to automatically determine the current cloud profile based on Azure CLI settings when publishing or restoring a module

Open
#18,113 0 comments 0 reactions 0 assignees View on GitHub
enhancement Needs: Upvote
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

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

As mentioned in [the documentation](https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-config-modules#configure-profiles-and-credentials):
> If you want to publish or restore a module to a national cloud environment such as AzureUSGovernment, you must set "currentProfile": "AzureUSGovernment" even if you've selected that cloud profile in the Azure CLI. Bicep is unable to automatically determine the current cloud profile based on Azure CLI settings.

This means that if I'm using the same Bicep files to deploy to multiple clouds, then I need to write some code to edit `bicepconfig.json` because the name of that file or the name of the cloud are not specifiable on the az cli command.

**Describe the solution you'd like**

I'd like it to not be necessary to specify `currentProfile` in `bicepconfig.json` and have az cli automatically determine the cloud.
Or as a second best, an option to specify the cloud in the az cli command.
This way it's possible to deploy the same Bicep files to multiple clouds.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing how Azure CLI cloud settings relate to the currentProfile setting in bicepconfig.json, using the linked module profile documentation as context. Define how publishing and restoring should select the CLI cloud automatically, or how an explicit CLI cloud option should work, then verify that the same Bicep files can target multiple clouds without editing the configuration.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.