Created
April 10, 2020 17:38
-
-
Save fabriciosanchez/14c52aa5f091a02eca3b4f718f1b4fa7 to your computer and use it in GitHub Desktop.
Retrieving existing VNet info and adding two new subnets into it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Retriving vnet information | |
$vnet = Get-AzVirtualNetwork -Name vnet-americasuniversity -ResourceGroupName CoreResources | |
# Adding appgtw-subnet to the existing VNet | |
$subnetAGConfig = Add-AzVirtualNetworkSubnetConfig ` | |
-Name appgtw-subnet ` | |
-AddressPrefix 10.1.5.0/28 ` | |
-VirtualNetwork $vnet | |
# Adding apim-subnet to the existing VNet | |
$subnetAPIMConfig = Add-AzVirtualNetworkSubnetConfig ` | |
-Name apim-subnet ` | |
-AddressPrefix 10.1.6.0/28 ` | |
-VirtualNetwork $vnet | |
# Attaching new subnets to the VNet | |
$vnet | Set-AzVirtualNetwork | |
# Making sure subnets were successfully added | |
$vnet.Subnets | |
# Assign subnet to variables | |
$appgatewaysubnetdata = $vnet.Subnets[6] | |
$apimsubnetdata = $vnet.Subnets[5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment