user989988
user989988

Reputation: 3736

ARM template deployed function app has no host keys and throws errors

I deployed a function app in Azure and on trying to "Code + Test" -> "Test + Run", I only see one key in the key dropdown - default (Function key):

enter image description here

App Keys section looks like below:

enter image description here

On running with this key, I see a 401 unauthorized error:

enter image description here

Shouldn't it show more number of keys in the dropdown? AppSettings contain

AzureWebJobsStorage

FUNCTIONS_EXTENSION_VERSION (~3)

FUNCTIONS_WORKER_RUNTIME

Am I missing something to display master (host) key in the key dropdown?

enter image description here

Upvotes: 5

Views: 3929

Answers (2)

Berthim
Berthim

Reputation: 198

Probably too late to help, but I just faced the issue and in my situation, the problem came from the virtual network.

In the App Function, go to Configuration and get the storage account name in the AzureWebJobsStorage setting.

Then go to this Storage Account > Firewalls and virtual networks, and check if it is included in a Virtual Network and a Subnet. If so copy their name somewhere.

Go back to the App Function > Networking > In the "VNet Integration" part, click on "Click here to configure", then add the app function into the same virtual network and subnet than the storage account.

In the App keys blade, the default keys should now be available.

Upvotes: 2

JayaChatterjee-MSFT
JayaChatterjee-MSFT

Reputation: 961

Have you redeployed (i.e. deleted and created again) this function app? The best way to resolve this 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

enter image description here Now,

  • RESTART your function app.
  • Open https://{yourapp}.azurewebsites.net
  • This action will create host.json and will create new keys.

You can also, try to restart the function app or change the value of "AzureWebjobsStorage" to another value( to a different storage) and restart the application.

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 be updated accordingly.

Upvotes: 0

Related Questions