0

I'm trying to deploy a .NET 6 web app to an Azure App Service using GitHub Actions but not sure where to put my database connection string that's currently in appsettings.json. Do I just need to add it as a connection string in the Azure portal or do I need to update the GitHub Action workflow file?

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
James
  • 105
  • 9
  • 1
    If it's a one-time thing, just add it to the configurations of the Azure app service. But if your connection string changes frequently then: I don't know if Github action provides a way or not, but you can use Azure CLI to update the connection string for an app service. I am pretty sure Github allows to run Azure CLI commands. https://learn.microsoft.com/en-us/cli/azure/webapp/config/connection-string?view=azure-cli-latest#az-webapp-config-connection-string-set – Mohammad Mudassir Jan 20 '22 at 07:30
  • 1
    Connection strings and other similar settings are considered secrets in most cases, so you should save them in Azure Key Vault, https://learn.microsoft.com/en-us/azure/app-service/app-service-key-vault-references, not a clear text config file. – Lex Li Jan 20 '22 at 17:22
  • 1
    Ended up being a naming issue. This [post](https://stackoverflow.com/questions/57606636/azure-cannot-access-connection-string-stored-in-app-service-configuration) had the solution. – James Jan 21 '22 at 05:52

0 Answers0