Skip to content

Commit 30e57d4

Browse files
Update sql-database-managed-instance-vnet-configuration.md
1 parent c1b65d9 commit 30e57d4

File tree

1 file changed

+27
-61
lines changed

1 file changed

+27
-61
lines changed

articles/sql-database/sql-database-managed-instance-vnet-configuration.md

Lines changed: 27 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ With introduction of _Network Intent Policy_ we allow you to add Network securit
4949
You could now use NSG to narrow down the IP ranges from which applications and users could query and manage the data by filtering network traffic that goes to port 1433.
5050

5151
> [!IMPORTANT]
52-
> When configuring NSG rules that will restrain access to port 1433 you will also need to have the inbound rules in the table below included before any _Deny_ rules. Otherwise Network Intent Policy will block the change as non compliant.
52+
> When you are configuring the NSG rules that will restrain access to port 1433 you will also need to insert the highest priority inbound rules displayed in the table below. Otherwise Network Intent Policy will block the change as non compliant.
5353
5454
| NAME |PORT |PROTOCOL|SOURCE |DESTINATION|ACTION|
5555
|------------|----------------------------|--------|-----------------|-----------|------|
@@ -61,10 +61,13 @@ We also improved routing experiance so in addition to 0.0.0.0/0 next hop type In
6161

6262
## Determine the size of subnet for Managed Instances
6363

64-
When you create a Managed Instance, Azure allocates a number of virtual machines depending on the tier size you select during provisioning. Because these virtual machines are associated with your subnet, they require IP addresses. To ensure high availability during regular operations and service maintenance, Azure may allocate additional virtual machines. As a result, the number of required IP addresses in a subnet is larger than the number of Managed Instances in that subnet.
64+
When you create a Managed Instance, Azure allocates a number of virtual machines depending on the tier you selected during the provisioning. Because these virtual machines are associated with your subnet, they require IP addresses. To ensure high availability during regular operations and service maintenance, Azure may allocate additional virtual machines. As a result, the number of required IP addresses in a subnet is larger than the number of Managed Instances in that subnet.
6565

6666
By design, a Managed Instance needs a minimum of 16 IP addresses in a subnet and may use up to 256 IP addresses. As a result, you can use subnet masks /28 to /24 when defining your subnet IP ranges.
6767

68+
> [!IMPORTANT]
69+
> Subnet size with 16 IP addresses is the bare minimum with limited potential for the further Managed Instance scale out. Choosing subnet with the prefix /27 or below is highly recommended. 
70+
6871
If you plan to deploy multiple Managed Instances inside the subnet and need to optimize on subnet size, use these parameters to form a calculation:
6972

7073
- Azure uses five IP addresses in the subnet for its own needs
@@ -73,6 +76,9 @@ If you plan to deploy multiple Managed Instances inside the subnet and need to o
7376

7477
**Example**: You plan to have three General Purpose and two Business Critical Managed Instances. That means you need 5 + 3 * 2 + 2 * 4 = 19 IP addresses. As IP ranges are defined in power of 2, you need the IP range of 32 (2^5) IP addresses. Therefore, you need to reserve the subnet with subnet mask of /27.
7578

79+
> [!IMPORTANT]
80+
> Calculation displayed above will become obsolete with further improvements and for ease of use replaced with the online Managed Instance subnet size estimator. 
81+
7682
## Create a new virtual network for Managed Instance using Azure Resource Manager deployment
7783

7884
The easiest way to create and configure virtual network is to use Azure Resource Manager deployment template.
@@ -94,59 +100,6 @@ The easiest way to create and configure virtual network is to use Azure Resource
94100

95101
You might change the names of VNet and subnets and adjust IP ranges associated to your networking resources. Once you press "Purchase" button, this form will create and configure your environment. If you don't need two subnets you can delete the default one.
96102

97-
## Create a new virtual network for Managed Instances using portal
98-
99-
Creating an Azure virtual network is a prerequisite for creating a Managed Instance. You can use the Azure portal, [PowerShell](../virtual-network/quick-create-powershell.md), or [Azure CLI](../virtual-network/quick-create-cli.md). The following section shows the steps using the Azure portal. The details discussed here apply to each of these methods.
100-
101-
1. Click **Create a resource** in the upper left-hand corner of the Azure portal.
102-
2. Locate and then click **Virtual Network**, verify the **Resource Manager** is selected as the deployment mode, and then click **Create**.
103-
104-
![virtual network create](./media/sql-database-managed-instance-tutorial/virtual-network-create.png)
105-
106-
3. Fill out the virtual network form with the requested information, in a manner like the following screenshot:
107-
108-
![virtual network create form](./media/sql-database-managed-instance-tutorial/virtual-network-create-form.png)
109-
110-
4. Click **Create**.
111-
112-
The address space and subnet are specified in CIDR notation.
113-
114-
> [!IMPORTANT]
115-
> The default values create subnet that takes all the VNet address space. If you choose this option, you can not create any other resources inside the virtual network other than Managed Instance.
116-
117-
The recommended approach would be the following:
118-
- Calculate subnet size by following [Determine the size of subnet for Managed Instance](#determine-the-size-of-subnet-for-managed-instances) section
119-
- Assess the needs for the rest of VNet
120-
- Fill in VNet and subnet address ranges accordingly
121-
122-
Make sure that Service endpoints option stays **Disabled**.
123-
124-
![virtual network create form](./media/sql-database-managed-instance-tutorial/service-endpoint-disabled.png)
125-
126-
### Create the required route table and associate it
127-
128-
1. Sign in to the Azure portal
129-
2. Locate and then click **Route table**, and then click **Create** on the Route table page.
130-
131-
![route table create form](./media/sql-database-managed-instance-tutorial/route-table-create-form.png)
132-
133-
3. Create a 0.0.0.0/0 Next Hop Internet route, in a manner like the following screenshots:
134-
135-
![route table add](./media/sql-database-managed-instance-tutorial/route-table-add.png)
136-
137-
![route](./media/sql-database-managed-instance-tutorial/route.png)
138-
139-
4. Associate this route with the subnet for the Managed Instance, in a manner like the following screenshots:
140-
141-
![subnet](./media/sql-database-managed-instance-tutorial/subnet.png)
142-
143-
![set route table](./media/sql-database-managed-instance-tutorial/set-route-table.png)
144-
145-
![set route table-save](./media/sql-database-managed-instance-tutorial/set-route-table-save.png)
146-
147-
148-
Once your VNet has been created, you are ready to create your Managed Instance.
149-
150103
## Modify an existing virtual network for Managed Instances
151104

152105
The questions and answers in this section show you how to add a Managed Instance to existing virtual network.
@@ -160,14 +113,27 @@ You can only create a Managed Instance in Resource Manager virtual networks.
160113
If you would like to create new one:
161114

162115
- Calculate subnet size by following the guidelines in the [Determine the size of subnet for Managed Instances](#determine-the-size-of-subnet-for-managed-instances) section.
163-
- Follow steps in [Add, change, or delete a virtual network subnet](../virtual-network/virtual-network-manage-subnet.md).
116+
- Follow the steps in [Add, change, or delete a virtual network subnet](../virtual-network/virtual-network-manage-subnet.md).
164117
- Create a route table that contains single entry, **0.0.0.0/0**, as the next hop Internet and associate it with the subnet for the Managed Instance.
165118

166-
In case you would like to create a Managed Instance inside an existing subnet:
167-
- Check if the subnet is empty - a Managed Instance cannot be created in a subnet that contains other resources including the Gateway subnet
168-
- Calculate subnet size by following the guidelines in the [Determine the size of subnet for Managed Instances](#determine-the-size-of-subnet-for-managed-instances) section and verify that it is sized appropriately.
169-
- Check that service endpoints are not enabled on the subnet.
170-
- Make sure that there are no network security groups associated with the subnet
119+
In case you would like to create a Managed Instance inside an existing subnet we recommend you to use the PowerShell script below to prepare the subnet.
120+
```powershell
121+
$scriptUrlBase = 'https://raw.githubusercontent.com/Microsoft/sql-server-samples/master/samples/manage/azure-sql-db-managed-instance/prepare-subnet'
122+
123+
$parameters = @{
124+
subscriptionId = '<subscriptionId>'
125+
resourceGroupName = '<resourceGroupName>'
126+
virtualNetworkName = '<virtualNetworkName>'
127+
subnetName = '<subnetName>'
128+
}
129+
130+
Invoke-Command -ScriptBlock ([Scriptblock]::Create((iwr ($scriptUrlBase+'/prepareSubnet.ps1?t='+ [DateTime]::Now.Ticks)).Content)) -ArgumentList $parameters
131+
```
132+
Subnet preparation is done in three simple steps:
133+
134+
- Validate - Selected virtual netwok and subnet are validated for Managed Instance networking requirements
135+
- Confirm - User is shown a set of changes that need to be made to prepare subnet for Managed Instance deployment and asked for consent
136+
- Prepare - Virtual network and subnet are configured properly
171137

172138
**Do you have custom DNS server configured?**
173139

0 commit comments

Comments
 (0)