1

I would like to add a new Address space to my existing RM Virtual Network. I can add subnets with command Add-AzureRmVirtualNetworkSubnetConfig but unfortunatelly can not find similar command for adding Address space.

Rick Rainey
  • 11,096
  • 4
  • 30
  • 48
g.pickardou
  • 32,346
  • 36
  • 123
  • 268

1 Answers1

2

Use Get-AzureRmVirtualNetwork to get the current configuration. Add your additional address prefixes. Then, use Set-AzureRmVirtualNetwork to apply.

Assuming your virtual network currently has an address prefix of 10.0.0.0/16, which is the default, you could extend it with additional address prefixes as shown here.

# Get existing virtual network
$vnet  = Get-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $myResourceGroup

# Add additional address prefixes
$vnet.AddressSpace.AddressPrefixes.Add("10.1.0.0/16")
$vnet.AddressSpace.AddressPrefixes.Add("10.2.0.0/16")
Set-AzureRmVirtualNetwork -VirtualNetwork $vnet
Rick Rainey
  • 11,096
  • 4
  • 30
  • 48