Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Connection Strings using Azure App Service Deploy #9017

Closed
gwoody1984 opened this issue Dec 6, 2018 · 7 comments
Closed

Deploy Connection Strings using Azure App Service Deploy #9017

gwoody1984 opened this issue Dec 6, 2018 · 7 comments
Assignees
Labels
Area: AzureAppService Label to monitor Azure App Service issues Area: Release enhancement

Comments

@gwoody1984
Copy link

Environment

  • Server - Azure Pipelines
  • Agent - Hosted
    • Hosted VS2017
  • Task - Azure App Service Deploy (Preview)
    • Version 4.* (preview)

Issue Description

I am attempting to deploy connection strings to an Azure Function App. I am able to specify app settings, but cannot figure out how to make my connection string show up in the connection string settings.

I would specify it manually through the Azure portal, but each new deployment wipes out the connection string, which would cause a manual step, which could be easily missed.

Is there a method of specifying a connection string for the connection strings settings?

@vincent1173 vincent1173 added the Area: AzureAppService Label to monitor Azure App Service issues label Dec 10, 2018
@vincent1173
Copy link
Contributor

@gwoody1984 , the story is in out backlog and the feature will be added soon.
In the meantime, you can add AZ CLI (or) Azure PowerShell task to update connection strings from Azure Pieplines.

@andreujuanc
Copy link

It'd be great to have an example to follow while there is no support for setting connection string via the task.

@vincent1173
Copy link
Contributor

az webapp config connection-string set -g MyResourceGroup -n MyUniqueApp -t mysql --settings mysql1='Server=myServer;Database=myDB;Uid=myUser;Pwd=myPwd;'

Reference

@andreujuanc
Copy link

Thanks, that'd help anyone having the same issue.

@llwydsj
Copy link

llwydsj commented Jun 18, 2019

For any googlers struggling with this in the mean time, you can set your connection strings using the Azure Powershell task with script:
$connStrings = @{ Default = @{ Type = "Custom"; Value = "$(DefaultConnStr)"}; AnotherDb = @{ Type = "Custom"; Value = "yourconnectionstring"}}; Set-AzureRmWebApp -ResourceGroupName YourResourceGroupName -Name YourWebAppName -ConnectionStrings $connStrings

@ArieHein
Copy link

ArieHein commented Jul 17, 2019

well initialy when you create the function, you should have a local.settings.json file. What ever values are in there are convereted to the appsettings.json file. If you have the connection string in the local json file it will be added to the appsettigns.json, which will then allow you to change values for the server/db/user/pass per the environments youre deploying to.

In my .net core based web app, I change the values to the appsettings.json before I deploy the webapp as I have my entity framework migration that requires the connection string to already have the right values in the connection string before I run the web app deployment.

@eaarora-ms eaarora-ms self-assigned this Jul 26, 2019
@vincent1173 vincent1173 removed their assignment Sep 11, 2019
@eaarora-ms
Copy link
Contributor

We have a new task for updating connection strings: https://github.com/microsoft/azure-pipelines-tasks/tree/master/Tasks/AzureAppServiceSettingsV1 now.
I hope this solves your query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: AzureAppService Label to monitor Azure App Service issues Area: Release enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants