View the service principal of a managed identity using PowerShell

Managed identities for Azure resources provides 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 PowerShell.

Note

We recommend that you use the Azure Az PowerShell module to interact with Azure. See Install Azure PowerShell to get started. To learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.

Prerequisites

View the service principal

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

Get-AzADServicePrincipal -DisplayName <Azure resource name>

Next steps

For more information on viewing Microsoft Entra service principals using PowerShell, see Get-AzADServicePrincipal.