question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUERY]How to set AzureWebJobsStorage while using managed identity with blob triggered function?

See original GitHub issue

Query/Question Hi there, I’m an Azure newbie and I want to compose a pr for Terraform Azure Provider to solve this issue, but found myself stuck in figuring out whether I need set AzureWebJobsStorage or not. If I need set AzureWebJobsStorage, what value should I set since I want get rid of storage account access key?

I’ve written a blob triggered function:

[FunctionName("Function1")]
        public static void Run([BlobTrigger("container1/{name}")]Stream myBlob, [Blob("container2/{name}", FileAccess.Write)] Stream o, string name, ILogger log)
        {
            log.LogInformation($"C# Blob trigger function Processed blob\n Name:{name} \n Size: {myBlob.Length} Bytes");
            myBlob.CopyTo(o);
        }

It works fine if I set AzureWebJobsStorage with AccountName and AccountKey, but if I delete AzureWebJobsStorage or remove these two properties from the setting, the function stopped working.

I’ve already granted my system assigned identity Storage Blob Data Owner and Storage Queue Data Contributor roles to my storage account, and both container1 container2 belong to the same storage account, and I’ve set AzureWebJobsStorage__accountName to my storage account name, but still have no luck. Have I missed something? I’ve read #21753 and I thinks it must be my fault because someone did it.

Would @kasobol-msft be so kind to give me some advice? Many thanks!


Btw, as Azure Function builtin monitoring requires AzureWebJobsDashboard string, how to compose a valid AzureWebJobsDashboard while using mis only? Many thanks!

Environment: Microsoft.Azure.WebJobs.Extensions.Storage 5.0.0-beta.5 Visual Studio 2019

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
lonegunmanbcommented, Sep 30, 2021

Hello @kasobol-msft , finally my function worked on Azure with AzureWebJobsStorage__accountName only, thanks to your guidance, I can’t get this far without your help. But my function worked after I added Owner role to my identity on my storage account, otherwise the log in application insight will complain about permission denied on reading storage secret. I guess there must some other iam issues on my side, nevertheless it’s enough for me to continue my terraform work. Thanks again, you saved my day!

0reactions
kasobol-msftcommented, Sep 29, 2021

@lonegunmanb Thanks for the details. I have the following suggestions.

You mentioned that you got a function deployed to Azure working by granting relevant roles. I’m not sure why you’d add additional AzureWebJobsStorage to app settings. I suggest to remove it.

As for local development. It appears that you’re using older Azure Functions Core Tools/Function Runtime Version. The minimum version where secretless support was added is 3.0.15733.0. However, I suggest to update to latest. Please see here how to do this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Use managed identity instead of AzureWebJobsStorage to ...
In a function app, usually we use appsetting AzureWebJobsStorage to connect to storage. This blog shows you how to configure a function app ......
Read more >
connect to AzureWebJobsStorage using a Managed Identity
The steps are straightforward. Create a Managed Identity for the Azure Function. Give it the Storage Blob Data Owner and Storage Queue Data ......
Read more >
How to trigger blob function with user assigned identity
1 Answer. No, you can't. The MSI(managed identity) is not for such usage, it is just used for authenticating to azure services that...
Read more >
Storage Binding using Managed Identity instead of ...
Is there a possibility to use a blob storage binding against a blob storage using the Managed Service Identity of the Azure Function?...
Read more >
How to Upload Blobs to Azure Storage from an ... - Jon Gallant
Option 1: Assign a System Assigned Managed Identity to Function App. This will enabled a Managed Identity for the Function App and assign...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found