You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/tutorial-dotnetcore-sqldb-app.md
+4-17Lines changed: 4 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,7 +174,7 @@ To see the entirety of the command output, drop the `--query` in the command.
174
174
175
175
## 5 - Generate the Database Schema
176
176
177
-
To generate our database schema, set up a firewall rule on the SQL database server. This rule lets your local computer connect to Azure. For this step, you'll need to know your local computer's IP address. For more information about how to find the IP address, [see here](https://whatismyipaddress.com/).
177
+
To generate our database schema, set up a firewall rule on the SQL database server. This rule lets your local computer connect to Azure.
178
178
179
179
### [Azure portal](#tab/azure-portal)
180
180
@@ -195,26 +195,13 @@ az sql server firewall-rule create --resource-group msdocs-core-sql --server <yo
195
195
196
196
---
197
197
198
-
Next, update the *appsettings.json* file in the sample project with the [connection string Azure SQL Database](#4---connect-the-app-to-the-database). The update allows us to run migrations locally against our database hosted in Azure. Replace the username and password placeholders with the values you chose when creating your database.
Next, update the *Startup.cs* file the sample project by updating the existing connection string name `MyDbConnection` to `AZURE_SQL_CONNECTIONSTRING`:
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:
198
+
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.
212
199
213
200
```dotnetcli
214
201
cd <sample-root>\DotNetCoreSqlDb
215
202
dotnet tool install -g dotnet-ef
216
203
dotnet ef migrations add InitialCreate
217
-
dotnet ef database update
204
+
dotnet ef database update --connection "<your-azure-sql-connection-string>"
218
205
```
219
206
220
207
After the migration finishes, the correct schema is created.
@@ -223,7 +210,7 @@ If you receive the error `Client with IP address xxx.xxx.xxx.xxx is not allowed
223
210
224
211
## 6 - Deploy to the App Service
225
212
226
-
That we're able to create the schema in the database means that our .NET app can connect to the Azure database successfully with the new connection string. Remember that the service connector already configured the `AZURE_SQL_CONNECTIONSTRING` connection string in our App Service app. We're now ready to deploy our .NET app to the App Service.
213
+
That we're able to create the schema in the database means that our .NET app can connect to the Azure database successfully with the new connection string. Remember that the service connector already configured the `AZURE_SQL_CONNECTIONSTRING` connection string in our App Service app. We're now ready to deploy our .NET app to the App Service. When the app is deployed, the `AZURE_SQL_CONNECTION` configuration applied to the App Service by the Service Connector will override the `localdb` connection string with the same name in the `appsettings.json` file.
227
214
228
215
### [Deploy using Visual Studio](#tab/visualstudio-deploy)
0 commit comments