Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| azure:qnd:azure_cli [2022/06/09 15:24] – created mgupton | azure:qnd:azure_cli [2022/10/31 18:12] (current) – [Azure CLI] mgupton | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Azure CLI ====== | ====== Azure CLI ====== | ||
| + | Azure CLI and Powershell | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | <code powershell> | ||
| + | az login --tenant <tenant id> | ||
| + | </ | ||
| + | |||
| + | <code powershell> | ||
| + | az account set --subscription < | ||
| + | </ | ||
| + | |||
| + | ====== Powershell ====== | ||
| + | ===== Login Sequence ===== | ||
| + | < | ||
| + | Connect-AzAccount | ||
| + | Get-AzSubscriptions | ||
| + | Set-AzContext | ||
| + | </ | ||
| + | |||
| + | === Login (via GUI prompt) === | ||
| + | <code powershell> | ||
| + | $AzCred = Get-Credential -UserName < | ||
| + | az login -u $AzCred.UserName -p $AzCred.GetNetworkCredential().Password | ||
| + | </ | ||
| + | |||
| + | === Login from command line === | ||
| + | <code powershell> | ||
| + | $key = “HKLM: | ||
| + | Set-ItemProperty $key ConsolePrompting True | ||
| + | Get-Credential | ||
| + | Set-ItemProperty $key ConsolePrompting False | ||
| + | </ | ||
| + | |||
| + | === Use native client with bastion === | ||
| + | <code powershell> | ||
| + | az login | ||
| + | az account set --subscription < | ||
| + | Start-Job -ScriptBlock {az network bastion rdp --name <bastion name> --resource-group < | ||
| + | </ | ||
| + | |||
| + | |||
| ====== Bash ====== | ====== Bash ====== | ||
| === Login === | === Login === | ||
| <code bash> | <code bash> | ||
| - | read -sp "Azure password: " AZ_PASS && echo && az login -u < | + | read -sp "Azure user: " AZ_USER && |
| - | </bash> | + | </code> |