快速入门:创建 Azure SQL 托管实例Quickstart: Create an Azure SQL Managed Instance

适用于: Azure SQL 托管实例

本快速入门介绍了如何在 Azure 门户中创建 Azure SQL 托管实例This quickstart teaches you to create an Azure SQL Managed Instance in the Azure portal.


有关限制,请参阅支持的区域For limitations, see Supported regions.

创建 Azure SQL 托管实例Create an Azure SQL Managed Instance

若要创建 SQL 托管实例,请执行以下步骤:To create a SQL Managed Instance, follow these steps:

  1. 在 Azure 门户的左上角,选择“创建资源”。Select Create a resource in the upper-left corner of the Azure portal.

  2. 找到“托管实例”,然后选择“Azure SQL 托管实例” 。Locate managed instance, and then select Azure SQL Managed Instance.

  3. 选择“创建” 。Select Create.

  4. 使用“创建 Azure SQL 托管实例”预配窗体上的选项卡添加必需信息和可选信息。Use the tabs on the Create Azure SQL Managed Instance provisioning form to add required and optional information. 以下部分介绍这些选项卡。The following sections describe these tabs.

“基本信息”选项卡Basics tab

  • 填写“基本信息”选项卡中的必需信息。这是预配 SQL 托管实例所需的最少量信息。Fill out mandatory information required on the Basics tab. This is a minimum set of information required to provision a SQL Managed Instance.

    用于创建 SQL 托管实例的“基本信息”选项卡

    参考下表来填写此选项卡中的所需信息。Use the table below as a reference for information required at this tab.

    设置Setting 建议的值Suggested value 说明Description
    订阅Subscription 你的订阅。Your subscription. 你有权在其中创建新资源的订阅。A subscription that gives you permission to create new resources.
    资源组Resource group 新的或现有的资源组。A new or existing resource group. 如需有效的资源组名称,请参阅 Naming rules and restrictions(命名规则和限制)。For valid resource group names, see Naming rules and restrictions.
    托管实例名称Managed instance name 任何有效的名称。Any valid name. 请参阅命名规则和限制,了解什么是有效的名称。For valid names, see Naming rules and restrictions.
    区域Region 要在其中创建托管实例的区域。The region in which you want to create the managed instance. 有关区域的信息,请参阅 Azure 区域For information about regions, see Azure regions.
    托管实例管理员登录名Managed instance admin login 任何有效的用户名。Any valid username. 请参阅命名规则和限制,了解什么是有效的名称。For valid names, see Naming rules and restrictions. 不要使用“serveradmin”,因为这是保留的服务器级角色。Don't use "serveradmin" because that's a reserved server-level role.
    密码Password 任何有效的密码。Any valid password. 密码必须至少 16 个字符,且符合定义的复杂性要求The password must be at least 16 characters long and meet the defined complexity requirements.
  • 选择“配置托管实例”,以设置计算和存储资源的大小并查看定价层。Select Configure Managed Instance to size compute and storage resources and to review the pricing tiers. 使用滑块或文本框指定存储量和虚拟核心数。Use the sliders or text boxes to specify the amount of storage and the number of virtual cores. 完成后,选择“应用”以保存所做的选择。When you're finished, select Apply to save your selection.


设置Setting 建议的值Suggested value 说明Description
服务层级Service Tier 选择一个选项。Select one of the options. 根据具体的方案选择以下选项之一:Based on your scenario, select one of the following options:
  • 常规用途:适用于大多数生产工作负载,这是默认选项。General Purpose: for most production workloads, and the default option.
  • 业务关键:专用于低延迟工作负载,具有快速故障转移和针对失败的高复原能力。Business Critical: designed for low-latency workloads with high resiliency to failures and fast failovers.

有关详细信息,请查看 Azure SQL 数据库和 Azure SQL 托管实例服务层级,并查看 Azure SQL 托管实例资源限制概述For more information, see Azure SQL Database and Azure SQL Managed Instance service tiers and review Overview of Azure SQL Managed Instance resource limits.
硬件代系Hardware Generation 选择一个选项。Select one of the options. 硬件代系通常定义计算和内存限制,以及影响工作负荷性能的其他特征。The hardware generation generally defines the compute and memory limits and other characteristics that impact the performance of the workload. 默认值为 Gen5。Gen5 is the default.
vCore 计算模型vCore compute model 选择一个选项。Select an option. vCore 数量是指始终为工作负载预配的确切计算资源量。vCores represent exact amount of compute resources that are always provisioned for your workload. 默认值为 8 个 vCore。Eight vCores is the default.
存储空间(以 GB 为单位)Storage in GB 选择一个选项。Select an option. 存储大小(以 GB 为单位),请根据预期的数据大小进行选择。Storage size in GB, select based on expected data size. 若要从本地或在各种云平台上迁移现有数据,请参阅迁移概述:将 SQL Server 迁移到 SQL 托管实例If migrating existing data from on-premises or on various cloud platforms, see Migration overview: SQL Server to SQL Managed Instance.
Azure 混合权益Azure Hybrid Benefit 查看选项(若适用)。Check option if applicable. 旨在使用现有的 Azure 许可证。For leveraging an existing license for Azure. 有关详细信息,请参阅 Azure 混合权益 - Azure SQL 数据库和 SQL 托管实例For more information, see Azure Hybrid Benefit - Azure SQL Database & SQL Managed Instance.
  • 若要在创建 SQL 托管实例之前查看所做的选择,可选择“查看 + 创建”。To review your choices before you create a SQL Managed Instance, you can select Review + create. 也可配置网络选项,方法是选择“下一步:网络”。Or, configure networking options by selecting Next: Networking.

“网络”选项卡Networking tab

  • 填写“网络”选项卡中的可选信息。如果省略此信息,门户会应用默认设置。Fill out optional information on the Networking tab. If you omit this information, the portal will apply default settings.


    参考下表来填写此选项卡中的所需信息。Use the table below as a reference for information required at this tab.

    设置Setting 建议的值Suggested value 说明Description
    虚拟网络Virtual network 选择“创建新的虚拟网络”或有效的虚拟网络和子网。Select either Create new virtual network or a valid virtual network and subnet. 如果网络或子网不可用,则必须先对其进行修改以满足网络要求,然后再选择它作为新托管实例的目标。If a network or subnet is unavailable, it must be modified to satisfy the network requirements before you select it as a target for the new managed instance. 有关为 SQL 托管实例配置网络环境所要满足的要求的信息,请参阅为 SQL 托管实例配置虚拟网络For information about the requirements for configuring the network environment for SQL Managed Instance, see Configure a virtual network for SQL Managed Instance.
    连接类型Connection type 选择“代理”或“重定向”连接类型。Choose between a proxy and a redirect connection type. 有关连接类型的详细信息,请参阅 Azure SQL 托管实例连接类型For more information about connection types, see Azure SQL Managed Instance connection type.
    公共终结点Public endpoint 选择“禁用”。Select Disable. 若要通过公共数据终结点访问托管实例,需启用此选项。For a managed instance to be accessible through the public data endpoint, you need to enable this option.
    允许的访问来源(如果启用了“公共终结点”)Allow access from (if Public endpoint is enabled) 选择“无访问权限”Select No Access 在门户体验中可以使用公共终结点配置安全组。The portal experience enables configuring a security group with a public endpoint.

    根据具体的方案选择以下选项之一:Based on your scenario, select one of the following options:
    • Azure 服务:从 Power BI 或另一多租户服务进行连接时,建议使用此选项。Azure services: We recommend this option when you're connecting from Power BI or another multitenant service.
    • Internet:用于测试,可让你快速运转托管实例。Internet: Use for test purposes when you want to quickly spin up a managed instance. 建议不要将它用于生产环境。We don't recommend it for production environments.
    • 不允许访问:此选项创建一个“拒绝”安全规则。No access: This option creates a Deny security rule. 修改此规则才能通过公共终结点访问托管实例。Modify this rule to make a managed instance accessible through a public endpoint.

    有关公共终结点安全性的详细信息,请参阅通过公共终结点安全使用 Azure SQL 托管实例For more information on public endpoint security, see Using Azure SQL Managed Instance securely with a public endpoint.
  • 选择“查看 + 创建”,在创建托管实例之前查看所做的选择。Select Review + create to review your choices before you create a managed instance. 也可配置更多自定义设置,方法是选择“下一步:其他设置”。Or, configure more custom settings by selecting Next: Additional settings.

其他设置Additional settings

  • 填写“附加设置”选项卡中的可选信息。如果省略此信息,门户会应用默认设置。Fill out optional information on the Additional settings tab. If you omit this information, the portal will apply default settings.


    参考下表来填写此选项卡中的所需信息。Use the table below as a reference for information required at this tab.

    设置Setting 建议的值Suggested value 说明Description
    排序规则Collation 选择需要用于托管实例的排序规则。Choose the collation that you want to use for your managed instance. 如果从 SQL Server 迁移数据库,请使用 SELECT SERVERPROPERTY(N'Collation') 检查源排序规则并使用该值。If you migrate databases from SQL Server, check the source collation by using SELECT SERVERPROPERTY(N'Collation') and use that value. 有关排序规则的信息,请参阅设置或更改服务器排序规则For information about collations, see Set or change the server collation.
    时区Time zone 选择要求托管实例遵循的时区。Select the time zone that managed instance will observe. 有关详细信息,请参阅时区For more information, see Time zones.
    用作故障转移辅助托管实例Use as failover secondary 请选择“是”。Select Yes. 启用此选项即可将托管实例用作故障转移组辅助托管实例。Enable this option to use the managed instance as a failover group secondary.
    主 SQL 托管实例(如果“用作故障转移辅助托管实例”设置为“是”) Primary SQL Managed Instance (if Use as failover secondary is set to Yes) 选择一个现有的主托管实例,该实例会加入你要创建的托管实例所在的 DNS 区域。Choose an existing primary managed instance that will be joined in the same DNS zone with the managed instance you're creating. 此步骤会启用对故障转移组进行创建后配置的功能。This step will enable post-creation configuration of the failover group. 有关详细信息,请参阅教程:将托管实例添加到故障转移组For more information, see Tutorial: Add a managed instance to a failover group.
  • 选择“查看 + 创建”,在创建托管实例之前查看所做的选择。Select Review + create to review your choices before you create a managed instance. 或者,选择“下一步:标记”来配置 Azure 标记(推荐)。Or, configure Azure Tags by selecting Next: Tags (recommended).


  • 将标记添加到 Azure 资源管理器模板(ARM 模板)中的资源。Add tags to resources in your Azure Resource Manager template (ARM template). 可以通过标记对资源进行逻辑组织。Tags help you logically organize your resources. 标记值显示在成本报表中,可通过它们按标记执行其他管理活动。The tag values show up in cost reports and allow for other management activities by tag.

  • 请考虑至少使用“所有者”标记来标记新的 SQL 托管实例以确定创建者,并使用“环境”标记进行标记来确定此系统是生产环境还是开发环境等。有关详细信息,请参阅为 Azure 资源开发命名和标记策略Consider at least tagging your new SQL Managed Instance with the Owner tag to identify who created, and the Environment tag to identify whether this system is Production, Development, etc. For more information, see Develop your naming and tagging strategy for Azure resources.

  • 选择“查看 + 创建”以继续。Select Review + create to proceed.

查看 + 创建Review + create

  1. 选择“查看 + 创建”选项卡,在创建托管实例之前查看所做的选择。Select Review + create tab to review your choices before you create a managed instance.


  2. 选择“创建”,开始预配托管实例。Select Create to start provisioning the managed instance.


部署托管实例是一项运行时间很长的操作。Deploying a managed instance is a long-running operation. 通常情况下,子网中第一个实例的部署时间比子网中已经有托管实例时实例的部署时间要长得多。Deployment of the first instance in the subnet typically takes much longer than deploying into a subnet with existing managed instances. 有关平均预配时间,请参阅 Azure SQL 托管实例管理操作概述For average provisioning times, see Overview of Azure SQL Managed Instance management operations.

监视部署进度Monitor deployment progress

  1. 选择“通知”图标以查看部署状态。Select the Notifications icon to view the status of the deployment.

    SQL 托管实例的部署进度

  2. 在通知中选择“正在进行的部署”以打开 SQL 托管实例窗口,进一步监视部署进度。Select Deployment in progress in the notification to open the SQL Managed Instance window and further monitor the deployment progress.


  • 如果已关闭 Web 浏览器或已退出部署进度屏幕,可通过托管实例的概述页面、PowerShell 或 Azure CLI 来监视预配操作。If you closed your web browser or moved away from the deployment progress screen, you can monitor the provisioning operation via the managed instance's Overview page, or via PowerShell or the Azure CLI. 有关详细信息,请参阅监视操作For more information, see Monitor operations.
  • 可通过 Azure 门户、PowerShell、Azure CLI 或使用 REST API 的其他工具来取消预配过程。You can cancel the provisioning process through Azure portal, or via PowerShell or the Azure CLI or other tooling using the REST API. 请参阅取消 Azure SQL 托管实例管理操作See Canceling Azure SQL Managed Instance management operations.


  • 当存在其他冲突操作(例如,在同一子网中的其他托管实例上长时间运行的还原或缩放操作)时,SQL 托管实例创建的开始可能会延迟。Start of SQL Managed Instance creation could be delayed in cases when there exist other impacting operations, such are long-running restore or scaling operations on other Managed Instances in the same subnet. 若要了解详细信息,请参阅管理操作交叉影响To learn more, see Management operations cross-impact.
  • 若要获取托管实例创建状态,需要有资源组的 读取权限In order to be able to get the status of managed instance creation, you need to have read permissions over the resource group. 如果没有此权限,或者在托管实例创建过程中将其撤消,则可能会导致 SQL 托管实例在资源组部署列表中不可见。If you don't have this permission or revoke it while the managed instance is in creation process, this can cause SQL Managed Instance not to be visible in the list of resource group deployments.

查看创建的资源View resources created

成功部署托管实例后,若要查看创建的资源,请执行以下操作:Upon successful deployment of a managed instance, to view resources created:

  1. 打开托管实例的资源组。Open the resource group for your managed instance.

    SQL 托管实例资源

查看和微调网络设置View and fine-tune network settings

若要选择性地微调网络设置,请检查以下各项:To optionally fine-tune networking settings, inspect the following:

  1. 在资源列表中,选择路由表以查看创建的用户定义的路由表 (UDR) 对象。In the list of resources, select the route table to review the user-defined Route table (UDR) object that was created.

  2. 在路由表中,查看用于通过 SQL 托管实例的虚拟网络路由流量的条目。In the route table, review the entries to route traffic from and within the SQL Managed Instance virtual network. 若要手动创建或配置路由表,请在 SQL 托管实例路由表中创建这些条目。If you create or configure your route table manually, create these entries in the SQL Managed Instance route table.

    本地 SQL 托管实例子网的条目

    若要更改或添加路由,请在路由表设置中打开“路由”。To change or add routes, open the Routes in the Route table settings.

  3. 返回资源组并选择创建的网络安全组 (NSG) 对象。Return to the resource group, and select the network security group (NSG) object that was created.

  4. 查看入站和出站安全规则。Review the inbound and outbound security rules.


    若要更改或添加规则,请在网络安全组设置中打开“入站安全规则”和“出站安全规则” 。To change or add rules, open the Inbound Security Rules and Outbound security rules in the Network security group settings.


如果为 SQL 托管实例配置了公共终结点,则需要打开端口以允许网络流量从公共 Internet 连接到 SQL 托管实例.If you have configured a public endpoint for SQL Managed Instance, you need to open ports to allow network traffic allowing connections to SQL Managed Instance from the public internet. 有关详细信息,请参阅为 SQL 托管实例配置公共终结点For more information, see Configure a public endpoint for SQL Managed Instance.

检索 SQL 托管实例的连接详细信息Retrieve connection details to SQL Managed Instance

若要连接到 SQL 托管实例,请遵循以下步骤检索主机名和完全限定的域名 (FQDN):To connect to SQL Managed Instance, follow these steps to retrieve the host name and fully qualified domain name (FQDN):

  1. 返回资源组并选择创建的 SQL 托管实例对象。Return to the resource group and select the SQL managed instance object that was created.

  2. 在“概述”选项卡上,找到“主机”属性。 On the Overview tab, locate the Host property. 通过单击“复制到剪贴板”按钮,将托管实例的主机名复制到剪贴板,以便在下一篇快速入门中使用。Copy the host name to your clipboard for the managed instance for use in the next quickstart by clicking the Copy to clipboard button.


    复制的值表示可用于连接到 SQL 托管实例的完全限定域名 (FQDN)。The value copied represents a fully qualified domain name (FQDN) that can be used to connect to SQL Managed Instance. FQDN 类似于以下地址示例:your_host_name.a1b2c3d4e5f6.database.chinacloudapi.cn。It is similar to the following address example: your_host_name.a1b2c3d4e5f6.database.chinacloudapi.cn.

后续步骤Next steps

了解如何连接到 SQL 托管实例:To learn about how to connect to SQL Managed Instance:

将现有 SQL Server 数据库从本地还原到 SQL 托管实例:To restore an existing SQL Server database from on-premises to SQL Managed Instance: