Files
cheatsheet-tldr/tldr/az-login
2024-10-25 00:17:31 +00:00

31 lines
986 B
Plaintext

---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# az login
> Log in to Azure.
> Part of `azure-cli` (also known as `az`).
> More information: <https://learn.microsoft.com/cli/azure/reference-index#az-login>.
- Log in interactively:
`az login`
- Log in with a service principal using a client secret:
`az login --service-principal --username {{http://azure-cli-service-principal}} --password {{secret}} --tenant {{someone.onmicrosoft.com}}`
- Log 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.com}}`
- Log in using a VM's system assigned identity:
`az login --identity`
- Log in using a VM's user assigned identity:
`az login --identity --username /subscriptions/{{subscription_id}}/resourcegroups/{{my_rg}}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{{my_id}}`