Add a Subnet to an existing Virtual Network based on Azure Resource Manager

Posted on: October 5, 2015


VerbosePreference = "continue"
Write-verbose "Setting Environment Variables"
$ResourceGroup = "RayNorthEurope"
$VNETName = "RayNorthEuropeVN01"
$SubnetName = "Subnet-2"
$SubnetPrefix = ""
Write-verbose "Adding a New Subnet to an Existing ARM based Virtual Network"
$vnet   = Get-AzureVirtualNetwork -ResourceGroupName $ResourceGroup -Name $VNETName
$vnet | Add-AzureVirtualNetworkSubnetConfig -Name $SubnetName -AddressPrefix $SubnetPrefix | Set-AzureVirtualNetwork
Write-verbose "Output of the Subnet's Associated with the ARM based Virtual Network $VNETName"
$VNET1 = Get-AzureVirtualNetwork -ResourceGroupName $ResourceGroup -Name $VNETName
Write-Verbose "Successfully Executed the Script"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: