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.
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.
- If you're unfamiliar with managed identities for Azure resources, check out the overview section.
- If you don't already have an Azure account, sign up for a free account.
- Enable system assigned identity on a virtual machine or application.
- To run the example scripts, you have two options:
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>
For more information on viewing Azure AD service principals using PowerShell, see Get-AzADServicePrincipal.