Last active
April 5, 2018 09:11
-
-
Save markwragg/0f6a91e8eeb6c5515a09ac29c862307f to your computer and use it in GitHub Desktop.
Get Azure subnets for a VNET and sort them correctly by address by recasting them to [version]
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
$VNET = Get-AzureRmVirtualNetwork -name VNET_NAME -ResourceGroupName RG_NAME | |
(Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $VNET).AddressPrefix | ForEach-Object { | |
$Net = $_ -split '/' | |
[pscustomobject]@{ | |
Address = [version]$Net[0] | |
Mask = $Net[1] | |
} | |
} | Sort Address |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment