azurelogic

Azure Logic App problem with user assigned managed identity


Im really struggling to get a user-assigned managed identity working for an azure logic app, when connecting to keyvault (user a service provider connection). The same workflow is fine when using a system assigned identity, so I've concluded that the problem is down to configuring which user-assigned identity to use.

On running the logic app, when it is trying to connect to keyvault, I consistently get this error:

operationName='keyVault.getSecret', message='Unknown error occured while executing KeyVault operation', exception='Microsoft.Azure.Workflows.Common.ErrorResponses.ErrorResponseMessageException: Failed to get oauth token for managed identity in logic app. Response: '{"statusCode":400,"message":"Unable to load the proper Managed Identity."

On following the MS documentation: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference?tabs=azurewebjobsstorage&pivots=programming-language-csharp#common-properties-for-identity-based-connections

I've tried creating the following environment variables on the logic app:

keyVault__credential: managedidentity keyVault__clientId:

Alternately, I also tried:

keyVault__credential: managedidentity keyVault__managedIdentityResourceId:

The user-assigned identity has an access policy on the keyvault as required (secrets get/list).

Can anyone offer any advice on how this should be set up correctly?


Solution

  • You need to perform the below steps to fetch the secret value from key vault in logic app using user assigned managed identity.

    1. Linked User assigned managed identity instance to logic app.

    enter image description here

    1. Granted Get, List secret permissions to user assigned managed identity instance in key vault.

    enter image description here

    enter image description here

    enter image description here

    1. I am establishing a connection to Azure Key Vault connector using managed identity.

    enter image description here

    enter image description here

    enter image description here

    I am able to get the secret value.

    enter image description here