View the service principal of a managed identity using PowerShell

Managed identities for Azure resources provides Azure services with an automatically managed identity in Azure Active Directory. You can use this identity to authenticate to any service that supports Azure AD 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

This article has been updated to use the Azure Az PowerShell module. The Az PowerShell module is the recommended PowerShell module for interacting with Azure. To get started with the Az PowerShell module, see Install Azure PowerShell. 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 Azure AD service principals using PowerShell, see Get-AzADServicePrincipal.