Beginner · Security · 8 of 15

Allow HTTPS with a service tag

Your tasks
  • Let vm-client reach vm-web on 443
  • Let vm-partner reach vm-web on 443

nsg-web on subnet-web blocks everything inbound to vm-web (10.1.1.4). HTTPS (443) on vm-web should be open to vm-client in vnet-app and to vm-partner in vnet-partner, with one rule. vnet-partner is already peered to vnet-app, which means the two VNets are joined so their VMs can talk. You'll build a peering yourself later. SSH (22) stays closed.

You'll learn
Service tags
  1. See the rule that blocks everything.

    az network nsg rule list -g rg-lab --nsg-name nsg-web -o table
    What's this?

    Lists the rules in a network security group, so you can read them in priority order.

    • -g the resource group the resources live in
    • --nsg-name the network security group the rule is in
  2. Allow HTTPS from the VirtualNetwork tag, at a priority that runs before the deny.

    az network nsg rule create -g rg-lab --nsg-name nsg-web --name Allow-HTTPS-VNet --priority 300 --direction Inbound --access Allow --protocol Tcp --source-address-prefixes VirtualNetwork --destination-port-ranges 443
    What's this?

    Adds or changes one rule in a network security group (NSG). Rules are checked from the lowest priority number up, and the first match decides.

    • -g the resource group the resources live in
    • --nsg-name the network security group the rule is in
    • --name the name of the thing to look at or change
    • --priority where the rule sits in the order. Lower numbers are checked first
    • --direction Inbound for traffic coming in to the VM, Outbound for traffic leaving it
    • --access Allow or Deny
    • --protocol TCP or UDP
    • --source-address-prefixes which source addresses the rule matches
    • --destination-port-ranges which ports the rule matches
    • --source-address-prefixes VirtualNetwork the service tag, instead of a list of ranges
    • --priority 300 lower than the deny's 4000, so it's processed first
  3. Answer the question below.

    Service tag
    A name for a group of IP addresses that Azure keeps up to date, used in rules instead of typing ranges, like VirtualNetwork or Internet.
    Peering
    A direct link between two virtual networks so their VMs can talk to each other.
Sources on Microsoft Learn (2)
0/1 changes
Network map
?
  • 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
  • NICVM 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.
Resource grouprg-labvnet-app: tap to inspectVirtual networkvnet-app10.1.0.0/16subnet-web: tap to inspectsubnet-web10.1.1.0/24 · 251 usablensg-webvm-web 10.1.1.4: tap to inspectNICvm-web10.1.1.4subnet-client: tap to inspectsubnet-client10.1.2.0/24 · 251 usablevm-client 10.1.2.4: tap to inspectNICvm-client10.1.2.4vnet-partner: tap to inspectVirtual networkvnet-partner10.5.0.0/16subnet-app: tap to inspectsubnet-app10.5.1.0/24 · 251 usablevm-partner 10.5.1.4: tap to inspectNICvm-partner10.5.1.4Connected: tap to inspectpeered:443 ✗
  • vm-partner → vm-web:443should work: blocked by a network security group
  • vm-partner → vm-web:22should stay blocked: blocked, as it should be
Goals 0/4
Cloud Shell · bashVMsrg-lab · eastus2
cloudshell:~$