I am getting the following errors in my Blob Triggered Azure Function App:
Azure.Core: No such host is known. (examplestorage.blob.core.windows.net:443). System.Net.Http: No such host is known. (examplestorage.blob.core.windows.net:443). System.Net.Sockets: No such host is known.
We were not able to load some functions in the list due to errors. Refresh the page to try again.
I have an Azure Function app which is Blob triggered:
[Function("ExampleFunction")]
public async Task Run([BlobTrigger("%BlobPath%", Connection = "AzureWebJobsStorage")] Stream myBlob, string name)
Previously I was using a connection string to connect to the Storage Account, however I want to update this to Managed Identity. I have followed this tutorial here:
I have added the following attributes in Environment Variables:
AzureWebJobsStorage__accountName = examplestorage
AzureWebJobsStorage__blobServiceUri = https://examplestorage.blob.core.windows.net
AzureWebJobsStorage__credential = managedidentity
AzureWebJobsStorage__queueServiceUri = https://examplestorage.queue.core.windows.net
Instead of Connection = AzureWebJobsStorage, I have also tried using something like Connection = BlobTriggerConnection, then adding the following Environment Variables:
BlobTriggerConnection__blobServiceUri = https://examplestorage.blob.core.windows.net
BlobTriggerConnection__credential = managedidentity
BlobTriggerConnection__queueServiceUri = https://examplestorage.queue.core.windows.net
However this did not work for me either.
I am using a dedicated App Service Plan (ASP): Premium v3 P2V3 (I have seen it does not work with consumption or elastic premium plans)
I am also using the following:
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage" Version="6.6.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues" Version="5.5.0" />
I have granted the following role assignments to the Function App to the Storage Account:
Storage Account Contributor
Storage Blob Data Owner
Storage Queue Data Contributor
I have also seen that it does not work with the connection strings:
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING
WEBSITE_CONTENTSHARE
My function app did have these app settings, and according to this discussion here, once the settings have been set there isn't a way to use Managed Identity. So, I have also tried re-deploying the Function App and ensured these variables were not ever present. However I still get the same error as I am getting in the original function app. https://techcommunity.microsoft.com/t5/apps-on-azure-blog/use-managed-identity-instead-of-azurewebjobsstorage-to-connect-a/ba-p/3657606
There was a very small typo in the storage account name. This has been fixed.