Assigning an NSG to a subnet
The NSG and its rules must be assigned to a resource to have any impact. Here, you are going to see how to associate an NSG with a subnet.
Getting ready
Before you start, open your browser and go to the Azure portal at https://portal.azure.com. Locate the previously created NSG.
How to do it...
To assign an NSG to a subnet, follow these steps:
- In the NSG pane, locate the Subnets option under Settings.
- Click on the Associate button at the top of the page and wait for the new pane to open:
Figure 3.6: Assigning an NSG to a subnet
- In the new pane, first select the virtual network that contains the subnet you want to associate the NSG with, and then select the subnet, as seen in Figure 3.7:
Figure 3.7: Associating the subset with the NSG
- After submitting the change, the subnet will appear in a list of associated subnets:
Figure 3.8: A list of associated subnets
How it works...
When an NSG is associated with a...