View the service principal of a managed identity using Azure CLI

Managed identities for Azure resources provide Azure services with an automatically managed identity in Microsoft Entra ID. You can use this identity to authenticate to any service that supports Microsoft Entra authentication without having credentials in your code.

In this article, you learn how to view the service principal of a managed identity using Azure CLI.

If you don't already have an Azure account, sign up for a free account before continuing.

Prerequisites

View the service principal

This following command demonstrates how to view the service principal of a VM or application with managed identity enabled. Replace <Azure resource name> with your own values.

az ad sp list --display-name <Azure resource name>

Next steps

For more information on managing Microsoft Entra service principals, see Azure CLI ad sp.