Skip to content

Azure CLI configuration - make everything configurable via environment variables and configuration files #29033

@ohads-MSFT

Description

@ohads-MSFT

Related command
az

In automated scenarios (especially CI/CD), passing in some arguments in the command line can be problematic

  1. You might not have access to the command line, for example when using some pipeline task that doesn't expose it: [enhancement]: AzureCLIV2 - Support SNI (Subject Name + Issuer) validation / send x5c claim in the JWT header microsoft/azure-pipelines-tasks#19912
  2. You might not want to pass secrets to the shell, to minimize the chance of secret leaks (e.g. set -x)

Describe the solution you'd like
It seems like the general mechanism already exists: https://learn.microsoft.com/en-us/cli/azure/azure-cli-configuration#cli-configuration-values-and-environment-variables. All we need is to make it generic, perhaps some mapping like az foo list --name bar => $env:AZURE__FOO__LIST__NAME="bar". And then when I run az foo list, the --name argument would default to bar. In my specific case, I'd do something like $env:AZURE__LOGIN__USE_CERT_SN_ISSUER=$true and then all my logins would support SNI automatically.

Describe alternatives you've considered
Specific environment variables could be added for each requested scenario (for example the az login configuration requested here: #10241). However, this would be a never-ending chase for more and more configuration. IMHO it would be much better to have a generic mechanism that works for everything.

Additional Context
A similar approach is taken by ASP.NET: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-8.0#default-application-configuration-sources

Possibly related: #709

Metadata

Metadata

Assignees

Labels

Accountaz login/accountAuto-AssignAuto assign by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamact-identity-squadquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions