The NSG and rules must be assigned to a resource to make any impact. First, we are going to show you how to associate an NSG with a subnet.
Assigning an NSG to a subnet
Getting ready
Before you start, open your browser and go to the Azure portal: https://portal.azure.com. Locate the previously created NSG.
How to do it...
To assign an NSG to a subnet, we must follow these steps:
- In the NSG blade, locate the Subnets option under Settings
- Click on the Associate button at the top of the page and wait for the new blade to open:

- In the new blade, first select Virtual network...