Reputation: 215
I'm having a weird issue with my Azure App Function and I can't find anything on this.
I republished my function without changing its code, but suddenly the function stopped working and I'm getting this message as soon as I navigate to the function's page on Azure:
Error:
Error retrieving master key.
If I navigate to the function's settings, I can see that no keys have been generated and that host.json
file is emptpy. Browsing my functions' files using Kudu, however, shows that file contents are correct.
Two more things make this weirder:
Do you guys have any pointer on this?
EDIT:
Let me add more details on this.
Let's say I have 2 solutions, A.sln
and B.sln
.
I also have 2 App Functions on Azure, let's say F_1
and F_2
.
A.sln
and B.sln
have the very same structure, the only difference is in business logic.
Same applies for F_1
and F_2
, their only differences are the related storage accounts, as each function has its own.
Currently A.sln
is deployed on F_1
and B.sln
on F_2
, and the only one working is F_1
.
If I deploy A.sln
on F_2
, F_2
starts working, so my idea is that there's something wrong in B.sln
's code because A.sln
works with the very same configuration.
Upvotes: 2
Views: 2625
Reputation: 1
One of the reasons could be, the key inside the storage account might have been rotated. So, the connection strings referenced inside the AzureWebJobsDashboard
and AzureWebJobsStorage
of the azure function will be different.
Solution: Go to the storage account referenced in AzureWebJobsDashboard
and AzureWebJobsStorage
-> Access Keys -> Copy the connection string under key1 and use this for the AzureWebJobsDashboard
and AzureWebJobsStorage
.
Upvotes: 0
Reputation: 81
I don't know if this is the case here, but I found out that in my case (new deployment of Function App v3) host.json
is empty on Azure, if there is a comment line in it. Removing comments solved my problem and host.json file is now deployed properly.
Upvotes: 1
Reputation: 4109
The Function App has a reference to a Storage account in application settings AzureWebJobsDashboard
, AzureWebJobsStorage
and WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
(if you are running on a consumption plan). Either clearing out this storage or simply recreating it fixed the problem.
I would also recommend creating separate storage accounts for every Function app - at least as long as these hard-to-find bugs are present. It is a lot easier to fix these kind of issues when they are only affecting a single Function app.
Upvotes: 3