Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set ConnectionString configuration for Azure App Service in Azure DevOps?

I am deploying a website written in Asp.Net Core 2.2 which has a connection to an Azure Sql Database. Where do I set the Connection String in the Azure App Service deploy task in Azure DevOps?

In my WebApp, the DefaultConnection is in appsettings.json which works fine locally. I want to override this when deployed to Azure.

I tried setting -DefaultConnection $(DefaultConnection) in the Application and Configuration Settings section of the Azure App Service deploy task but the Connection String did not get set. The value is in a variable in Azure DevOps.

Where am I going wrong?

like image 897
Mark Allison Avatar asked Oct 23 '25 16:10

Mark Allison


2 Answers

There is a new preview task Azure App Service Setting can help you with. enter image description here

You can refer to this Deploy Connection Strings using Azure App Service Deploy #9017

like image 183
Huodong Avatar answered Oct 26 '25 07:10

Huodong


It may need you define the value of ConnectionString in the Azure app service.

ConnectionString in Azure

This could not be configured in Variables if you want to set it in Configuration setting.

like image 43
Amy Avatar answered Oct 26 '25 07:10

Amy