Azure CLI
Azure CLI and Powershell
az login --tenant <tenant id>
az account set --subscription <subscription id>
Powershell
Login Sequence
Connect-AzAccount Get-AzSubscriptions Set-AzContext
Login (via GUI prompt)
$AzCred = Get-Credential -UserName <username> az login -u $AzCred.UserName -p $AzCred.GetNetworkCredential().Password
Login from command line
$key = “HKLM:\SOFTWARE\Microsoft\PowerShell\1\ShellIds” Set-ItemProperty $key ConsolePrompting True Get-Credential Set-ItemProperty $key ConsolePrompting False
Use native client with bastion
az login az account set --subscription <subscription id> Start-Job -ScriptBlock {az network bastion rdp --name <bastion name> --resource-group <resource group name> --target-resource-id <resource id>}
Bash
Login
read -sp "Azure user: " AZ_USER && read -sp "Azure password: " AZ_PASS && echo && az login -u $AZ_USER -p $AZ_PASS