Hi @Appmanager Zohocorp ,
Thanks for reaching out.
I understand you are looking a secure way to pass credentials to Azure CLI preferably environment variables.
CLI provides a way to set variables either in a configuration file or with environment variables.
There are defined values that can be set as environment_variables as AZURE_{section}_{name} in the configuration file as mentioned here.
To pass the credentials securely in Azure CLI using read -sp command in bash where credential can be passed without displaying in console as:
read -sp "Azure password: " AZ_PASS && echo && az login --service-principal -u <app-id> -p $AZ_PASS --tenant<tenant>
Alternatively, Powershell command can be used to pass credential securely as:
$AzCred = Get-Credential -UserName <app-id>
az login --service-principal -u $AzCred.UserName -p $AzCred.GetNetworkCredential().Password --tenant <tenant>
Hope this will help to pass credential securely using Azure CLI.
Thanks,
Shweta
------------------------------------------------
Please remember to "Accept Answer" if answer helped you.