0
votes

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. I have done the same for Azure Data Factory using a Poweshell command like this:

 (Get-AzureRMDataFactoryV2 -ResourceGroupName $ResourceGroup -Name $DataFactoryName).Identity

Tried something similar for logic app but it does not return the identity.

2

2 Answers

4
votes

Looks like the Workflow object returned by Get-AzLogicApp doesn't have the identity property defined.

A workaround would be to use the Get-AzResource cmdlet instead.

$ID = (Get-AzResource -Name myLogicApp -ResourceType Microsoft.Logic/workflows).Identity.PrincipalId

enter image description here

0
votes

Based on the previous answer by Joey Cai, you can do the following in AZ CLI also:

$ID = az resource show --name "myLogicApp" --resource-group "myResourceGroup" --resource-type "Microsoft.Logic/workflows" --query "identity.principalId" | ConvertFrom-Json