"We are not able to retrieve the runtime master key"

I have been seeing this error quite often after redeploying Azure Functions into some of our test environments lately.

The bug and a lot of details can be found here:
https://github.com/Azure/Azure-Functions/issues/226

The problem would remain after restarting the Function App, and even after deleting the entire app service and recreating it.

What I found to work was deleting the storage account which the Function app was connected to. 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.

Azure Portal: We are not able to retrieve the runtime master key