如何使用 Azure Powershell 检索应用系统分配的标识对象 ID

How to retrieve App System Assigned Identity Object Id using Azure Powershell

我正在使用 Azure Powershell 3.8.0

我正在尝试获取可以在此屏幕中看到的对象 ID:

我尝试使用以下方法:

PS> (Get-AzResource -Name  "func-example").Identity.PrincipalId

但它与对象 ID 不匹配。

然后还有:

PS> (Get-AzWebApp -Name  "func-example" -ResourceGroupName RGNAME).Identity

但也不匹配

有人知道如何使用 Azure Powershell 获取该 ID 吗?

你可以this,

使用 PowerShell:

Get-AzADServicePrincipal -DisplayName 'func-example'

使用 CLI :

az ad sp list --display-name 'func-example'