Azure Functions | Unable to retrieve Functions keys | The function runtime is unable to start |Function host is not running | We are not able to retrieve the keys for function


Azure Functions | Unable to retrieve Functions keys |  The function runtime is unable to start | Function host is not running


Issue:
You might face one of the following exceptions while working with Azure functions.

·       Unable to retrieve Functions Keys

·       We are not able to retrieve the keys for function

·       The function runtime is unable to start. 

·       Function host is not running.

·       Internal Server error.

·       Service Unavailable.


Analysis:

When you create an Azure functions then few keys are created with it.
You can check those keys in “Function app Settings” section. 
Same keys can also be checked in the managed section.

We are not able to retrieve the keys for function


These keys are known as authorization keys. Refer below URL for more info


The most probable root cause of these exception is, “MISSING HOST KEYS”.

You can check below screen shot where I deleted the host keys and I started getting these exception messages.



These messages indicate REST API failure which retrieve host keys.

Following point can be one of the reasons for this issue,


  • When you delete or create same Azure function through ARM Template.
  • When you use same storage account or content share for multiple Azure functions.
  • When you use secret keys from some other Azure functions

Solution:

The quickest way to resolve this issue is to RESET/CREATE these keys.
·       Go to KUDU https://<yourapp>.scm.AzureWebsites.net
·       Debug Console-> CMD.
·       Go to the secret keys path d:\home\data\functions\secrets
·       Download host.json file for backup and delete host.json file
·       Go to Process Explorer from top menu
·       Right click on the w3wp.exe process -> Kill

We are not able to retrieve the keys for function

·       RESTART your function app.
·       This action will create host.json and will create new keys.

Important Note
Before implementing these steps please make sure that you update all dependent APIs/Applications which were using these keys as your keys may be changed and dependent application will have to update accordingly.

Now, when you will open your function app again, you will observe that those keys are created, and exception message is disappeared.

We are not able to retrieve the keys for function

   Hope this helps. Please share your feedback.




3 comments:

  1. Thanks. This helps and resolved my issue

    ReplyDelete
  2. How to resolve this issue if Function app is on Linux platform?

    ReplyDelete