2

On deploying an Azure function, I see the following exception in Application Insights:

enter image description here

I have the following in config setting:

enter image description here

The key vault contains the service bus connection string:

enter image description here

What am I missing?

user989988
  • 3,006
  • 7
  • 44
  • 91
  • Have you confirmed whether the connection string is valid? Could you share your `appsetting.json` file? And sometimes reopen the visual studio can fix the issue. – unknown Jan 27 '21 at 02:32
  • @user989988 -Two questions - 1) How you reading this configuration setting in your code? 2) Check if keyvault reference is resolved. For that go to Kudu -> appsettings- > this will open a new tab in browser with all the settings; if you setting is resolved then should be should be having the secret value and if not then reference like `@Microsoft.KeyVault......`. If not resolved, then your function's system identity is not added into keyvaullt. – user1672994 Jan 27 '21 at 03:42

2 Answers2

4

Make sure any environment variable you read (like Environment.GetEnvironmentVariable("key")) has value in Azure App Service settings.

Publish tab > hosting section > ... > Manage Azure App Service settings > check if any key doesn't have value

publish tab

app settings

Circle Hsiao
  • 1,497
  • 4
  • 22
  • 37
  • mainly to make sure the REMOTE have values – James Rao Aug 30 '22 at 01:09
  • In my case I was missing Application Settings in the creation of a new environment. In the Function App go to Configuration under settings and then validate that all Application Settings your function is expecting are set and set correctly. – user2197446 Jul 07 '23 at 16:18
0

There are couple of things you can check :

  1. If we are using any connection endpoint and reading the value from the appsettings. If yes, check the value of that settings.
  2. Please confirm whether we are using a valid service bus connection endpoint in this case. ( if there is any)

These are very generic explanation for the problem statement as that doesn't provide more details. In case of functions many a times we see this error because if the connection string value is read from Azure Key Vault and you miss out on setting this value in the app settings of Azure Function configuration. In this scenario, an Access Policy created in the Key Vault configuration so that Azure Function application can read the values from the Key Vault. So you need to reverify the access policies to make sure the app settings values of the keys have valid values.