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.
Related command
az
In automated scenarios (especially CI/CD), passing in some arguments in the command line can be problematic
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 runaz foo list
, the--name
argument would default tobar
. 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