Rediģēt

Kopīgot, izmantojot


Configure an existing virtual network for Azure SQL Managed Instance

Applies to: Azure SQL Managed Instance

Azure SQL Managed Instance must be deployed within an Azure virtual network and the subnet dedicated for managed instances only. You can use the existing virtual network and subnet if they're configured according to the SQL Managed Instance virtual network requirements.

If one of the following cases applies to you, you can validate and modify your network by using the script explained in this article:

  • You have a new subnet that's still not configured.
  • You're not sure that the subnet is aligned with the requirements.
  • You want to check that the subnet still complies with the network requirements after you made changes.

Note

You can create a managed instance only in virtual networks created through the Azure Resource Manager deployment model. Azure virtual networks created through the classic deployment model are not supported. Calculate subnet size by following the guidelines in the Determine the size of subnet for SQL Managed Instance article. You can't resize the subnet after you deploy the resources inside.

After the managed instance is created, you can move the instance to another subnet inside the same Vnet or across vNets, but moving the instance or VNet to another resource group or subscription is not supported.

Validate and modify an existing virtual network

If you want to create a managed instance inside an existing subnet, we recommend the following PowerShell script to prepare the subnet:

$scriptUrlBase = 'https://raw.githubusercontent.com/Microsoft/sql-server-samples/master/samples/manage/azure-sql-db-managed-instance/delegate-subnet'

$parameters = @{
    subscriptionId = '<subscriptionId>'
    resourceGroupName = '<resourceGroupName>'
    virtualNetworkName = '<virtualNetworkName>'
    subnetName = '<subnetName>'
    }

Invoke-Command -ScriptBlock ([Scriptblock]::Create((iwr ($scriptUrlBase+'/delegateSubnet.ps1?t='+ [DateTime]::Now.Ticks)).Content)) -ArgumentList $parameters

The script prepares the subnet in three steps:

  1. Validate: It validates the selected virtual network and subnet for SQL Managed Instance networking requirements.
  2. Confirm: It shows the user a set of changes that need to be made to prepare the subnet for SQL Managed Instance deployment. It also asks for consent.
  3. Prepare: It properly configures the virtual network and subnet.

Next steps