Unable to get a user assigned managed identity working with Function App

Ariel Gonzalez 96 Reputation points
2023-04-12T13:46:34.59+00:00

Hello everyone, Currently I'm trying to configure a very simple Function App using PowerShell that takes a JSON body payload with 2 parameters, a resource group name and a location, then it creates a resource group with that information. The problem that I have is that whenever I try to use a user assigned managed identity it doesn't work, but it works when I use a system assigned managed identity, I already enabled the identity in the Function App but I might be missing something else, this is the output that I get when I try to use the UAMI: 2023-04-12T13:36:59Z [Warning] WARNING: Unable to acquire token for tenant 'organizations' 2023-04-12T13:37:00Z [Error] ERROR: ManagedIdentityCredential authentication failed: Service request failed. Status: 400 (Bad Request) Content: {"statusCode":400,"message":"Unable to load the proper Managed Identity.","correlationId":"9a0d90c9-8734-478a-97d3-70c657629d50"} I saw this answer on StackOverflow that suggests configuring environment variables but I'm not sure what am I supposed to replace <CONNECTION NAME PREFIX> with and I'm not sure if I have to call these variables into my PowerShell code. In general I'm not quite sure what to do with this information. Any help is really appreciated it.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,384 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Ariel Gonzalez 96 Reputation points
    2023-04-14T12:36:44.98+00:00

    Bumping up thread, does anyone know what could be happening? Any insights would be very appreciated


  2. Alexander Brantner 0 Reputation points
    2023-08-11T08:25:23.9433333+00:00

    Ran into the same issue and have no clue what the problem could be? On the Configuration/AppSettings page my KeyVault-Reference has a green tick and presents "user assigned managed identity" as identity and "Resolved" as status so it seems to be configured correctly from my perspective but as soon as the trigger fires the function encounters and logs an error { "statusCode":400,"message":"Unable to load the proper Managed Identity.", ... }
    What could be the problem here?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.