Sign in with a managed identity using Azure CLI

On resources configured for managed identities for Azure resources, you can sign in using the managed identity. Here are some of the benefits of using managed identities:

  • You don't need to manage credentials. Credentials aren’t even accessible to you.
  • You can use managed identities to authenticate to any resource that supports Microsoft Entra authentication, including your own applications.
  • Managed identities can be used at no extra cost.

Signing in with the resource's identity is done through the --identity flag.

az login --identity

If the resource has multiple user assigned managed identities and no system assigned identity, you must specify the client ID or object ID or resource ID of the user assigned managed identity with --username for login.

az login --identity --username <client_id|object_id|resource_id>

To learn more about managed identities for Azure resources, see Configure managed identities for Azure resources. Here are more articles showing the use of the --identity parameter.

See also