Az.Network PowerShell Module Reference
This document provides detailed reference information for the cmdlets in the Az.Network PowerShell module. This module is used to manage Azure networking resources.
Get-AzVirtualNetwork
Gets virtual networks or a list of virtual networks in a resource group.
Parameters:
| Name | Type | Description |
|---|---|---|
| -Name | [String] | The name of the virtual network. |
| -ResourceGroupName | [String] | The name of the resource group. |
| -ExpandResource | [String] | Expands resource usage. |
| -Force | [Switch] | Do not ask for confirmation. |
| -DefaultProfile | [IAzureContextContainer] | The credentials, account, tenant, and subscription that are used for communication with Azure. |
Example:
Get-AzVirtualNetwork -ResourceGroupName "MyResourceGroup" -Name "MyVNet"
Get-AzVirtualNetwork -ResourceGroupName "MyResourceGroup"
New-AzVirtualNetworkSubnetConfig
Creates a subnet configuration.
Parameters:
| Name | Type | Description |
|---|---|---|
| -Name | [String] | The name of the subnet. |
| -AddressPrefix | [String] | The address prefix of the subnet. |
| -NetworkSecurityGroup | [NetworkSecurityGroup] | The network security group to associate with the subnet. |
| -RouteTable | [RouteTable] | The route table to associate with the subnet. |
Example:
New-AzVirtualNetworkSubnetConfig -Name "MySubnet" -AddressPrefix "10.0.1.0/24"
New-AzVirtualNetwork
Creates a virtual network.
Parameters:
| Name | Type | Description |
|---|---|---|
| -Name | [String] | The name of the virtual network. |
| -ResourceGroupName | [String] | The name of the resource group. |
| -Location | [String] | The location of the virtual network. |
| -Subnet | [@()|VirtualNetworkSubnetConfig[]] | The subnets of the virtual network. |
Example:
$subnet = New-AzVirtualNetworkSubnetConfig -Name "MySubnet" -AddressPrefix "10.0.1.0/24"
New-AzVirtualNetwork -Name "MyVNet" -ResourceGroupName "MyResourceGroup" -Location "East US" -Subnet $subnet
Set-AzVirtualNetwork
Updates a virtual network.
Parameters:
| Name | Type | Description |
|---|---|---|
| -VirtualNetwork | [VirtualNetwork] | The virtual network object. |
Example:
$vnet = Get-AzVirtualNetwork -ResourceGroupName "MyResourceGroup" -Name "MyVNet"
$vnet.DhcpOptions.DnsServers.Add("8.8.8.8")
Set-AzVirtualNetwork -VirtualNetwork $vnet
Remove-AzVirtualNetwork
Deletes a virtual network.
Parameters:
| Name | Type | Description |
|---|---|---|
| -Name | [String] | The name of the virtual network. |
| -ResourceGroupName | [String] | The name of the resource group. |
| -Force | [Switch] | Do not ask for confirmation. |
Example:
Remove-AzVirtualNetwork -Name "MyVNet" -ResourceGroupName "MyResourceGroup" -Force
For a complete list of cmdlets in the Az.Network module, please refer to the All Cmdlets page.