Home › Studies › AZ-700 › CLI & PowerShell Commands

CLI & PowerShell Commands

AZ-700 tasks with the Azure CLI and PowerShell side by side for each domain, copied from the topic pages.

Every command here comes from a CLI or PowerShell table on one of the AZ-700 topic pages. A - means the topic page gives no command for that tool. Placeholders such as <rg> are yours to fill in.

Design and implement core networking infrastructure (25–30%)

IP Addressing

TaskAzure CLIPowerShell
Create a virtual networkaz network vnet create --resource-group myResourceGroup --name myVNetNew-AzVirtualNetwork @net
Change the address spaceaz network vnet update --resource-group myResourceGroup --name myVNet --address-prefixes 10.1.0.0/16Set-AzVirtualNetwork
Add a subnetaz network vnet subnet create --name <subnetName> --resource-group <resourceGroupName> --vnet-name <virtualNetworkName>Add-AzVirtualNetworkSubnetConfig
Delegate a subnet to a serviceaz network vnet subnet update --resource-group test-rg --name subnet-1 --vnet-name vnet-1 --delegations Microsoft.Sql/managedInstancesAdd-AzDelegation
Check a subnet delegationaz network vnet subnet show --resource-group test-rg --name subnet-1 --vnet-name vnet-1 --query delegationsGet-AzDelegation
Create a zone-redundant Standard public IPaz network public-ip create --resource-group QuickStartCreateIP-rg --name myStandardPublicIP --version IPv4 --sku Standard --zone 1 2 3New-AzPublicIpAddress
Public IP with Internet routing preferenceaz network public-ip create --resource-group QuickStartCreateIP-rg --name myStandardPublicIP-RP --version IPv4 --ip-tags 'RoutingPreference=Internet' --sku Standard --zone 1 2 3-
Global tier public IPaz network public-ip create --resource-group QuickStartCreateIP-rg --name myStandardPublicIP-Global --version IPv4 --tier global --sku Standard-
Create a public IP prefixaz network public-ip prefix create --length 28 --name myPublicIpPrefix --resource-group QuickStartCreateIPPrefix-rg --sku standard --location westus2 --version IPv4 --zone 1 2 3New-AzPublicIpPrefix
Create a static public IP from a prefixaz network public-ip create --name myPublicIP --resource-group QuickStartCreateIPPrefix-rg --allocation-method Static --public-ip-prefix myPublicIpPrefix --sku Standard --version IPv4-
Delete a public IP prefixaz network public-ip prefix delete --name myPublicIpPrefix --resource-group QuickStartCreateIPPrefix-rgRemove-AzPublicIpPrefix
Provision a custom IP prefix (unified, zone-redundant)az network custom-ip prefix create --name myCustomIpPrefix --resource-group myResourceGroup --location westus2 --cidr '1.2.3.0/24' --zone 1 2 3 --authorization-message $byoipauth --signed-message $byoipauthsigned-
Commission a custom IP prefixaz network custom-ip prefix update --name myCustomIpPrefix --resource-group myResourceGroup --state commissionUpdate-AzCustomIpPrefix
Decommission a custom IP prefixaz network custom-ip prefix update ... --state decommissionUpdate-AzCustomIpPrefix ... -Decommission
Set a static private IP on a NICaz network nic ip-config update --resource-group myResourceGroup --nic-name myNic --name myIpConfig --private-ip-address 10.0.0.10Set-AzNetworkInterfaceIpConfig -Name myIpConfig -NetworkInterface $nic -Subnet $subnet -PrivateIpAddress 10.0.0.10
Add an IP configuration to a NICaz network nic ip-config create --resource-group myResourceGroup --name myIpConfig --nic-name myNic-

Name Resolution

TaskAzure CLIPowerShell
Change the DNS servers of a VNetaz network vnet update --resource-group myResourceGroup --name myVNet --dns-servers 10.0.0.10$virtualNetwork.DhcpOptions.DnsServers.Add("10.0.0.10") then Set-AzVirtualNetwork -VirtualNetwork $virtualNetwork
Create a public DNS zoneaz network dns zone create --resource-group MyResourceGroup --name contoso.comNew-AzDnsZone -Name contoso.com -ResourceGroupName MyDNSResourceGroup
Show a zone (and its name servers)az network dns zone show --resource-group myresourcegroup --name contoso.com-
List public DNS zonesaz network dns zone list --resource-group MyResourceGroup-
Add an A recordaz network dns record-set a add-record -g MyResourceGroup -z contoso.xyz -n www -a 10.10.10.10-
Create a private DNS zoneaz network private-dns zone create --resource-group MyAzureResourceGroup --name private.contoso.comNew-AzPrivateDnsZone -Name private.contoso.com -ResourceGroupName MyAzureResourceGroup
Link a VNet to a private zone with autoregistrationaz network private-dns link vnet create --resource-group MyAzureResourceGroup --name MyDNSLink --zone-name private.contoso.com --virtual-network myAzureVNet --registration-enabled trueNew-AzPrivateDnsVirtualNetworkLink -ZoneName private.contoso.com -ResourceGroupName MyAzureResourceGroup -Name "mylink" -VirtualNetworkId $vnet.id -EnableRegistration
Link a VNet for resolution onlyaz network private-dns link vnet create ... --registration-enabled falseNew-AzPrivateDnsVirtualNetworkLink -ZoneName private.contoso.com ... (without -EnableRegistration)
List private DNS zonesaz network private-dns zone list --resource-group MyAzureResourceGroup-
Create a DNS Private Resolver-New-AzDnsResolver -Name mydnsresolver -ResourceGroupName myresourcegroup -Location westcentralus -VirtualNetworkId "/subscriptions/<your subs id>/resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/myvnet"
Create the inbound endpoint-New-AzDnsResolverInboundEndpoint -DnsResolverName mydnsresolver -Name myinboundendpoint -ResourceGroupName myresourcegroup -Location westcentralus -IpConfiguration $ipconfig
Create the outbound endpoint-New-AzDnsResolverOutboundEndpoint -DnsResolverName mydnsresolver -Name myoutboundendpoint -ResourceGroupName myresourcegroup -Location westcentralus -SubnetId /subscriptions/<your sub id>/resourceGroups/myresourcegroup/providers/Microsoft.Network/virtualNetworks/myvnet/subnets/snet-outbound
Create a forwarding ruleset-New-AzDnsForwardingRuleset -Name myruleset -ResourceGroupName myresourcegroup -DnsResolverOutboundEndpoint $outboundendpoint -Location westcentralus

VNet Connectivity & Routing

TaskAzure CLIPowerShell
Create a VNet peeringaz network vnet peering create --name vnet-1-to-vnet-2 --vnet-name vnet-1 --remote-vnet vnet-2 --resource-group test-rg --allow-vnet-access --allow-forwarded-trafficAdd-AzVirtualNetworkPeering -Name SpokeRMtoHubRM -VirtualNetwork $spokermvnet -RemoteVirtualNetworkId $hubrmvnet.Id -UseRemoteGateways
Enable gateway transit on the hub side-Add-AzVirtualNetworkPeering -Name HubRMToSpokeRM -VirtualNetwork $hubrmvnet -RemoteVirtualNetworkId $spokermvnet.Id -AllowGatewayTransit
List peerings of a VNetaz network vnet peering list --resource-group test-rg --vnet-name vnet-1 --out tableGet-AzVirtualNetworkPeering @peer
Create a route tableaz network route-table create --resource-group test-rg --name route-table-publicNew-AzRouteTable @routeTableParams
Add a UDR to a virtual applianceaz network route-table route create --name to-private-subnet --resource-group test-rg --route-table-name route-table-public --address-prefix 10.0.2.0/24 --next-hop-type VirtualAppliance --next-hop-ip-address 10.0.3.4Add-AzRouteConfig
UDR that uses a service tag as the prefixaz network route-table route create --resource-group MyResourceGroup --route-table-name MyRouteTable --name StorageRoute --address-prefix Storage --next-hop-type VirtualAppliance --next-hop-ip-address 10.0.100.4New-AzRouteConfig @param
Associate a route table with a subnetaz network vnet subnet update --vnet-name vnet-1 --name subnet-1 --resource-group test-rg --route-table route-table-publicSet-AzVirtualNetworkSubnetConfig
Show effective routes of a NICaz network nic show-effective-route-table --name vm-1445 --resource-group test-rgGet-AzEffectiveRouteTable @Params | Format-Table
Create a Route Serveraz network routeserver create --name 'myRouteServer' --resource-group 'myResourceGroup' --hosted-subnet $subnetId --public-ip-address 'RouteServerIP'New-AzRouteServer -RouteServerName 'myRouteServer' -ResourceGroupName 'myResourceGroup' -Location 'EastUS' -HostedSubnet $subnetId -PublicIP $publicIp -VirtualRouterAutoScaleConfiguration $autoscale
Add a BGP peer (NVA) to Route Serveraz network routeserver peering create --name 'myNVA' --peer-ip '10.0.0.4' --peer-asn '65001' --routeserver 'myRouteServer' --resource-group 'myResourceGroup'Add-AzRouteServerPeer -ResourceGroupName 'myResourceGroup' -RouteServerName 'myRouteServer' -PeerName 'myNVA' -PeerAsn '65001' -PeerIp '10.0.0.4'
Get Route Server IPs and ASNaz network routeserver show --resource-group 'myResourceGroup' --name 'myRouteServer'Get-AzRouteServer -ResourceGroupName 'myResourceGroup' -RouteServerName 'myRouteServer'
Create a NAT gatewayaz network nat gateway create --resource-group test-rg --name nat-gateway --public-ip-addresses public-ip-nat --idle-timeout 10$natGateway = New-AzNatGateway @nat
Associate a NAT gateway with a subnetaz network vnet subnet update --resource-group test-rg --vnet-name vnet-1 --name subnet-1 --nat-gateway nat-gatewaySet-AzVirtualNetworkSubnetConfig @subnet

Network Monitoring

TaskAzure CLIPowerShell
Enable Network Watcher in a regionaz network watcher configure --resource-group 'NetworkWatcherRG' --locations 'eastus' --enabledNew-AzNetworkWatcher -Name 'NetworkWatcher_eastus' -ResourceGroupName 'NetworkWatcherRG' -Location 'eastus'
Start a packet captureaz network watcher packet-capture create --name 'myVM_1' --resource-group 'myResourceGroup' --vm 'myVM' --storage-account 'mystorageaccount'New-AzNetworkWatcherPacketCapture -Location 'eastus' -PacketCaptureName 'myVM_1' -TargetVirtualMachineId $vm.Id -StorageAccountId $storageAccount.Id
Check the status of a packet captureaz network watcher packet-capture show-status --location 'eastus' --name 'myVM_1'-
Stop a packet captureaz network watcher packet-capture stop --location 'eastus' --name 'myVM_1'-
Create a VNet flow log with traffic analyticsaz network watcher flow-log create --location 'eastus' --name 'myVNetFlowLog' --resource-group 'myResourceGroup' --vnet 'myVNet' --storage-account 'myStorageAccount' --traffic-analytics true --workspace 'myWorkspace' --interval 10New-AzNetworkWatcherFlowLog -Enabled $true -Name 'myVNetFlowLog' -NetworkWatcherName 'NetworkWatcher_eastus' -ResourceGroupName 'NetworkWatcherRG' -StorageId $storageAccount.Id -TargetResourceId $vnet.Id -FormatVersion 2 -EnableTrafficAnalytics -TrafficAnalyticsWorkspaceId $workspace.ResourceId
Create a VNet flow log (no traffic analytics)az network watcher flow-log create --location 'eastus' --resource-group 'myResourceGroup' --name 'myVNetFlowLog' --vnet 'myVNet' --storage-account 'myStorageAccount'New-AzNetworkWatcherFlowLog -Enabled $true -Name 'myVNetFlowLog' -NetworkWatcherName 'NetworkWatcher_eastus' -ResourceGroupName 'NetworkWatcherRG' -StorageId $storageAccount.Id -TargetResourceId $vnet.Id -FormatVersion 2

Topic pages: IP Addressing, Name Resolution, VNet Connectivity & Routing, Network Monitoring.

Design, implement, and manage connectivity services (20–25%)

Site-to-Site VPN

TaskAzure CLIPowerShell
Create a local network gatewayaz network local-gateway create --gateway-ip-address [IP address of your on-premises VPN device] --name Site1 --resource-group TestRG1 --local-address-prefixes 10.3.0.0/16 10.0.0.0/24New-AzLocalNetworkGateway -Name LocalSite -ResourceGroupName testrg -Location 'West US' -GatewayIpAddress '23.99.221.164' -AddressPrefix '10.5.51.0/24'
Create a site-to-site connectionaz network vpn-connection create --name VNet1toSite1 --resource-group TestRG1 --vnet-gateway1 VNet1GW -l eastus --shared-key abc123 --local-gateway2 Site1New-AzVirtualNetworkGatewayConnection -Name VNet1toSite1 -ResourceGroupName TestRG1 -Location 'East US' -VirtualNetworkGateway1 $gateway1 -LocalNetworkGateway2 $local -ConnectionType IPsec -SharedKey 'abc123'
Create an active-active, zone-redundant VPN gatewayaz network vnet-gateway create --name VNet1GW --public-ip-addresses VNet1GWpip1 VNet1GWpip2 --resource-group TestRG1 --vnet VNet1 --gateway-type Vpn --vpn-type RouteBased --sku VpnGw2AZ --vpn-gateway-generation Generation2 --no-waitNew-AzVirtualNetworkGateway -Name VNet1GW -ResourceGroupName TestRG1 -Location "East US" -IpConfigurations $gwipconfig1,$gwipconfig2 -GatewayType "Vpn" -VpnType RouteBased -GatewaySku VpnGw2AZ -VpnGatewayGeneration Generation2 -EnableActiveActiveFeature -Debug
Request a zone-redundant Standard public IP for the gatewayaz network public-ip create --name VNet1GWpip1 --resource-group TestRG1 --allocation-method Static --sku Standard --version IPv4 --zone 1 2 3New-AzPublicIpAddress -Name "VNet1GWpip1" -ResourceGroupName "TestRG1" -Location "EastUS" -AllocationMethod Static -Sku Standard -Zone 1,2,3
Reset a VPN gatewayaz network vnet-gateway reset -n VNet5GW -g TestRG5Reset-AzVirtualNetworkGateway -VirtualNetworkGateway $gw
Check the connection statusaz network vpn-connection show --resource-group "<resource-group>" --name "<connection-name>" --query connectionStatus --output tsv-
View the connection shared keyaz network vpn-connection shared-key show --connection-name VNet1toSite2 --resource-group TestRG1Get-AzVirtualNetworkGatewayConnectionSharedKey -Name <Connection name> -ResourceGroupName <Resource group name>
Check the gateway SKUaz network vnet-gateway show --name "vpn-gateway" --resource-group "test-rg" --query "sku.name"(Get-AzVirtualNetworkGateway -Name "vpn-gateway" -ResourceGroupName "test-rg").Sku.Name
Show the PFS group of a connection's IPsec policyaz network vpn-connection ipsec-policy list --resource-group "<resource-group>" --connection-name "<connection-name>" --query "[].pfsGroup" --output tsv-
Create a custom IPsec/IKE policy object-$ipsecpolicy6 = New-AzIpsecPolicy -IkeEncryption AES256 -IkeIntegrity SHA384 -DhGroup DHGroup24 -IpsecEncryption AES256 -IpsecIntegrity SHA256 -PfsGroup None -SALifeTimeSeconds 14400 -SADataSizeKilobytes 102400000
Update the on-premises prefixes of a local network gateway that has a connection (downtime)az network local-gateway update --local-address-prefixes 10.0.0.0/24 10.3.0.0/16 10.5.0.0/16 10.6.0.0/16 --name VNet1toSite2 -g TestRG1-
Check that the Extended Network agent runs (on each appliance)-get-service extnwagent

Point-to-Site VPN

TaskAzure CLIPowerShell
Add the RADIUS server and client address pool (IKEv2)-Set-AzVirtualNetworkGateway -VirtualNetworkGateway $Gateway -VpnClientAddressPool "172.16.201.0/24" -VpnClientProtocol "IKEv2" -RadiusServerAddress "10.51.0.15" -RadiusServerSecret $Secure_Secret
Define two RADIUS servers for high availability-$radiusServer1 = New-AzRadiusServer -RadiusServerAddress 10.1.0.15 -RadiusServerSecret $radiuspd -RadiusServerScore 30
Generate RADIUS (EAP-TLS) VPN client configuration-New-AzVpnClientConfiguration -ResourceGroupName "TestRG" -Name "VNet1GW" -AuthenticationMethod "EapTls" -RadiusRootCert "<full path name of .cer file containing the RADIUS root>" -ClientRootCert "<full path name of .cer file containing the client root>" | fl
Retrieve previously generated client configuration-Get-AzVpnClientConfiguration -ResourceGroupName "TestRG" -Name "VNet1GW" | fl
Add IKEv2 next to SSTP on a gateway (certificate authentication)-Set-AzVirtualNetworkGateway -VirtualNetworkGateway $vng -VpnClientAddressPool <Addresspool> -VpnClientProtocol IkeV2,SSTP -VpnAuthenticationType Certificate -VpnClientRootCertificates $VpnClientRootCert
Advertise a custom route to P2S clients-Set-AzVirtualNetworkGateway -VirtualNetworkGateway $gw -CustomRoute 203.0.113.250/32
Remove the P2S configuration from a gatewayaz network vnet-gateway update --name <gateway-name> --resource-group <resource-group name> --remove "vpnClientConfiguration"-
Install the Azure VPN Client with WinGetwinget install Microsoft.AzureVPNClient --source winget-

ExpressRoute

TaskAzure CLIPowerShell
Enrol the subscription for ExpressRoute Direct-Register-AzProviderFeature -FeatureName AllowExpressRoutePorts -ProviderNamespace Microsoft.Network
Add Azure private peering (IPv4)-Add-AzExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt -PeeringType AzurePrivatePeering -PeerASN 100 -PrimaryPeerAddressPrefix "10.0.0.0/30" -SecondaryPeerAddressPrefix "10.0.0.4/30" -VlanId 200
Change the private peering VLAN ID-Set-AzExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt -PeeringType AzurePrivatePeering -PeerASN 100 -PrimaryPeerAddressPrefix "10.0.0.0/30" -SecondaryPeerAddressPrefix "10.0.0.4/30" -VlanId 500
Add Microsoft peering (IPv4)-Add-AzExpressRouteCircuitPeeringConfig -Name "MicrosoftPeering" -ExpressRouteCircuit $ckt -PeeringType MicrosoftPeering -PeerASN 100 -PeerAddressType IPv4 -PrimaryPeerAddressPrefix "123.0.0.0/30" -SecondaryPeerAddressPrefix "123.0.0.4/30" -VlanId 300 -MicrosoftConfigAdvertisedPublicPrefixes "123.1.0.0/24" -MicrosoftConfigCustomerAsn 23 -MicrosoftConfigRoutingRegistryName "ARIN"
Show the private peering configuration-Get-AzExpressRouteCircuitPeeringConfig -Name "AzurePrivatePeering" -ExpressRouteCircuit $ckt
Show circuit state (provider and circuit status)-Get-AzExpressRouteCircuit -ResourceGroupName "Test-ER-RG" -Name "Test-ER-Ckt"
Show the ARP table of a peering and path-Get-AzExpressRouteCircuitARPTable -ResourceGroupName $RG -ExpressRouteCircuitName $Name -PeeringType AzurePrivatePeering -DevicePath Primary
Add the gateway subnet-Add-AzVirtualNetworkSubnetConfig -Name GatewaySubnet -VirtualNetwork $vnet -AddressPrefix 192.168.200.0/26
Move a gateway to ErGwScale with autoscaling-Set-AzVirtualNetworkGateway -VirtualNetworkGateway $vng -MinScaleUnit 2 -MaxScaleUnit 10 -GatewaySku ErGwScale
Delete the ExpressRoute gateway-Remove-AzVirtualNetworkGateway -Name $GWName -ResourceGroupName $RG
Link a virtual network to a circuitaz network vpn-connection create --name ERConnection --resource-group ExpressRouteResourceGroup --vnet-gateway1 VNet1GW --express-route-circuit2 MyCircuit$connection = New-AzVirtualNetworkGatewayConnection -Name "ERConnection" -ResourceGroupName "MyRG" -Location "East US" -VirtualNetworkGateway1 $gw -PeerId $circuit.Id -ConnectionType ExpressRoute
Create a circuit authorization for another subscriptionaz network express-route auth create --circuit-name MyCircuit -g ExpressRouteResourceGroup -n MyAuthorizationAdd-AzExpressRouteCircuitAuthorization -ExpressRouteCircuit $circuit -Name "MyAuthorization1"
Redeem an authorization when creating the connectionaz network vpn-connection create --name ERConnection --resource-group ExpressRouteResourceGroup --vnet-gateway1 VNet1GW --express-route-circuit2 MyCircuit --authorization-key "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"-
Set the connection routing weightaz network vpn-connection update --name ERConnection --resource-group ExpressRouteResourceGroup --routing-weight 100-
Enable FastPath (gateway bypass) on a new connectionaz network vpn-connection create --name ERConnection --resource-group ExpressRouteResourceGroup --express-route-gateway-bypass true --vnet-gateway1 VNet1GW --express-route-circuit2 MyCircuit-
Enable FastPath on an existing connectionaz network vpn-connection update --name ERConnection --resource-group ExpressRouteResourceGroup --express-route-gateway-bypass true-
Delete a virtual network connectionaz network vpn-connection delete --name ERConnection --resource-group ExpressRouteResourceGroup-
Enable Global Reach between two circuits (same subscription)-Add-AzExpressRouteCircuitConnectionConfig -Name 'Your_connection_name' -ExpressRouteCircuit $ckt_1 -PeerExpressRouteCircuitPeering $ckt_2.Peerings[0].Id -AddressPrefix '__.__.__.__/29'
Disable Global Reach-Remove-AzExpressRouteCircuitConnectionConfig -Name "Your_connection_name" -ExpressRouteCircuit $ckt_1

Topic pages: Site-to-Site VPN, Point-to-Site VPN, ExpressRoute.

Design and implement application delivery services (15–20%)

Load Balancer & Traffic Manager

TaskAzure CLIPowerShell
Create a zone-redundant Standard public IPaz network public-ip create --resource-group load-balancer-cli-rg --name lb-frontend-ip --sku Standard --zone 1 2 3New-AzPublicIpAddress @publicip
Create a Standard public load balanceraz network lb create --resource-group load-balancer-cli-rg --name load-balancer --sku Standard --public-ip-address lb-frontend-ip --frontend-ip-name lb-frontend --backend-pool-name lb-backend-poolNew-AzLoadBalancer @loadbalancer
Create a Standard internal load balanceraz network lb create --resource-group load-balancer-cli-rg --name load-balancer --sku Standard --vnet-name lb-vnet --subnet backend-subnet --backend-pool-name lb-backend-pool --frontend-ip-name lb-frontend-
Create a health probeaz network lb probe create --resource-group load-balancer-cli-rg --lb-name load-balancer --name lb-health-probe --protocol tcp --port 80New-AzLoadBalancerProbeConfig @probe
Create a load-balancing rule (outbound SNAT off, TCP reset on)az network lb rule create --resource-group load-balancer-cli-rg --lb-name load-balancer --name lb-HTTP-rule --protocol tcp --frontend-port 80 --backend-port 80 --frontend-ip-name lb-frontend --backend-pool-name lb-backend-pool --probe-name lb-health-probe --disable-outbound-snat true --idle-timeout 15 --enable-tcp-reset trueNew-AzLoadBalancerRuleConfig @lbrule -EnableTcpReset -DisableOutboundSNAT
Change the distribution mode of a rule (then Set-AzLoadBalancer -LoadBalancer $lb)az network lb rule update --lb-name myLoadBalancer --load-distribution Default --name myHTTPRule --resource-group myResourceGroupLB$lb.LoadBalancingRules[0].LoadDistribution = 'default'
Check whether a load balancer uses Inbound NAT Poolsaz network lb inbound-nat-pool list -g MyResourceGroup --lb-name MyLoadBalancer$slb.InboundNatPools
Create an inbound NAT rule (version 2) on the backend poolaz network lb inbound-nat-rule create -g MyResourceGroup --lb-name MyLoadBalancer -n MyNatRule --protocol Tcp --frontend-port-range-start 201 --frontend-port-range-end 500 --backend-port 22 --backend-address-pool MybackendPool-
Create a Traffic Manager profile (Priority)az network traffic-manager profile create --name $mytrafficmanagerprofile --resource-group myResourceGroup --routing-method Priority --path '/' --protocol "HTTP" --unique-dns-name $mytrafficmanagerprofile --ttl 30 --port 80-
Add an Azure endpoint to a profileaz network traffic-manager endpoint create --name $mywebappeastus --resource-group myResourceGroup --profile-name $mytrafficmanagerprofile --type azureEndpoints --target-resource-id $App1ResourceId --priority 1 --endpoint-status Enabled-
Disable a Traffic Manager endpointaz network traffic-manager endpoint update --name $mywebappeastus --resource-group myResourceGroup --profile-name $mytrafficmanagerprofile --type azureEndpoints --endpoint-status Disabled-

Application Gateway

TaskAzure CLIPowerShell
Create the public IP for the gatewayaz network public-ip create --resource-group myResourceGroupAG --name myAGPublicIPAddress --allocation-method Static --sku Standard-
Create a Standard_v2 application gatewayaz network application-gateway create --name myAppGateway --location eastus --resource-group myResourceGroupAG --capacity 2 --sku Standard_v2 --public-ip-address myAGPublicIPAddress --vnet-name myVNet --subnet myAGSubnet --servers "$address1" "$address2" --priority 100-
Check backend health-Get-AzApplicationGatewayBackendHealth -Name "appgw1" -ResourceGroupName "rgOne"
Stop the gatewayaz network application-gateway stop -g MyResourceGroup -n MyAppGateway-
Start the gatewayaz network application-gateway start -g MyResourceGroup -n MyAppGateway-
Move the gateway to another subnet in the same virtual network (stop first)az network application-gateway update -g <ResourceGroup> -n <ApplicationGatewayName> --set gatewayIpConfigurations[0].subnet.id=<subnetID>-
Enable HTTP/2 on listeners (then Set-AzApplicationGateway -ApplicationGateway $gw)-$gw.EnableHttp2 = $true
Set connection draining (add --connection-draining-timeout; 0 disables, 1 to 3,600 enables)az network application-gateway http-settings update-
Set the TCP idle timeout of the gateway's public IP (4 to 30 minutes; then Set-AzPublicIpAddress)-$publicIP.IdleTimeoutInMinutes = "15"
Probe response match for a custom probe-$match = New-AzApplicationGatewayProbeHealthResponseMatch -StatusCode 200-399

Front Door

TaskAzure CLIPowerShell
Purge cached contentaz afd endpoint purge --resource-group myRGFD --profile-name contosoafd --endpoint-name myendpoint --domains www.contoso.com --content-paths '/scripts/*'Clear-AzFrontDoorCdnEndpointContent -ResourceGroupName myRGFD -ProfileName contosoafd -EndpointName myendpoint -Domain www.contoso.com -ContentPath /scripts/*
Create an endpoint with a domain reuse scopeaz afd endpoint create --resource-group MyResourceGroup --profile-name MyProfile --endpoint-name myendpoint --name-reuse-scope SubscriptionReuseNew-AzFrontDoorCdnEndpoint -ResourceGroupName MyResourceGroup -ProfileName MyProfile -EndpointName myendpoint -Location global -AutoGeneratedDomainNameLabelScope SubscriptionReuse

Topic pages: Load Balancer & Traffic Manager, Application Gateway, Front Door.

Design and implement private access to Azure services (10–15%)

Private Link & Private Endpoints

TaskAzure CLIPowerShell
Create a private endpoint (dynamic IP)az network private-endpoint create --connection-name connection-1 --name private-endpoint --private-connection-resource-id $id --resource-group test-rg --subnet subnet-1 --group-id sites --vnet-name vnet-1New-AzPrivateEndpoint @pe
Static IP at creationaz network private-endpoint create --connection-name connection-1 --name private-endpoint --private-connection-resource-id $id --resource-group test-rg --subnet subnet-1 --group-id sites --ip-config name=ipconfig-1 group-id=sites member-name=sites private-ip-address=10.0.0.10 --vnet-name vnet-1-
Name the NIC at creation (PowerShell: set CustomNetworkInterfaceName in the @pe parameters)az network private-endpoint create --connection-name myConnection --name myPrivateEndpoint --private-connection-resource-id $id --resource-group myResourceGroup --subnet myBackendSubnet --group-id sites --nic-name myPrivateEndpointNIC --vnet-name myVNetNew-AzPrivateEndpoint @pe
Find GroupId and MemberNameaz network private-link-resource list --resource-group MyResourceGroup --name myWebApp1979 --type Microsoft.Web/sitesGet-AzPrivateLinkResource -PrivateLinkResourceId $webapp.ID
Enable endpoint network policies on a subnet (PowerShell: PrivateEndpointNetworkPoliciesFlag = 'Enabled' in the @sub parameters)az network vnet subnet update --disable-private-endpoint-network-policies false --name default --resource-group myResourceGroup --vnet-name myVNetSet-AzVirtualNetworkSubnetConfig @sub
Create a private DNS zoneaz network private-dns zone create --resource-group test-rg --name "privatelink.azurewebsites.net"New-AzPrivateDnsZone
Link the zone to a virtual networkaz network private-dns link vnet create --resource-group test-rg --zone-name "privatelink.azurewebsites.net" --name dns-link --virtual-network vnet-1 --registration-enabled falseNew-AzPrivateDnsVirtualNetworkLink
Create a DNS zone groupaz network private-endpoint dns-zone-group create --resource-group test-rg --endpoint-name private-endpoint --name zone-group --private-dns-zone "privatelink.azurewebsites.net" --zone-name webappNew-AzPrivateDnsZoneGroup @zg
Approve a connectionaz network private-endpoint-connection approve --name myPrivateEndpointConnection --resource-group myResourceGroupApprove-AzPrivateEndpointConnection @approve
Reject a connectionaz network private-endpoint-connection reject --name myPrivateEndpointConnection --resource-group myResourceGroupDeny-AzPrivateEndpointConnection @deny
Remove a connectionaz network private-endpoint-connection delete --name myPrivateEndpointConnection --resource-group myResourceGroupRemove-AzPrivateEndpointConnection @remove
Disable Private Link service network policyaz network vnet subnet update --name subnet-1 --vnet-name vnet-1 --resource-group test-rg --private-link-service-network-policies Disabled($vnet | Select -ExpandProperty subnets | Where-Object {$_.Name -eq $subnet}).privateLinkServiceNetworkPolicies = "Disabled"
Create a Private Link serviceaz network private-link-service create --resource-group test-rg --name private-link-service --vnet-name vnet-1 --subnet subnet-1 --lb-name load-balancer --lb-frontend-ip-configs frontend --location eastus2New-AzPrivateLinkService @privlinksettings

Service Endpoints

TaskAzure CLIPowerShell
Add a subnet with a Storage service endpointaz network vnet subnet create --vnet-name vnet-1 --resource-group test-rg --name subnet-1 --address-prefix 10.0.0.0/24 --service-endpoints Microsoft.StorageAdd-AzVirtualNetworkSubnetConfig @subnet
Deny public access to a storage account by defaultaz storage account update --name $storageAcctName1 --resource-group test-rg --default-action Deny-
Allow a subnet in the storage firewallaz storage account network-rule add --resource-group test-rg --account-name $storageAcctName1 --vnet-name vnet-1 --subnet subnet-1Add-AzStorageAccountNetworkRule @networkRuleParams1
Create a service endpoint policyaz network service-endpoint policy create --resource-group test-rg --name service-endpoint-policy --location westus2New-AzServiceEndpointPolicy @sepolicyParams
Add a policy definitionaz network service-endpoint policy-definition create --resource-group test-rg --policy-name service-endpoint-policy --name policy-definition --service "Microsoft.Storage" --service-resources $serviceResourceIdNew-AzServiceEndpointPolicyDefinition @policyDefinitionParams
Associate the policy with a subnetaz network vnet subnet update --vnet-name vnet-1 --resource-group test-rg --name subnet-1 --service-endpoints Microsoft.Storage --service-endpoint-policy service-endpoint-policySet-AzVirtualNetworkSubnetConfig @subnetConfigParams

Topic pages: Private Link & Private Endpoints, Service Endpoints.

Design and implement Azure network security services (15–20%)

Network Security Groups

TaskAzure CLIPowerShell
Create an NSGaz network nsg create --resource-group myResourceGroup --name myNSGNew-AzNetworkSecurityGroup @NSGParams
Add an NSG ruleaz network nsg rule create --resource-group myResourceGroup --nsg-name myNSG --name RDP-rule --priority 300 --destination-address-prefixes '*' --destination-port-ranges 3389 --protocol Tcp --description "Allow RDP"Add-AzNetworkSecurityRuleConfig -NetworkSecurityGroup $networkSecurityGroup @RuleParams
Associate an NSG with a subnetaz network vnet subnet update --resource-group myResourceGroup --vnet-name myVNet --name mySubnet --network-security-group myNSGSet-AzVirtualNetworkSubnetConfig -VirtualNetwork $virtualNetwork @SubnetParams
Associate an NSG with a network interfaceaz network nic update --name myNIC --resource-group myResourceGroup --network-security-group myNSG$nic.NetworkSecurityGroup = $nsg; $nic | Set-AzNetworkInterface
Create an application security groupaz network asg create --resource-group myResourceGroup --name myASG --location eastusNew-AzApplicationSecurityGroup @ASGParams
Add a NIC to an application security groupaz network nic ip-config update --name ipv4config --nic-name myNIC --resource-group myResourceGroup --application-security-groups myASG$nic | Set-AzNetworkInterfaceIpConfig @IP; $nic | Set-AzNetworkInterface
View a NIC's effective security rulesaz network nic list-effective-nsg --name myNIC --resource-group myResourceGroupGet-AzEffectiveNetworkSecurityGroup -NetworkInterfaceName myNIC -ResourceGroupName myResourceGroup
Register the Insights provider (needed for flow logs)az provider register --namespace Microsoft.InsightsRegister-AzResourceProvider -ProviderNamespace Microsoft.Insights
Create a virtual network flow logaz network watcher flow-log create --location 'eastus' --resource-group 'myResourceGroup' --name 'myVNetFlowLog' --vnet 'myVNet' --storage-account 'myStorageAccount'New-AzNetworkWatcherFlowLog -Enabled $true -Name 'myVNetFlowLog' -NetworkWatcherName 'NetworkWatcher_eastus' -ResourceGroupName 'NetworkWatcherRG' -StorageId $storageAccount.Id -TargetResourceId $vnet.Id -FormatVersion 2

Azure Firewall & Firewall Manager

TaskAzure CLIPowerShell
Create the firewall subnet (/26)az network vnet create --name Test-FW-VN --resource-group Test-FW-RG --location eastus --address-prefix 10.0.0.0/16 --subnet-name AzureFirewallSubnet --subnet-prefix 10.0.1.0/26New-AzVirtualNetworkSubnetConfig -Name AzureFirewallSubnet -AddressPrefix 10.0.1.0/26
Create a firewallaz network firewall create --name Test-FW01 --resource-group Test-FW-RG --location eastusNew-AzFirewall -Name Test-FW01 -ResourceGroupName Test-FW-RG -Location "East US" -VirtualNetwork $testVnet -PublicIpAddress $FWpip
Create the firewall public IPaz network public-ip create --name fw-pip --resource-group Test-FW-RG --location eastus --allocation-method static --sku standardNew-AzPublicIpAddress -Name "fw-pip" -ResourceGroupName Test-FW-RG -Location "East US" -AllocationMethod Static -Sku Standard
Attach the public IP to the firewallaz network firewall ip-config create --firewall-name Test-FW01 --name FW-config --public-ip-address fw-pip --resource-group Test-FW-RG --vnet-name Test-FW-VN-
Create a route table without BGP propagationaz network route-table create --name Firewall-rt-table --resource-group Test-FW-RG --location eastus --disable-bgp-route-propagation trueNew-AzRouteTable -Name Firewall-rt-table -ResourceGroupName Test-FW-RG -location "East US" -DisableBgpRoutePropagation
Add the default route to the firewallaz network route-table route create --resource-group Test-FW-RG --name DG-Route --route-table-name Firewall-rt-table --address-prefix 0.0.0.0/0 --next-hop-type VirtualAppliance --next-hop-ip-address $fwprivaddrAdd-AzRouteConfig -Name "DG-Route" -RouteTable $routeTableDG -AddressPrefix 0.0.0.0/0 -NextHopType "VirtualAppliance" -NextHopIpAddress $AzfwPrivateIP
Add an application ruleaz network firewall application-rule create --collection-name App-Coll01 --firewall-name Test-FW01 --name Allow-Microsoft --protocols Http=80 Https=443 --resource-group Test-FW-RG --target-fqdns www.microsoft.com --source-addresses 10.0.2.0/24 --priority 200 --action AllowNew-AzFirewallApplicationRule -Name Allow-Google -SourceAddress 10.0.2.0/24 -Protocol http, https -TargetFqdn www.google.com
Add a network ruleaz network firewall network-rule create --collection-name Net-Coll01 --destination-addresses <replace with DNS ip #1> <replace with DNS ip #2> --destination-ports 53 --firewall-name Test-FW01 --name Allow-DNS --protocols UDP --resource-group Test-FW-RG --priority 200 --source-addresses 10.0.2.0/24 --action AllowNew-AzFirewallNetworkRule -Name "Allow-DNS" -Protocol UDP -SourceAddress 10.0.2.0/24 -DestinationAddress 209.244.0.3,209.244.0.4 -DestinationPort 53
Set custom DNS serversaz network firewall update --name fwName --resource-group fwRG --dns-servers 10.1.0.4 10.1.0.5$azFw.DNSServer = $dnsServers; $azFw | Set-AzFirewall
Stop (deallocate) a firewall-$azfw.Deallocate(); Set-AzFirewall -AzureFirewall $azfw

Web Application Firewall

TaskAzure CLIPowerShell
Show Application Gateway WAF policy settings-$plcy = Get-AzApplicationGatewayFirewallPolicy -Name <policy-name> -ResourceGroupName <resourcegroup-name>; $plcy.PolicySettings
Set request body inspection and size limits on an Application Gateway WAF policyaz network application-gateway waf-policy update --name <WAF Policy name> --resource-group <WAF policy RG> --set policySettings.request_body_inspect_limit_in_kb='128' policySettings.max_request_body_size_in_kb='128' policySettings.file_upload_limit_in_mb='100' --query policySettings -o table$plcy.PolicySettings.RequestBodyEnforcement=false; Set-AzApplicationGatewayFirewallPolicy -InputObject $plcy
Put an Application Gateway WAF in force mode (associate any policy)-$appgw = Get-AzApplicationGateway -Name <your Application Gateway name> -ResourceGroupName <your Resource Group name>; $appgw.ForceFirewallPolicyAssociation = $true

Topic pages: Network Security Groups, Azure Firewall & Firewall Manager, Web Application Firewall.

Pages with no command table

These topic pages have no CLI or PowerShell table, so nothing from them is repeated here: Virtual WAN.