About This Page
This page is part of the Azure documentation. It contains code examples and configuration instructions for working with Azure services.
Bias Analysis
Bias Types:
⚠️
powershell_heavy
⚠️
windows_first
⚠️
missing_linux_example
⚠️
windows_tools
Summary:
The documentation page exclusively uses Azure PowerShell cmdlets and PowerShell scripting throughout all examples and instructions. There are no references to Azure CLI, Bash, or Linux-native tools. The prerequisites and instructions assume the use of PowerShell (either in Azure Cloud Shell or locally), and all code samples are PowerShell-specific. This creates a strong Windows/PowerShell bias and does not address users who prefer or require Linux or cross-platform command-line tools.
Recommendations:
- Provide equivalent Azure CLI (az) command examples alongside PowerShell cmdlets for each step (resource group creation, VM creation, Network Watcher operations, cleanup, etc.).
- Explicitly mention that Azure Cloud Shell supports both Bash and PowerShell, and show how to select the Bash environment.
- Include Bash/Linux shell script examples where appropriate, especially for users who may be working from Linux or macOS environments.
- Add a section or callout explaining the parity between PowerShell and Azure CLI, and link to relevant Azure CLI documentation.
- Ensure that references to installing tools locally include both Azure PowerShell and Azure CLI, with links and brief instructions for each.
Create pull request
Flagged Code Snippets
Create the VM with [New-AzVM](/powershell/module/az.compute/new-azvm). When running this step, you are prompted for credentials. The values that you enter are configured as the user name and password for the VM.
The VM takes a few minutes to create. Don't continue with remaining steps until the VM is created and PowerShell returns output.
## Test network communication
To test network communication with Network Watcher, you must first enable a network watcher in the region the VM that you want to test is in, and then use Network Watcher's next hop capability to test communication.
## Enable network watcher
If you already have a network watcher enabled in the East US region, use [Get-AzNetworkWatcher](/powershell/module/az.network/get-aznetworkwatcher) to retrieve the network watcher. The following example retrieves an existing network watcher named *NetworkWatcher_eastus* that is in the *NetworkWatcherRG* resource group:
If you don't already have a network watcher enabled in the East US region, use [New-AzNetworkWatcher](/powershell/module/az.network/new-aznetworkwatcher) to create a network watcher in the East US region:
### Use next hop
Azure automatically creates routes to default destinations. You may create custom routes that override the default routes. Sometimes, custom routes can cause communication to fail. To test routing from a VM, use the [Get-AzNetworkWatcherNextHop](/powershell/module/az.network/get-aznetworkwatchernexthop) command to determine the next routing hop when traffic is destined for a specific address.
Test outbound communication from the VM to one of the IP addresses for www.bing.com:
The output returned informs you that **None** is the **NextHopType**, and that the **RouteTableId** is also **System Route**. This result lets you know that, while there is a valid system route to the destination, there is no next hop to route the traffic to the destination.
## View details of a route
To analyze routing further, review the effective routes for the network interface with the [Get-AzEffectiveRouteTable](/powershell/module/az.network/get-azeffectiveroutetable) command:
As you can see in the previous output, the route with the **AddressPrefix** of **0.0.0.0/0** routes all traffic not destined for addresses within other route's address prefixes with a next hop of **Internet**. As you can also see in the output, though there is a default route to the 172.16.0.0/12 prefix, which includes the 172.31.0.100 address, the **nextHopType** is **None**. Azure creates a default route to 172.16.0.0/12, but doesn't specify a next hop type until there is a reason to. If, for example, you added the 172.16.0.0/12 address range to the address space of the virtual network, Azure changes the **nextHopType** to **Virtual network** for the route. A check would then show **Virtual network** as the **nextHopType**.
## Clean up resources
When no longer needed, you can use [Remove-AzResourceGroup](/powershell/module/az.resources/remove-azresourcegroup) to remove the resource group and all of the resources it contains: