Jeff Sanders Technical Blog

I am a Microsoft employee that has worked on all aspects of the Web Stack for a long time. I hope these blogs are useful to you! Use this information at your own risk.


<< Go Back

Function App Error We Are Not Able To Retrieve The Runtime Master Key

- 09 May 2017

When you access an Azure Function app from the portal it will attempt to retrieve the Function runtime keys.  This is documented at https://github.com/Azure/azure-webjobs-sdk-script/wiki/Http-Functions#api-keys .  There are a number of reasons why the keys cannot be retrieved and this article documents a recent change that means you may see this issue.

Possible errors

“We are not able to retrieve the runtime master key. Please try again later”

or

“We are not able to retrieve the keys for function …..This can happen if the runtime is not able to load your function app”

or

“We are not able to create or update the key default for function ……”

Possible solutions

The Azure Function runtime has been updated to include Application Insights support. This was previously offered in the beta runtime which you accessed by setting your Functions Runtime version to “beta”.  Some of these problems are related to the fact that beta is no longer usable.  Ensure you are not on beta.

These are a few solutions.

1) You are on the beta. At this point, the beta is no longer usable, and you need to switch the app setting back to ~1.

https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp#versioning

2) If you’re not on the beta and are still seeing this, try Stopping and then Starting your Function App

3) if neither of those work make sure you are using the latest version of the runtime:

https://github.com/Azure/azure-webjobs-sdk-script/wiki/Deploying-the-Functions-runtime-as-a-private-site-extension.

This link helps run through it but make sure you are using this commit in particular:

https://github.com/Azure/azure-webjobs-sdk-script/commit/6008a50b878e8698ad3a5d436567be78a2890e50

NOTE: that using a private site extension is by nature unsupported. Once you move to that mode, you are responsible for keeping it updated as the product evolves. Just merge the latest bits and redeploy, and you’ll be ok.

4)  App has a runtime error (check Failed Request Tracing for errors)

5)  App has exhausted some resource such as threads, cpu, memory etc…  (Typically deadlocked functions due to waiting on async tasks using .Result)

6)  Web browser is caching an old result (clear the browser cache, log out and back in).

7)  You regenerated the keys but did not set them in the app settings: https://social.msdn.microsoft.com/Forums/en-US/dc42cb2f-43c8-4047-b1eb-57590c61957f/azure-functions-stop-responding-saying-we-are-unable-to-access-your-function-keys?forum=AzureFunctions

8) host.json is not properly formatted json or invalid

 

##

Reference

https://github.com/Azure/Azure-Functions/issues/226#issuecomment-300223858

##

Conclusion

This is just a simple quick post that hopefully will set you in the right direction!  Drop me a note if this was helpful to you.  Thanks to Tyler Spring from my team for surfacing these issues and helping with the post.

For more assistance please jump on to the github issues, or functions forums and StackOverflow.

<< Go Back