-
Notifications
You must be signed in to change notification settings - Fork 14
dsf azure connection strings
Once your database is created, you will need to connect that DB to your backend application, this can be made using connection strings.
Go to the Azure portal,select the App Service that you want to connect with the DB, to be able to establish this connection, both your DB and your App Service must be under the same resource group.
P.E
As we can see here, both the app service and the DB exist under the same resource group 'BW-dev'
Select your app service and go to 'settings > Configuration', scroll down looking for 'Connection strings' and click on "New connection string"
Put the name you want(we’ve put the name 'Context', this name will be used later in your appSettings.json) and select the DB type, and for fill the value box go to 'Home>SQL databases', click on the target DB and click on 'Show database connection strings', copy the value that appears there and paste it in the value box.
Paste the connection string in the 'value' box and click OK
Your connection string has been created.
Go to your project, open the file AppSettings.json and add the connection string
"ConnectionStrings": {
"Context": "Source=(localdb)\\MSSQLLocalDB;Initial Catalog=my-db;Integrated Security=True;"
}
Context is the name that we choose for the connection string that we’ve created before and that value is only for local purposes.
When the application is deployed,the value for context will be replaced for the value of the connection string that we’ve created in the earlier steps, using this we avoid to put the user and the password into the code and we use them as secrets that will be replaced in the deployment.
This documentation is licensed under the Creative Commons License (Attribution-NoDerivatives 4.0 International).
-
cicd configuration
-
Manual configuration
-
Automatic configuration
-
-
Custom Services
-
Azure DevOps