5

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

user989988
  • 3,006
  • 7
  • 44
  • 91

2 Answers2

2

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.

Berthim
  • 198
  • 10
  • 1
    Thank you. My function app was vnet integrated with WEBSITE_VNET_ROUTE_ALL set to 1. However, my storage account was not in that same subnet. Adding my storage account to the same subnet solved the issue. – Thomas Detemmerman Dec 18 '20 at 08:45
  • I’m still seeing the issue. On checking Storage Account-Firewalls and virtual networks, I don’t see anything included in a Virtual Network and a Subnet. Could you please help? – user989988 Feb 15 '21 at 08:19
0

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.

  • Thank you! I don't see a folder named functions within d:\home\data. I only see 2 folders - aspnet and jobs. What could be the reason? – user989988 Sep 08 '20 at 00:47
  • Can you change the function app name and deploy again ? check if the folders are there. Also you can validate the ARM template you are using by comparing this with a template from portal. { if you try to create a function app from portal , you'll see a link "Download the template" at the last step. – JayaChatterjee-MSFT Sep 08 '20 at 06:26
  • To answer your question, jobs folder is for the webjobs. Inside that you can see Continuous and Triggered folder for two types of webjobs. Please make sure you are navigating to the correct app service. – JayaChatterjee-MSFT Sep 08 '20 at 09:14
  • 1
    I see a folder named 'Sentinels' in secrets folder. I don't see host.json. I restarted function app but I still don't see host.json and still don't see any keys except 'default (Function key)' with 401 unauthorized error. Could you please let me know if I am missing something? – user989988 Sep 09 '20 at 05:48