azure-tools-for-intellij icon indicating copy to clipboard operation
azure-tools-for-intellij copied to clipboard

Error Loading Function Apps with WEBSITE_CONTENTAZUREFILECONNECTIONSTRING provided by Key Vault

Open kwasak opened this issue 5 years ago • 6 comments

IntelliJ build version: 2019.2.3 RD-192.7317.11 OS: Mac OS X JDK: JetBrains s.r.o 11.0.4 Plugin version: 3.26.0.565-2019.2 Error message:

com.microsoft.azure.management.appservice.DefaultErrorResponseException: Status code 500, {"Code":"InternalServerError","Message":null,"Target":null,"Details":[{"Message":null},{"Code":"InternalServerError"},{"ErrorEntity":{"Code":"InternalServerError","Message":null}}],"Innererror":null}
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at com.microsoft.rest.ServiceResponseBuilder.build(ServiceResponseBuilder.java:122)
	at com.microsoft.azure.AzureResponseBuilder.build(AzureResponseBuilder.java:56)
	at com.microsoft.azure.management.appservice.implementation.WebAppsInner.getDiagnosticLogsConfigurationDelegate(WebAppsInner.java:4743)
	at com.microsoft.azure.management.appservice.implementation.WebAppsInner.access$2500(WebAppsInner.java:59)
	at com.microsoft.azure.management.apps

kwasak avatar Nov 20 '19 17:11 kwasak

I'm not able to see any of the function apps or deploy, this is a blocker for me.

kwasak avatar Nov 20 '19 20:11 kwasak

Looks like this issue is caused by a key vault reference in the storage account connection string in the function app. If I remove the key vault reference string then it works. See Key Vault For App Services

kwasak avatar Nov 21 '19 00:11 kwasak

@kwasak This is with a setting similar to this, right? @Microsoft.KeyVault(SecretUri=https://.....vault.azure.net/secrets/Foo/......)

The exception seems like a server-side error in the Azure Management API's, does it still happen right now when listing function apps? (even those with a Key Vault setting?)

maartenba avatar Nov 21 '19 10:11 maartenba

Yes @maartenba it’s in the format you described.

It appears to happens when listing function apps in the azure explorer that have a key vault reference for the setting WEBSITE_CONTENTAZUREFILECONNECTIONSTRING. If I enter the raw string for this setting then I don't get an exception.

When picking a function app to deploy to in the build configuration options, I don’t get an exception, however nothing seems to load. I tried it on Visual Studio for Mac and Windows and they work fine.

Also worth noting, I didn't get an exception after adding a key vault reference for Azure Settings APPINSIGHTS_INSTRUMENTATIONKEY and AzureWebJobsStorage.

kwasak avatar Nov 21 '19 15:11 kwasak

After investigating, it looks like the Azure Management API is returning a 500 status code on the following request:

https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{siteName}/config/logs?api-version=2018-02-01

The response:

{"Code":"InternalServerError","Message":null,"Target":null,"Details":[{"Message":null},{"Code":"InternalServerError"},{"ErrorEntity":{"Code":"InternalServerError","Message":null}}],"Innererror":null}

This request originates from the FunctionAppsImpl class in the Azure Management SDK for Java which we use under the hood. The actual call is initiated in WebAppsInner on or near line 1994.

I have opened an issue with Microsoft at Azure/azure-libraries-for-java#906.

maartenba avatar Nov 24 '19 16:11 maartenba

@maartenba Ok good to hear, looking forward to a fix

kwasak avatar Nov 24 '19 18:11 kwasak