[英]Get Managed Identity ObjectID of Logic App using Azure CLI/Powershell
I have a logic App with Managed Identity enabled.我有一个启用了托管标识的逻辑应用程序。 For automation purposes, I need to use either Azure CLI or Powershell to grab the objectID of the Logic App Managed Identity to grant it access to a keyvault.出于自动化目的,我需要使用 Azure CLI 或 Powershell 来获取逻辑应用托管标识的 objectID,以授予其访问密钥保管库的权限。 I have done the same for Azure Data Factory using a Poweshell command like this:我使用这样的 Poweshell 命令对 Azure 数据工厂做了同样的事情:
(Get-AzureRMDataFactoryV2 -ResourceGroupName $ResourceGroup -Name $DataFactoryName).Identity
Tried something similar for logic app but it does not return the identity.为逻辑应用尝试了类似的东西,但它没有返回身份。
Looks like the Workflow object returned by Get-AzLogicApp
doesn't have the identity property defined.看起来Get-AzLogicApp
返回的 Workflow 对象没有定义标识属性。
A workaround would be to use the Get-AzResource
cmdlet instead.一种解决方法是改用Get-AzResource
cmdlet。
$ID = (Get-AzResource -Name myLogicApp -ResourceType Microsoft.Logic/workflows).Identity.PrincipalId
根据 Joey Cai 的先前回答,您还可以在 AZ CLI 中执行以下操作:
$ID = az resource show --name "myLogicApp" --resource-group "myResourceGroup" --resource-type "Microsoft.Logic/workflows" --query "identity.principalId" | ConvertFrom-Json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.