Create and attach an NSG
- Create the NSG nsg-web
- Attach nsg-web to subnet-web
Security wants a network security group (NSG, a set of allow and deny rules) in front of subnet-web, where vm-web serves HTTPS. Create nsg-web, attach it to subnet-web, and look at the rules it starts with. vm-client in subnet-client, in the same VNet, should still reach vm-web afterward. Find out which rule allows it.
Create the NSG.
az network nsg create -g rg-lab --name nsg-webWhat's this?
Creates a network security group. It filters nothing until you attach it to a subnet or a network interface.
-gthe resource group the resources live in--namethe name of the thing to look at or change
List its rules including the defaults.
az network nsg rule list -g rg-lab --nsg-name nsg-web --include-default -o tableWhat's this?
Lists the rules in a network security group, so you can read them in priority order.
-gthe resource group the resources live in--nsg-namethe network security group the rule is in
--include-defaultalso show the built-in default rules
Attach it to subnet-web.
az network vnet subnet update -g rg-lab --vnet-name vnet-app --name subnet-web --network-security-group nsg-webWhat's this?
Changes a subnet's settings, such as which NSG or route table is attached to it.
-gthe resource group the resources live in--vnet-namethe virtual network--namethe name of the thing to look at or change
Answer question 1 from the table in step 2. For question 2, find the default rule that matches traffic from inside the VNet.
Sources on Microsoft Learn (3)
?
- Resource group, the outer dashed frame
- Virtual network, with its address space top right
- Subnet, with range and usable IPs (5 reserved)
- Network security group. A small shield on a VM's NIC means the NIC has one too
- Route table on the subnet
- VM Appliance Private endpoint
- Peering Connected Initiated or access off
- Goal working Goal broken, X marks where it stops
- Private DNS zone, dotted lines go to linked VNets
- Orange pulse: what your last command changed. Drag to pan, Ctrl and scroll to zoom.
vm-client → vm-web:443should work: working