Skip to content

Commit 4bfa853

Browse files
committed
fix
1 parent 90ff0af commit 4bfa853

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

articles/app-service/tutorial-dotnetcore-sqldb-app.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ az sql server firewall-rule create --resource-group msdocs-core-sql --server <yo
195195

196196
---
197197

198-
Next, update the name of the connection string in appsettings.json file to match the `AZURE_SQL_CONNECTION` name generated by the service connector. When the app is deployed to Azure, the `localdb` connection string value will be overridden by the connection string stored in Azure.
198+
Next, update the name of the connection string in `appsettings.json` file to match the `AZURE_SQL_CONNECTION` name generated by the service connector. When the app is deployed to Azure, the `localdb` connection string value will be overridden by the connection string stored in Azure.
199199

200200
```json
201201
// This local connection will be overridden with an Azure connection string after deployment
@@ -204,6 +204,13 @@ Next, update the name of the connection string in appsettings.json file to match
204204
}
205205
```
206206

207+
Next, update the `Startup.cs` file the sample project by updating the existing connection string name `MyDbConnection` to `AZURE_SQL_CONNECTIONSTRING`:
208+
209+
```csharp
210+
services.AddDbContext<MyDatabaseContext>(options =>
211+
options.UseSqlServer(Configuration.GetConnectionString("AZURE_SQL_CONNECTIONSTRING")));
212+
```
213+
207214
From a local terminal, run the following commands to install the necessary CLI tools for Entity Framework Core, create an initial database migration file, and apply those changes to update the database. Make sure to pass in the connection string you copied from the Azure SQL database for the `connection` parameter, which will override the `localdb` connection string in the `appsettings.json` file.
208215

209216
```dotnetcli

0 commit comments

Comments
 (0)