====== Azure CLI ======
Azure CLI and Powershell
* [[https://learn.microsoft.com/en-us/cli/azure/manage-azure-subscriptions-azure-cli]]
az login --tenant
az account set --subscription
====== Powershell ======
===== Login Sequence =====
Connect-AzAccount
Get-AzSubscriptions
Set-AzContext
=== Login (via GUI prompt) ===
$AzCred = Get-Credential -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
Start-Job -ScriptBlock {az network bastion rdp --name --resource-group --target-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