az-login
Log in to Azure. tldr-pages
On several platforms
Several platforms
Log in to Azure. Part of azure-cli (also known as az).
Log in interactively
az loginIdentifyLog in with a service principal using a client secret
az login --service-principal --username http://azure-cli-service-principal --password secret --tenant someone.onmicrosoft.comIdentify--service-principalLog in with a service principal. Azure CLI reference--usernameUser name or service principal client ID. Azure CLI reference--passwordUser password or service principal secret. Azure CLI reference--tenantThe Microsoft Entra tenant, must be provided when using a service principal. Azure CLI referenceLog in with a service principal using a client certificate
az login --service-principal --username http://azure-cli-service-principal --password path/to/cert.pem --tenant someone.onmicrosoft.comIdentify--service-principalLog in with a service principal. Azure CLI reference--usernameUser name or service principal client ID. Azure CLI reference--passwordUser password or service principal secret. Azure CLI reference--tenantThe Microsoft Entra tenant, must be provided when using a service principal. Azure CLI referenceLog in using a VM's system assigned identity
az login --identityIdentify--identityLog in using managed identity Azure CLI referenceLog in using a VM's user assigned identity
az login --identity --username /subscriptions/subscription_id/resourcegroups/my_rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/my_idIdentify--identityLog in using managed identity Azure CLI reference--usernameUser name or service principal client ID. Azure CLI reference