Azure DevOps - Configure Connection Strings for Azure Function App

visibility 6 comment 0 access_time 2 months ago languageEnglish

I love Azure DevOps as it is very simple to use yet powerful. If you happen to use Azure DevOps release pipeline to deploy your Azure Functions, you may find out that there is no place to configure Connection strings.

The common approach is to use Azure Function App task to deploy Azure Functions. Regardless of using YAML or the classic UI, you won't find a place to configure connection strings like Entity Framework connection strings for your app. Go to task documentation, there is no settings for connection strings.

Since the application is deployed as an web application, we can also use Azure App Service Settings task to configure connection strings for your Azure Function App: Azure App Service Settings task - Azure Pipelines.

Use Azure App Service Settings task

Follow these steps to set it up.

  1. Add Azure App Service Settings task to your Azure release pipeline.
  2. Select your subscription, App Service Name (in this case, the Azure Function App name) and Resource group.

  3. Now you can configure the settings include connectionStrings: Connection strings to be entered using JSON syntax. Values containing spaces should be enclosed in double quotes.
  4. In Connection Strings of the task property, input the following:
    [
    	{
    		"name": "DefaultConnection",
    		"value": "$(DefaultConnection)",
    		"type": "SQLAzure",
    		"slotSetting": false
    	}
    ]

    The above input will create a connection string named DefaultConnection.

  5. Save the pipeline.

Run the release pipeline

Kick of the deploy and wait till the task is completed:


Go to Azure portal, you will find the connection string is configured:


copyright This page is subject to Site terms.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts