Raymond Raymond

Azure DevOps - Configure Connection Strings for Azure Function App

event 2021-09-05 visibility 3,042 comment 0 insights toc
more_vert
insights Stats

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.

2021090584258-image.png

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.
    2021090585810-image.png
  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:

2021090591049-image.png

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

2021090591145-image.png

More from Kontext
comment Comments
No comments yet.

Please log in or register to comment.

account_circle Log in person_add Register

Log in with external accounts