Skip to content

Instantly share code, notes, and snippets.

@mmckechney
Created June 12, 2019 14:27
Show Gist options
  • Save mmckechney/9030112b635363d2a6acb9ba9875764c to your computer and use it in GitHub Desktop.
Save mmckechney/9030112b635363d2a6acb9ba9875764c to your computer and use it in GitHub Desktop.
Get Application Gateway Sku's for all gateways
$properties = @{Name = ""; ResourceGroupName =""; Location = ""; SkuName = ""; SkuTier = ""; Subscription = ""}
$gwTemplate = New-Object -TypeName PSObject -Property $properties
$qwCollection = @()
$subs = Get-AzSubscription
foreach($sub in $subs)
{
Select-AzSubscription -Subscription $sub.Name
$gws = Get-AzApplicationGateway
foreach($gw in $gws)
{
$qwObj = $gwTemplate.PSObject.Copy()
$qwObj.Subscription = $sub.Name
$qwObj.Name = $gw.Name
$qwObj.ResourceGroupName =$gw.ResourceGroupName
$qwObj.Location = $gw.Location
$qwObj.SkuName = $gw.Sku.Name
$qwObj.SkuTier = $gw.Sku.Tier
$qwCollection += $qwObj
}
}
$qwCollection | Format-Table
@mmckechney
Copy link
Author

This PowerShell script will:

  • Iterate through all of the Azure subscriptions that you have access to in the currently authenticated tenant (Run Connect-AzAccount first to login)
  • Find all of the Application Gateways that you have deployed and have access to in the subscriptions
  • Collect and report the SKU information on each of the gateways

Note, if the SkuName contains WAF_V2 or Standard_v2 then the gateway is the newer v2 version of the gateway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment