Azure Function with storage queue trigger works when running function in Visual Studio locally but not when function is published or ADO deployed

Lance Lyons 86 Reputation points
2023-01-23T22:25:12.6333333+00:00

Hi, Experimenting with Azure functions, Storage queues and app insights. I have a .net 6 function that is a storage queue triggered function. When I run the function in visual studio it picks up the message from the proper storage queue. However when I publish this function to the functional app either through Visual Studio or Azure DevOps, the function will not pick up the message and of course nothing shows on app insights. As soon as I run the function in Visual Studio, it picks up the message and logs the activity

what might I be missing here. Is running the function in VS locally different than running in the Azure Portal function app?

I have checked the queue names and the Storage connection string name and values.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,238 questions
{count} votes

Accepted answer
  1. Nitish Sharma 336 Reputation points
    2023-01-23T23:38:06.47+00:00

    You are correct that when you deploy your function app from Visual Studio or Azure DevOps, the local.settings.json file does not get deployed to the Azure Function App, so the connection string defined in it will not be available to the function app.

    To resolve this issue, you can use one of the following methods:

    You can set the connection string as an app setting in the Azure portal, by going to the Configuration tab of the function app and adding an app setting with the key "AzureWebJobsazStorageConnString" and the value of the connection string.

    You can use the Azure Function App's Managed Identity to access the storage account, this way you don't need to store the connection string in the app setting.

    You can use the Azure Key Vault to store the connection string, this way you can secure the connection string and access it from the function app.

    By doing so, the function app will be able to find the storage account connection string and will be able to read from the storage queue.

    Make sure that you have the correct name of the app setting in the function code and it matches the one you have defined in the portal/key vault.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful