The Azure CLI's default authentication method for logins uses a web browser and access token to sign in.
az login
If the CLI can open your default browser, it will do so and load an Azure sign-in page. Otherwise, open a browser page at https://aka.ms/devicelogin and enter the authorization code displayed in your terminal. Sign in with your account credentials in the browser.
If no web browser is available or the web browser fails to open, use device code flow with az login --use-device-code.
You can select a tenant to sign in under with the --tenant
argument. The value of this argument can either be an .onmicrosoft.com
domain or the Azure object ID for the tenant. Both interactive and command-line sign in methods work with --tenant
.
az login --tenant {tenant}
Additional details can be found at Sign in with Azure CLI — Login and Authentication | Microsoft Docs
az login --service-principal --username {SPN_CLIENT_ID} --password {SPN_CLIENT_SECRET} --tenant {SPN_TENANT_ID}
az account list
Set context to the desired subscription
az account set -s "{subscription}"
az account show
Set default resource group for all Azure CLI commands
az configure --defaults group={resource-group-name}
Get AKS credentials
az aks get-credentials --name {aks-cluster-name}
Download and install kubectl
az aks install-cli