Michel
Michel

Reputation: 23615

Where to put my Azure storage account queue connectionstring (used by my Azure function)

I have an Azure storage account with a queue in it. Now in my function (created in Visual Studio) I have this:

    public IActionResult Run(
        [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]
        HttpRequest req,
        [Queue("temperatuurmeting"), StorageAccount("AzureWebJobsStorage")]
        ICollector<string> messages,
        ILogger log)
    {
    `

I host the code in BitBucket, and when I commit something it gets deployed to Azure, and it works.

But.... the AzureWebJobsStorage connection string is (automatically created when I created my function in Visual Studio) in the local.settings.json, which I just read should not be in the code repository.

But: when I do not include the local.settings.json in de code repo, and then deploy it to Azure, where should I put the AzureWebJobsStorage connectionstring so that my running function can find it?

Or is AzureWebJobsStorage a default name and already somewhere in Azure created by something other than me and can I just remove the local.settings.json?

Upvotes: 0

Views: 110

Answers (1)

Hadi Haidar
Hadi Haidar

Reputation: 337

Locally:

"Connection": "Endpoint=sb://****.servicebus.windows.net/;SharedAccessKeyName=****;SharedAccessKey=*********" 

in local.settings.json

    public static void Run([ServiceBusTrigger("attended", Connection = "Connection")]string myQueueItem, ILogger log)

in the function

When you publish go to the portal go to your function app settings variables

and then add the variable you used

Upvotes: 2

Related Questions