Forum Discussion
Unable to trigger function app while using managed identity for the storage account connection
I am trying to create an Azure Function of BlobTrigger type, which needs to be triggered on dropping files in the storage account say filessa. Due to policy restriction the storage account cannot use shared access key.
I am unable to trigger the function app dropping a file into a container. I see intermittently an error in the function app logs No valid combination of account information found.
assembly : Azure.Storage.Blobs, Version=12.23.0.0, Culture=neutral, PublicKeyToken=9279e12e44c8
method : Azure.Storage.StorageConnectionString+<>c.<Parse>b__67_0
outerType : Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException
outerMessage: Error indexing method 'Functions.SPAREventGridBlobTrigger'
innermostMessage: No valid combination of account information found.
I am referring to Configuring Azure Blob Trigger Identity Based Connection and have created the environment settings and assigned required roles to storage accounts (function App's storage account, say fnsa and the storage account which is used to upload the file to trigger the function app, filessa) as mentioned in this article.
This is my simple code
[Function(nameof(SPAREventGridBlobTrigger))]
public async Task Run([BlobTrigger("samples-workitems/{name}", Source = BlobTriggerSource.EventGrid, Connection = "filessa_STORAGE")] Stream stream, string name)
{
using var blobStreamReader = new StreamReader(stream);
var content = await blobStreamReader.ReadToEndAsync();
Console.WriteLine("Hello from Jey Jey Jey");
_logger.LogInformation($"C# Blob Trigger (using Event Grid) processed blob\n Name: {name} \n Data: {content}");
}
I have assigned roles to the storage account filessa Storage Blob Data Owner and Storage Queue Data Contributor for the Azure Function identity.
and assigned roles to the storage account fnsa Storage Blob Data Contributor for the Azure Function identity.
(Actually I ended up adding many other roles like Storage Account Contributor, Storage Blob Data Reader and similar too to both storage accounts)
Please advice me to on the items to be added in the environment settings.
1. the name and value of the connection of the storage account, filessa
2. the name and value of the connection of the storage account, fnsa
3. other items that needs to be mandatorily added to make it work
I have tried added items like
AzureWebJobsStorage, AzureWebJobsStorage__accountName, AzureWebJobsStorage__blobServiceUri, ...,
AzureWebJobsfilessa_STORAGE, filessa_STORAGE.
I have also referred to this microsoft documentation https://learn.microsoft.com/en-us/azure/azure-functions/functions-event-grid-blob-trigger?pivots=programming-language-csharp ; tried adding the EventSubscription in the storage account filessa.
The webhook https://FA-SPAREG-FA.azurewebsites.net/runtime/webhooks/blobs?functionName=Host.Functions.SPAREventGridBlobTrigger&code=_MPRFuo9sdEg== in Postman with POST returned back error
Please help me with all the required environment settings to be added in the function app in Azure
and any other suggestion or steps I have missed here to make this work.
1 Reply
Please cross check below:
1. For filessa (your blob-trigger storage account):
- filessa_STORAGE__accountName = filessa
- filessa_STORAGE__blobServiceUri = https://filessa.blob.core.windows.net
- filessa_STORAGE__queueServiceUri = https://filessa.queue.core.windows.net
2. For fnsa (your function app's storage account):
- AzureWebJobsStorage__accountName = fnsa
- AzureWebJobsStorage__blobServiceUri = https://fnsa.blob.core.windows.net
- AzureWebJobsStorage__queueServiceUri = https://fnsa.queue.core.windows.net
3. Make sure MI is enabled