Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Subnet delegation gives explicit permissions to the service to create service-specific resources in the subnet using a unique identifier when deploying the service. This article describes how to add or remove a delegated subnet for an Azure service.
Prerequisites
An Azure account with an active subscription. Create an account for free.
If you didn't create the subnet you would like to delegate to an Azure service, you need the following permission:
Microsoft.Network/virtualNetworks/subnets/write
. The built-in Network Contributor role also contains the necessary permissions.
Create the virtual network
In this section, you create a virtual network and the subnet that you delegate to an Azure service.
The following procedure creates a virtual network with a resource subnet.
In the portal, search for and select Virtual networks.
On the Virtual networks page, select + Create.
On the Basics tab of Create virtual network, enter or select the following information:
Setting Value Project details Subscription Select your subscription. Resource group Select Create new.
Enter test-rg in Name.
Select OK.Instance details Name Enter vnet-1. Region Select East US 2. Select Next to proceed to the Security tab.
Select Next to proceed to the IP Addresses tab.
In the address space box in Subnets, select the default subnet.
In Edit subnet, enter or select the following information:
Setting Value Subnet purpose Leave the default Default. Name Enter subnet-1. Leave the rest of the settings as their defaults. Select Save.
Select Save.
Select Review + create at the bottom of the screen, and when validation passes, select Create.
Delegate a subnet to an Azure service
In this section, you delegate the subnet that you created in the preceding section to an Azure service.
Sign-in to the Azure portal.
In the search box at the top of the portal, enter Virtual network. Select Virtual networks in the search results.
Select vnet-1.
Select Subnets in Settings.
Select subnet-1.
Enter or select the following information:
Setting Value SUBNET DELEGATION Delegate subnet to a service Select the service that you want to delegate the subnet to. For example, Microsoft.Sql/managedInstances. Select Save.
Remove subnet delegation from an Azure service
In this section, you remove a subnet delegation for an Azure service.
Sign-in to the Azure portal.
In the search box at the top of the portal, enter Virtual network. Select Virtual networks in the search results.
Select vnet-1.
Select Subnets in Settings.
Select subnet-1.
Enter or select the following information:
Setting Value SUBNET DELEGATION Delegate subnet to a service Select None. Select Save.
When you finish using the resources that you created, you can delete the resource group and all its resources.
In the Azure portal, search for and select Resource groups.
On the Resource groups page, select the test-rg resource group.
On the test-rg page, select Delete resource group.
Enter test-rg in Enter resource group name to confirm deletion, and then select Delete.
Next steps
- Learn how to manage subnets in Azure.