4

I am trying to use Managed Identity with Azure Functions V3 and a QueueTrigger. the function code is defined like this:

 [Function("ProcessUserData")]
 public async Task ProcessUserData([QueueTrigger("%QueueSettings:UserDataQueue%", Connection = "QueueSettings:StorageAccount")] string queueItem, FunctionContext context)
 {
      var logger = context.GetLogger<QueueListener>();
      ... 
 }

According to Microsoft documentation this should be possible by defining some additional configuration properties

  • <CONNECTION_NAME_PREFIX>__credential
  • <CONNECTION_NAME_PREFIX>__queueServiceUri

https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference?tabs=blob#local-development-with-identity-based-connections

My local.settings.json looks like this:

// "QueueSettings:StorageAccount": "",
"QueueSettings:StorageAccount__queueServiceUri": "https://mytestfa.queue.core.windows.net/",
"QueueSettings:StorageAccount__credential": "managedidentity",

When trying to run the project locally I get the following error:

[2021-12-06T18:07:53.181Z] The 'ProcessUserData' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.ProcessUserData'. Microsoft.Azure.WebJobs.Extensions.Storage: Storage account connection string 'AzureWebJobsQueueSettings:StorageAccount' does not exist. Make sure that it is a defined App Setting.

When I use and empty connection string I get another error:

"QueueSettings:StorageAccount": "",
"QueueSettings:StorageAccount__queueServiceUri": "https://mytestfa.queue.core.windows.net/",
"QueueSettings:StorageAccount__credential": "managedidentity",

Error:

[2021-12-06T18:25:20.262Z] The 'ProcessUserData' function is in error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.ProcessUserData'. Microsoft.Azure.WebJobs.Extensions.Storage: Storage account connection string for 'AzureWebJobsQueueSettings:StorageAccount' is invalid.

This works fine when using the full connection string with Account Key, but we have to be using managed identities. I have upgraded to the latest version of Azure Functions Core Tole (3.0.3904) and am using Visual Studio 2022.

Additional documentation that this should work: https://devblogs.microsoft.com/azure-sdk/introducing-the-new-azure-function-extension-libraries-beta/

Thanks for any insights.

3

2 Answers 2

5

I was able to resolve this by installing the 5.0.0-beta.4 version of the NuGet package "Microsoft.Azure.Functions.Worker.Extensions.Storage".

Now Managed Identify functionality is working as expected. Hopefully this will go to GA soon.

Sign up to request clarification or add additional context in comments.

1 Comment

My functions tools put this package on 4.0.4. Updating this to 5.0.0 resolved my issue.
1

I had to delete:

"OPLRouting__credential": "managedIdentity",

to work with system generated identity on Event Hub

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.