Reputation: 175
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
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.
Upvotes: 4
Views: 5963
Reputation: 1018
I had to delete:
"OPLRouting__credential": "managedIdentity",
to work with system generated identity on Event Hub
Upvotes: 1
Reputation: 175
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.
Upvotes: 5