您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

教程:使用 SQL 数据库在 Azure 中构建 ASP.NET 应用Tutorial: Build an ASP.NET app in Azure with SQL Database

Azure 应用服务提供高度可缩放、自修补的 Web 托管服务。Azure App Service provides a highly scalable, self-patching web hosting service. 本教程演示如何在应用服务中部署数据驱动的 ASP.NET 应用,以及如何将其连接到 Azure SQL 数据库This tutorial shows you how to deploy a data-driven ASP.NET app in App Service and connect it to Azure SQL Database. 完成后,你便拥有了一个在 Azure 中运行并连接到 SQL 数据库的 ASP.NET 应用。When you're finished, you have an ASP.NET app running in Azure and connected to SQL Database.

已在 Azure 应用服务中发布 ASP.NET 应用程序

本教程介绍如何执行下列操作:In this tutorial, you learn how to:

  • 在 Azure 中创建 SQL 数据库。Create a SQL Database in Azure
  • 将 ASP.NET 应用连接到 SQL 数据库Connect an ASP.NET app to SQL Database
  • 将应用部署到 AzureDeploy the app to Azure
  • 更新数据模型并重新部署应用Update the data model and redeploy the app
  • 将日志从 Azure 流式传输到终端Stream logs from Azure to your terminal
  • 在 Azure 门户中管理应用Manage the app in the Azure portal

如果还没有 Azure 订阅,可以在开始前创建一个免费帐户If you don't have an Azure subscription, create a free account before you begin.

先决条件Prerequisites

完成本教程:To complete this tutorial:

安装带有 ASP.NET 和 Web 开发工作负荷的 Visual Studio 2019Install Visual Studio 2019 with the ASP.NET and web development workload.

如果已安装 Visual Studio,请单击“工具” > Get Tools and Features“获取工具和功能”,以便在 Visual Studio 中添加工作负荷。If you've installed Visual Studio already, add the workloads in Visual Studio by clicking Tools > Get Tools and Features.

下载示例Download the sample

此示例项目包含一个使用 Entity Framework Code First 的基本 ASP.NET MVC 创建-读取-更新-删除 (CRUD) 应用。The sample project contains a basic ASP.NET MVC create-read-update-delete (CRUD) app using Entity Framework Code First.

运行应用Run the app

在 Visual Studio 中打开 dotnet-sqldb-tutorial-master/DotNetAppSqlDb.sln 文件。Open the dotnet-sqldb-tutorial-master/DotNetAppSqlDb.sln file in Visual Studio.

键入 Ctrl+F5 在不调试的情况下运行应用。Type Ctrl+F5 to run the app without debugging. 该应用将显示在默认浏览器中。The app is displayed in your default browser. 选择“新建”链接,创建一对待办事项。Select the Create New link and create a couple to-do items.

“新建 ASP.NET 项目”对话框

测试“编辑”、“详细信息”和“删除”链接。Test the Edit, Details, and Delete links.

该应用使用数据库上下文连接数据库。The app uses a database context to connect with the database. 在此示例中,数据库上下文使用名为 MyDbConnection 的连接字符串。In this sample, the database context uses a connection string named MyDbConnection. 此连接字符串在 Web.config 文件中设置,并在 Models\MyDatabaseContext.cs 文件中引用。The connection string is set in the Web.config file and referenced in the Models/MyDatabaseContext.cs file. 在教程后面部分,该连接字符串名称用于将 Azure 应用连接到 Azure SQL 数据库。The connection string name is used later in the tutorial to connect the Azure app to an Azure SQL Database.

使用 SQL 数据库发布到 AzurePublish to Azure with SQL Database

在“解决方案资源管理器”中,右键单击 “DotNetAppSqlDb”项目,并选择“发布”。In the Solution Explorer, right-click your DotNetAppSqlDb project and select Publish.

从解决方案资源管理器发布

确保已选择“Microsoft Azure 应用服务”,并单击“发布”。Make sure that Microsoft Azure App Service is selected and click Publish.

从项目概述页发布

发布将打开“创建应用服务”对话框,这有助于创建在 Azure 中运行 ASP.NET 应用所需的所有 Azure 资源。Publishing opens the Create App Service dialog, which helps you create all the Azure resources you need to run your ASP.NET app in Azure.

登录 AzureSign in to Azure

在“创建应用服务”对话框中单击“添加帐户”,并登录到 Azure 订阅。In the Create App Service dialog, click Add an account, and then sign in to your Azure subscription. 如果已登录到 Microsoft 帐户,请确保该帐户包含 Azure 订阅。If you're already signed into a Microsoft account, make sure that account holds your Azure subscription. 如果已登录的 Microsoft 帐户不包含 Azure 订阅,请单击该帐户以添加正确的帐户。If the signed-in Microsoft account doesn't have your Azure subscription, click it to add the correct account.

备注

如果已经登录,请先不要选择“创建”。If you're already signed in, don't select Create yet.

登录 Azure

配置 Web 应用名称Configure the web app name

可保留生成的 Web 应用名称,或将其更改为另一个唯一名称(有效字符是 a-z 0-9-)。You can keep the generated web app name, or change it to another unique name (valid characters are a-z, 0-9, and -). Web 应用名称将用作应用默认 URL 的一部分(<app_name>.azurewebsites.net,其中 <app_name> 是 Web 应用的名称)。The web app name is used as part of the default URL for your app (<app_name>.azurewebsites.net, where <app_name> is your web app name). Web 应用名称在 Azure 中的所有应用程序中必须是唯一的。The web app name needs to be unique across all apps in Azure.

“创建应用服务”对话框

创建资源组Create a resource group

资源组是在其中部署和管理 Azure 资源(如 Web 应用、数据库和存储帐户)的逻辑容器。A resource group is a logical container into which Azure resources like web apps, databases, and storage accounts are deployed and managed. 例如,可以选择在使用完之后通过一个简单的步骤删除整个资源组。For example, you can choose to delete the entire resource group in one simple step later.

在“资源组”旁边单击“新建”。Next to Resource Group, click New.

在“资源组”旁边单击“新建”。

将资源组命名为 myResourceGroup。Name the resource group myResourceGroup.

创建应用服务计划Create an App Service plan

应用服务计划指定托管应用的 Web 服务器场的位置、大小和功能。An App Service plan specifies the location, size, and features of the web server farm that hosts your app. 可以在托管多个应用时节省资金,方法是将多个 Web 应用配置为共用单个应用服务计划。You can save money when hosting multiple apps by configuring the web apps to share a single App Service plan.

应用服务计划定义:App Service plans define:

  • 区域(例如:北欧、美国东部或东南亚)Region (for example: North Europe, East US, or Southeast Asia)
  • 实例大小(小、中、大)Instance size (small, medium, or large)
  • 规模计数(1 到 20 个实例)Scale count (1 to 20 instances)
  • SKU(免费、共享、基本、标准、高级)SKU (Free, Shared, Basic, Standard, or Premium)

在“应用服务计划”旁边单击“新建”。Next to App Service Plan, click New.

在“配置应用服务计划”对话框中,使用以下设置配置新的应用服务计划:In the Configure App Service Plan dialog, configure the new App Service plan with the following settings:

创建应用服务计划

设置Setting 建议的值Suggested value 更多信息For more information
应用服务计划App Service Plan myAppServicePlanmyAppServicePlan 应用服务计划App Service plans
位置Location 西欧West Europe Azure 区域Azure regions
大小Size 免费Free 定价层Pricing tiers

创建 SQL Server 实例Create a SQL Server instance

在创建数据库时之前,需要 Azure SQL 数据库逻辑服务器Before creating a database, you need an Azure SQL Database logical server. 逻辑服务器包含一组作为组管理的数据库。A logical server contains a group of databases managed as a group.

单击“创建 SQL 数据库”。Click Create a SQL Database.

创建 SQL 数据库

在“配置 SQL 数据库”对话框中,单击“SQL Server”旁的“新建”。In the Configure SQL Database dialog, click New next to SQL Server.

将生成唯一的服务器名称。A unique server name is generated. 此名称用作逻辑服务器<server_name>.database.windows.net默认 URL 的一部分。 This name is used as part of the default URL for your logical server, <server_name>.database.windows.net. 在 Azure 中的所有逻辑服务器实例中,此名称必须是唯一的。It must be unique across all logical server instances in Azure. 可以更改服务器名称,但本教程沿用生成的值。You can change the server name, but for this tutorial, keep the generated value.

添加管理员用户名和密码。Add an administrator username and password. 有关密码复杂性要求,请参阅密码策略For password complexity requirements, see Password Policy.

牢记此用户名和密码。Remember this username and password. 随后,你需要用它们来管理逻辑服务器实例。You need them to manage the logical server instance later.

重要

虽然连接字符串中的密码已在 Visual Studio 和应用服务中受到屏蔽,但由于它实际上是保留在某个位置,因此增加了应用的受攻击面。Even though your password in the connection strings is masked (in Visual Studio and also in App Service), the fact that it's maintained somewhere adds to the attack surface of your app. 应用服务可以使用托管服务标识,因此根本不需要将机密保留在代码或应用配置中,这样就消除了上述风险。App Service can use managed service identities to eliminate this risk by removing the need to maintain secrets in your code or app configuration at all. 有关详细信息,请参阅后续步骤For more information, see Next steps.

创建 SQL Server 实例

单击“确定”。Click OK. 尚不要关闭“配置 SQL 数据库”对话框。Don't close the Configure SQL Database dialog yet.

创建 SQL 数据库Create a SQL Database

在“配置 SQL 数据库”对话框中:In the Configure SQL Database dialog:

  • 保留默认生成的数据库名称Keep the default generated Database Name.
  • 在“连接字符串名称”中,键入 MyDbConnectionIn Connection String Name, type MyDbConnection. 此名称必须与 Models\MyDatabaseContext.cs 文件中引用的连接字符串相匹配。This name must match the connection string that is referenced in Models/MyDatabaseContext.cs.
  • 选择“确定”。Select OK.

配置 SQL 数据库

“创建应用服务”对话框显示已配置的资源。The Create App Service dialog shows the resources you've configured. 单击“创建”。Click Create.

已创建资源

向导程序完成创建 Azure 资源后,会将 ASP.NET 应用发布到 Azure。Once the wizard finishes creating the Azure resources, it publishes your ASP.NET app to Azure. 默认浏览器启动时会打开所部署的应用的 URL。 Your default browser is launched with the URL to the deployed app.

添加几个待办事项。Add a few to-do items.

已在 Azure 应用中发布 ASP.NET 应用程序

祝贺你!Congratulations! 你的数据驱动的 ASP.NET 应用程序已经在 Azure 应用服务中运行了。Your data-driven ASP.NET application is running live in Azure App Service.

本地访问 SQL 数据库Access the SQL Database locally

使用 Visual Studio 可在“SQL Server 对象资源管理器”中轻松浏览和管理自己的新 SQL 数据库。Visual Studio lets you explore and manage your new SQL Database easily in the SQL Server Object Explorer.

创建数据库连接Create a database connection

从“视图”菜单上,选择“SQL Server 对象资源管理器”。From the View menu, select SQL Server Object Explorer.

在“SQL Server 对象资源管理器”顶部,单击“添加 SQL Server”按钮。At the top of SQL Server Object Explorer, click the Add SQL Server button.

配置数据库连接Configure the database connection

在“连接”对话框中,展开“Azure”节点。In the Connect dialog, expand the Azure node. 此处列出了 Azure 中全部的 SQL 数据库实例。All your SQL Database instances in Azure are listed here.

选择先前创建的 SQL 数据库。Select the SQL Database that you created earlier. 前面使用过的连接将自动填充在底部。The connection you created earlier is automatically filled at the bottom.

键入先前创建的数据库管理员密码,然后单击“连接”。Type the database administrator password you created earlier and click Connect.

通过 Visual Studio 配置数据库连接

允许来自计算机的客户端连接Allow client connection from your computer

系统将打开“新建防火墙规则”对话框。The Create a new firewall rule dialog is opened. 默认情况下,SQL 数据库实例仅允许来自 Azure 服务的连接,如 Azure 应用。By default, your SQL Database instance only allows connections from Azure services, such as your Azure app. 若要连接到你的数据库,请在 SQL 数据库实例中创建防火墙规则。To connect to your database, create a firewall rule in the SQL Database instance. 防火墙规则仅允许本地计算机的公共 IP 地址。The firewall rule allows the public IP address of your local computer.

对话框中已填充了计算机的公共 IP 地址。The dialog is already filled with your computer's public IP address.

请确保选中“添加我的客户端 IP”,并单击“确定”。Make sure that Add my client IP is selected and click OK.

为 SQL 数据库实例设置防火墙

Visual Studio 成功为 SQL 数据库实例创建防火墙设置后,连接将立即显示在“SQL Server 对象资源管理器”中。Once Visual Studio finishes creating the firewall setting for your SQL Database instance, your connection shows up in SQL Server Object Explorer.

可在此处执行最常见的数据库操作,如运行查询、创建视图和存储过程等。Here, you can perform the most common database operations, such as run queries, create views and stored procedures, and more.

展开连接 >“数据库” > <你的数据库 > > “表”。Expand your connection > Databases > <your database> > Tables. 右键单击Todoes表,然后选择“查看数据”。Right-click on the Todoes table and select View Data.

探索 SQL 数据库对象

使用 Code First 迁移更新应用Update app with Code First Migrations

可以在 Visual Studio 中使用熟悉的工具,更新 Azure 中的数据库和应用。You can use the familiar tools in Visual Studio to update your database and app in Azure. 此步骤使用 Entity Framework 中的 Code First 迁移对数据库架构进行更改,并将其发布至 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.

有关使用 Entity Framework Code First 迁移的详细信息,请参阅用 MVC 5 开始使用 Entity Framework 6 Code FirstFor more information about using Entity Framework Code First Migrations, see Getting Started with Entity Framework 6 Code First using MVC 5.

更新数据模型Update your data model

在代码编辑器中打开 Models\Todo.csOpen Models\Todo.cs in the code editor. 将以下属性添加到 ToDo 类:Add the following property to the ToDo class:

public bool Done { get; set; }

本地运行 Code First 迁移Run Code First Migrations locally

运行几个命令更新本地数据库。Run a few commands to make updates to your local database.

在“工具”菜单中,单击“NuGet 包管理器” > “包管理器控制台”。From the Tools menu, click NuGet Package Manager > Package Manager Console.

在“程序包管理控制台”窗口中,启用 Code First 迁移:In the Package Manager Console window, enable Code First Migrations:

Enable-Migrations

添加迁移:Add a migration:

Add-Migration AddProperty

更新本地数据库:Update the local database:

Update-Database

键入 Ctrl+F5 运行应用。Type Ctrl+F5 to run the app. 测试编辑、详细信息并创建链接。Test the edit, details, and create links.

如果应用程序加载未出错,则 Code First 迁移成功。If the application loads without errors, then Code First Migrations has succeeded. 但页面看上去仍没有变化,这是因为应用程序逻辑尚未使用新属性。However, your page still looks the same because your application logic is not using this new property yet.

使用新属性Use the new property

为使用 Done 属性,需要对代码做一些更改。Make some changes in your code to use the Done property. 简单起见,本教程中将仅更改 IndexCreate 视图,以便在操作过程中查看属性。For simplicity in this tutorial, you're only going to change the Index and Create views to see the property in action.

打开 Controllers\TodosController.csOpen Controllers\TodosController.cs.

在第 52 行找到 Create() 方法,并将 Done 添加到 Bind 特性中的属性列表。Find the Create() method on line 52 and add Done to the list of properties in the Bind attribute. 完成后,Create() 方法签名应如下面的代码所示:When you're done, your Create() method signature looks like the following code:

public ActionResult Create([Bind(Include = "Description,CreatedDate,Done")] Todo todo)

打开 Views\Todos\Create.cshtmlOpen Views\Todos\Create.cshtml.

在 Razor 代码中,你会看到使用model.Description<div class="form-group"> 元素,以及使用 model.CreatedDate<div class="form-group"> 元素。In the Razor code, you should see a <div class="form-group"> element that uses model.Description, and then another <div class="form-group"> element that uses model.CreatedDate. 紧跟在这两个元素之后的是使用 model.Done<div class="form-group"> 元素:Immediately following these two elements, add another <div class="form-group"> element that uses model.Done:

<div class="form-group">
    @Html.LabelFor(model => model.Done, htmlAttributes: new { @class = "control-label col-md-2" })
    <div class="col-md-10">
        <div class="checkbox">
            @Html.EditorFor(model => model.Done)
            @Html.ValidationMessageFor(model => model.Done, "", new { @class = "text-danger" })
        </div>
    </div>
</div>

打开 Views\Todos\Index.cshtmlOpen Views\Todos\Index.cshtml.

搜索空的 <th></th> 元素。Search for the empty <th></th> element. 在此元素的正上方,添加下列 Razor 代码:Just above this element, add the following Razor code:

<th>
    @Html.DisplayNameFor(model => model.Done)
</th>

查找包含 Html.ActionLink() 帮助程序方法的 <td> 元素。Find the <td> element that contains the Html.ActionLink() helper methods. 在此 <td> 上面,使用以下 Razor 代码添加另一个 <td> 元素:Above this <td>, add another <td> element with the following Razor code:

<td>
    @Html.DisplayFor(modelItem => item.Done)
</td>

这就是要在 IndexCreate 视图中查看更改所需的全部操作。That's all you need to see the changes in the Index and Create views.

键入 Ctrl+F5 运行应用。Type Ctrl+F5 to run the app.

现在可以添加一个待办事项,并勾选“完成”。You can now add a to-do item and check Done. 然后,它会在主页中显示为已完成的项。Then it should show up in your homepage as a completed item. 请记住,由于未更改Edit视图,Edit视图不显示Done字段。Remember that the Edit view doesn't show the Done field, because you didn't change the Edit view.

在 Azure 中启用 Code First 迁移Enable Code First Migrations in Azure

代码更改生效(包括数据库迁移)后,将其发布至 Azure 应用,并使用 Code First 迁移更新 SQL 数据库。Now that your code change works, including database migration, you publish it to your Azure app and update your SQL Database with Code First Migrations too.

与先前的操作相同,右键单击项目,并选择“发布”。Just like before, right-click your project and select Publish.

单击“配置”以打开发布设置。Click Configure to open the publish settings.

打开发布设置

在向导中,单击“下一步”。In the wizard, click Next.

请确保在 MyDatabaseContext (MyDbConnection) 中填充 SQL 数据库的连接字符串。Make sure that the connection string for your SQL Database is populated in MyDatabaseContext (MyDbConnection). 可能需要从下拉列表中选择“myToDoAppDb”数据库。You may need to select the myToDoAppDb database from the dropdown.

选择“执行 Code First 迁移(应用程序启动时运行)”,并单击“保存”。Select Execute Code First Migrations (runs on application start), then click Save.

在 Azure 应用中启用 Code First 迁移

发布更改Publish your changes

现已在 Azure 应用中启用了 Code First 迁移,可发布代码更改信息。Now that you enabled Code First Migrations in your Azure app, publish your code changes.

在发布页中单击“发布”。In the publish page, click Publish.

再次尝试添加待办事项并选择“完成”,然后,它们将作为已完成项显示在主页中。Try adding to-do items again and select Done, and they should show up in your homepage as a completed item.

Code First 迁移后的 Azure 应用

所有现有待办事项仍将显示。All your existing to-do items are still displayed. 重新发布 ASP.NET 应用程序时,SQL 数据库中的现有数据不会丢失。When you republish your ASP.NET application, existing data in your SQL Database is not lost. 此外,Code First 迁移仅更改数据架构,而使现有数据保持不变。Also, Code First Migrations only changes the data schema and leaves your existing data intact.

流式传输应用程序日志Stream application logs

可直接通过 Azure 应用将跟踪消息流式传输到 Visual Studio。You can stream tracing messages directly from your Azure app to Visual Studio.

打开 Controllers\TodosController.csOpen Controllers\TodosController.cs.

每项操作都以 Trace.WriteLine() 方法开头。Each action starts with a Trace.WriteLine() method. 添加此代码的目的是演示如何将跟踪消息添加至 Azure 应用。This code is added to show you how to add trace messages to your Azure app.

打开服务器资源管理器Open Server Explorer

在“视图”菜单中,选择“服务器资源管理器”。From the View menu, select Server Explorer. 可在“服务器资源管理器”中为 Azure 应用配置日志记录。You can configure logging for your Azure app in Server Explorer.

启用日志流式传输Enable log streaming

在“服务器资源管理器”中,展开“Azure” > “应用服务”。In Server Explorer, expand Azure > App Service.

展开“myResourceGroup”资源组,该资源组在首次创建 Azure 应用时创建。Expand the myResourceGroup resource group, you created when you first created the Azure app.

右键单击 Azure 应用,并选择“查看流式处理日志”。Right-click your Azure app and select View Streaming Logs.

启用日志流式传输

现在,日志已流式传输到“输出”窗口。The logs are now streamed into the Output window.

输出窗口中的日志流式传输

但还无法查看任何跟踪消息。However, you don't see any of the trace messages yet. 因为当首先选择“查看流式处理日志”时,Azure 应用将跟踪级别设置为 Error,此级别只记录错误事件(使用 Trace.TraceError() 方法)。That's because when you first select View Streaming Logs, your Azure app sets the trace level to Error, which only logs error events (with the Trace.TraceError() method).

更改跟踪级别Change trace levels

若要更改跟踪级别以输出其他跟踪消息,请返回“服务器资源管理器”。To change the trace levels to output other trace messages, go back to Server Explorer.

再次右键单击 Azure 应用并选择“查看设置”。Right-click your Azure app again and select View Settings.

在“应用程序日志记录(文件系统)”下拉列表中,选择“详细”。In the Application Logging (File System) dropdown, select Verbose. 单击“ 保存”。Click Save.

将跟踪级别更改为详细

提示

可试验不同的跟踪级别,以查看每个级别分别显示哪些类型的消息。You can experiment with different trace levels to see what types of messages are displayed for each level. 例如,“信息”级别包括 Trace.TraceInformation()Trace.TraceWarning()Trace.TraceError() 创建的所有日志,但不包括 Trace.WriteLine() 创建的日志。For example, the Information level includes all logs created by Trace.TraceInformation(), Trace.TraceWarning(), and Trace.TraceError(), but not logs created by Trace.WriteLine().

在浏览器中再次导航到应用( http://<应用名称>.azurewebsites.net),然后尝试在 Azure 中的待办事项列表应用程序周围单击。In your browser navigate to your app again at http://<your app name>.azurewebsites.net, then try clicking around the to-do list application in Azure. 现在,跟踪消息已流式传输到 Visual Studio 中的“输出”窗口。The trace messages are now streamed to the Output window in Visual Studio.

Application: 2017-04-06T23:30:41  PID[8132] Verbose     GET /Todos/Index
Application: 2017-04-06T23:30:43  PID[8132] Verbose     GET /Todos/Create
Application: 2017-04-06T23:30:53  PID[8132] Verbose     POST /Todos/Create
Application: 2017-04-06T23:30:54  PID[8132] Verbose     GET /Todos/Index

停止日志流式传输Stop log streaming

若要停止日志流式传输服务,请单击“输出”窗口中的“停止监视”按钮。To stop the log-streaming service, click the Stop monitoring button in the Output window.

停止日志流式传输

管理 Azure 应用Manage your Azure app

转到 Azure 门户查看创建的应用。Go to the Azure portal to see the app you created.

从左侧菜单中单击“应用服务”,然后单击 Azure 应用的名称。From the left menu, click App Service, then click the name of your Azure app.

在门户中导航到 Azure 应用

你已登录到应用页。You have landed in your app's page.

默认情况下,门户将显示“概述”页。By default, the portal shows the Overview page. 在此页中可以查看应用的运行状况。This page gives you a view of how your app is doing. 在此处还可以执行基本的管理任务,例如浏览、停止、启动、重新启动和删除。Here, you can also perform basic management tasks like browse, stop, start, restart, and delete. 该页左侧的选项卡显示可以打开的不同配置页。The tabs on the left side of the page show the different configuration pages you can open.

Azure 门户中的应用服务页

清理资源Clean up resources

在前面的步骤中,在资源组中创建了 Azure 资源。In the preceding steps, you created Azure resources in a resource group. 如果认为将来不需要这些资源,可以通过删除资源组来删除它们。If you don't expect to need these resources in the future, you can delete them by deleting the resource group.

  1. 在 Azure 门户的 Web 应用的“概述” 页中,选择“资源组” 下的 myResourceGroup 链接。From your web app's Overview page in the Azure portal, select the myResourceGroup link under Resource group.
  2. 在资源组页中,确保列出的资源是要删除的资源。On the resource group page, make sure that the listed resources are the ones you want to delete.
  3. 选择“删除” ,在文本框中键入 myResourceGroup,然后选择“删除” 。Select Delete, type myResourceGroup in the text box, and then select Delete.

后续步骤Next steps

本教程介绍了如何:In this tutorial, you learned how to:

  • 在 Azure 中创建 SQL 数据库。Create a SQL Database in Azure
  • 将 ASP.NET 应用连接到 SQL 数据库Connect an ASP.NET app to SQL Database
  • 将应用部署到 AzureDeploy the app to Azure
  • 更新数据模型并重新部署应用Update the data model and redeploy the app
  • 将日志从 Azure 流式传输到终端Stream logs from Azure to your terminal
  • 在 Azure 门户中管理应用Manage the app in the Azure portal

转到下一教程,了解如何轻松地提高 Azure SQL 数据库连接的安全性。Advance to the next tutorial to learn how to easily improve the security of your connection Azure SQL Database.