Last active
November 8, 2016 13:18
-
-
Save astaykov/e2d21a7191888fac1b0eb0c2c640c3ac to your computer and use it in GitHub Desktop.
Get the type of all Azure Virtual Network Gateways in your Azure subscriptions
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
Login-AzureRmAccount | |
cls | |
$subs = Get-AzureRmSubscription | |
ForEach ($sub in $subs) | |
{ | |
Write-Host 'ARM: VPN Gateways in subscription' $sub.SubscriptionName '(' $sub.SubscriptionId ')' | |
Select-AzureRmSubscription -SubscriptionName $sub.SubscriptionName -OutVariable out | |
$gwr = Find-AzureRmResource -ResourceType "Microsoft.Network/virtualNetworkGateways" | |
if ( $gwr -ne $null) | |
{ | |
foreach( $gw in $gwr) | |
{ | |
if($gw.ResourceGroupName -ne $null) | |
{ | |
$gwo = Get-AzureRmVirtualNetworkGateway -ResourceGroupName $gw.ResourceGroupName -Name $gw.Name | | |
Select-Object Name, Location, SkuText, ResourceGroupName | |
$gwo | Format-Table -AutoSize -Wrap | |
} | |
} | |
} | |
} | |
$asmSubs = Get-AzureSubscription -OutVariable out | |
ForEach ($sub in $asmSubs) | |
{ | |
Select-AzureSubscription -SubscriptionName $sub.SubscriptionName -OutVariable out | |
Write-Host 'ASM: VPN Gateways in subscription' $sub.SubscriptionName '(' $sub.SubscriptionId ')' | |
Get-AzureVirtualNetworkGateway | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment