Azure / Azure/azure-cli

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

Open
#29,033 1 comment 1 reaction 1 assignee Claimed by @jiasli View on GitHub
Account act-identity-squad Auto-Assign Azure CLI Team question
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**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: https://github.com/microsoft/azure-pipelines-tasks/issues/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: https://github.com/Azure/azure-cli/issues/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: https://github.com/Azure/azure-cli/issues/709

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.