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/app-service-web-tutorial-dotnet-sqldatabase.md
+27-27Lines changed: 27 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ author: cephalin
10
10
ms.author: cephalin
11
11
---
12
12
13
-
# Tutorial: Deploy an ASP.NET app to Azure with Azure SQL Database
13
+
# Tutorial: Deploy an ASP.NET app with Azure SQL database to Azure
14
14
15
15
[Azure App Service](overview.md) provides a highly scalable, self-patching web hosting service. This tutorial shows you how to deploy a data-driven ASP.NET app in App Service and connect it to [Azure SQL Database](/azure/azure-sql/database/sql-database-paas-overview).
16
16
@@ -48,7 +48,7 @@ The sample project contains a basic [ASP.NET MVC](https://www.asp.net/mvc) creat
48
48
49
49
1. In the app, select **Create New** and create a couple of *to-do* items.
50
50
51
-

51
+

52
52
53
53
1. Test the **Edit**, **Details**, and **Delete** links.
54
54
@@ -62,13 +62,13 @@ The database context in this sample is a connection string named `MyDbConnection
62
62
63
63

64
64
65
-
1.Select**Azure** as your target and select **Next**.
65
+
1.On the **Publish** screen, select**Azure** as your target and select **Next**.
66
66
67
-
1.Make sure that **Azure App Service (Windows)** is selected and select **Next**.
67
+
1.On the next screen, make sure that **Azure App Service (Windows)** is selected and select **Next**.
68
68
69
69
### Sign in and add an Azure App Service
70
70
71
-
1. On the **Publish** dialog screen, sign in to your Microsoft account and the subscription you want to use.
71
+
1. On the next **Publish** screen, sign in to your Microsoft account and the subscription you want to use.
72
72
73
73
1. Next to **App Service**, select **Create new**.
74
74
@@ -78,6 +78,8 @@ The database context in this sample is a connection string named `MyDbConnection
78
78
79
79
On the **App Service (Windows)** screen, configure the App Service **Name**, **Resource group**, and **Hosting Plan**.
80
80
81
+

82
+
81
83
1. Under **Name**, you can keep the generated web app name, or change it to another name with characters `a-z`, `0-9`, and `-`. The web app name must be unique across all Azure apps.
82
84
83
85
1. Next to **Resource group**, select **New**, and name the resource group **myResourceGroup**.
@@ -98,9 +100,7 @@ On the **App Service (Windows)** screen, configure the App Service **Name**, **R
98
100
99
101

100
102
101
-
1. Select **Create**, and wait for the Azure resources to be created.
102
-
103
-

103
+
1. On the **App Service (Windows)** screen, select **Create**, and wait for the Azure resources to be created.
104
104
105
105
1. The **Publish** screen shows the resources you configured. Select **Finish**, and then select **Close**.
106
106
@@ -110,14 +110,14 @@ On the **App Service (Windows)** screen, configure the App Service **Name**, **R
110
110
111
111
Before you can create a database, you need a [logical SQL server](/azure/azure-sql/database/logical-servers). A logical SQL server is a logical construct that contains a group of databases managed as a group.
112
112
113
-
1. On the **Publish**tab of the **DotNetAppSqlDb**screen, in the **Service Dependencies** section, select the ellipsis **...** next to **SQL Server Database**, and select **Connect**.
113
+
1. On the **Publish**screen for the **DotNetAppSqlDb**app, in the **Service Dependencies** section, select the ellipsis **...** next to **SQL Server Database**, and select **Connect**.
114
114
115
115
> [!NOTE]
116
116
> Be sure to configure the SQL Database from the **Publish** tab, not the **Connected Services** tab.
117
117
118
118

119
119
120
-
1.Select**Azure SQL Database** and then select **Next**.
120
+
1.On the **Connect to dependency** screen, select**Azure SQL Database** and then select **Next**.
121
121
122
122
1. On the **Configure Azure SQL Database** screen, select **Create new**.
123
123
@@ -159,46 +159,46 @@ The connection string is set in the *Web.config* file and referenced in the *Mod
159
159
160
160
1. When the connection succeeds, at the top of the **Publish** tab, select **Publish**. Your ASP.NET app deploys to Azure, and your default browser launches to the URL of the deployed app.
161
161
162
-
1.Add a few to-do items.
162
+
1.To test the app, add a few to-do items.
163
163
164
164

165
165
166
166
Congratulations! Your data-driven ASP.NET application is running live in Azure App Service.
167
167
168
-
## Access the database locally
168
+
## Use SQL Server Object Explorer
169
169
170
-
You can use **SQL Server Object Explorer** in Visual Studio to easily explore and manage your Azure SQL database. In **SQL Server Object Explorer**, you can perform most common database operations, such as running queries or creating views and stored procedures.
171
-
172
-
The new database opened its firewall to the App Service app you created. To access the database from your local computer, such as from Visual Studio, you must open a firewall for your local machine's public IP address.
173
-
174
-
>[!NOTE]
175
-
>If your internet service provider changes your public IP address, you need to reconfigure the firewall to access the Azure database again.
170
+
You can use Visual Studio **SQL Server Object Explorer** to easily explore and manage your Azure SQL database. In **SQL Server Object Explorer**, you can perform most common database operations, such as running queries or creating tables, views, and stored procedures.
176
171
177
-
### Create a database connection
172
+
### Connect to the database locally
178
173
179
174
1. From the **View** menu, select **SQL Server Object Explorer**.
180
175
181
176
1. At the top of the **SQL Server Object Explorer** window, select the icon to **Add SQL Server**.
182
177
183
-
1. On the **Connect** screen, your connection appears under the **Azure** node. Fill in the information for your **Server Name**, **User Name**, **Password**, and **Database Name**, and select **Connect**.
178
+
1. On the **Connect** screen, your connection appears under the **Azure** node. Complete the information for your **Server Name**, **User Name**, **Password**, and **Database Name**, and select **Connect**.
184
179
185
180

186
181
187
-
### Allow client connection from your computer
182
+
1. Once Visual Studio finishes configuring the connection for your SQL Database instance, your database appears in **SQL Server Object Explorer**. Expand **\<your connection name>** > **Databases** > **\<your database name>** > to see the data.
188
183
189
-
By default, a server allows connections to its databases only from Azure services, such as your Azure app. To connect to your database from outside of Azure, such as from Visual Studio, you create a firewall rule at the server level.
184
+
1. Expand **Tables**, right-click the `ToDoes` table, and select **View Data** to interact with the database data.
190
185
191
-
If the **Create a new firewall rule** screen opens, make sure **Add my client IP** is selected and select **OK**. This firewall rule allows the public IP address of your local computer. The dialog box is already populated with your computer's public IP address.
186
+

192
187
193
-
Once Visual Studio finishes configuring the connection for your SQL Database instance, your database appears in **SQL Server Object Explorer**.
188
+
### Allow client connection from your computer
194
189
195
-
Expand your connection's > **Databases** > **\<your database>** > **Tables**. Right-click the `Todoes` table and select **View Data** to work with the database data.
190
+
By default, the Azure server allows connections to its databases only from Azure services, such as your Azure app. The new database opened its firewall to the App Service app you created.
196
191
197
-

192
+
To access the database from your local computer, such as from Visual Studio, the Azure server must open the firewall to allow access for the machine's public IP address.
193
+
194
+
If prompted to add access for your local client IP address, make sure to select the option to **Allow your computer's public IP address**. This option creates a firewall rule to allow the public IP address of your local computer. The dialog box is already populated with your computer's current IP address.
195
+
196
+
>[!NOTE]
197
+
>If your internet service provider changes your public IP address, you need to reconfigure the firewall to access the Azure database again.
198
198
199
199
## Update the app with Code First Migrations
200
200
201
-
You can use familiar tools in Visual Studio to update your database and app in Azure. In this step, you use Code First Migrations in Entity Framework to make a change to your database schema and publish it to Azure.
201
+
You can use familiar tools in Visual Studio to update your database and app in Azure. In this step, you use Code First Migrations in Entity Framework to change your database schema and publish the change to Azure.
202
202
203
203
For more information about using Entity Framework Code First Migrations, see [Getting Started with Entity Framework 6 Code First using MVC 5](/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application).
0 commit comments