Last active
July 13, 2019 14:41
-
-
Save seanmcdonnellblog/7b0c3e91f6d22af1bff021483b0c939b to your computer and use it in GitHub Desktop.
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
# Global Variables | |
$resourceType = 'microsoft.storage/storageAccounts' | |
## EXAMPLE 1 - Find tags for Storage Accounts | |
$query = "where type =~ '$resourceType' | project name, resourceGroup, type, location, tags" | |
Search-AzGraph -Query $query | |
## EXAMPLE 2 - Display Count for the Service Tag | |
$query = "where type =~ '$resourceType' | project tag = tostring(tags.Service) | summarize count() by tag" | |
Search-AzGraph -Query $query | |
## EXAMPLE 3 - Count count of Storage Accounts by location | |
$query = "where type =~ '$resourceType' | summarize count() by location" | |
Search-AzGraph -Query $query | |
## EXAMPLE 4 - Find any Storage accounts that are not VNET integrated (Accessible from Internet) | |
$query = "where type =~ '$resourceType' and aliases['Microsoft.Storage/storageAccounts/networkAcls.defaultAction'] == 'Allow' ` | |
| project name, kind, location" | |
Search-AzGraph -Query $query | |
## EXAMPLE 5 - Find any storage accounts which are not located in Primary Loation UK South | |
$query = "where type =~ '$resourceType' and aliases['Microsoft.Storage/storageAccounts/primaryLocation'] != 'uksouth' | ` | |
project name, location, resourceGroup" | |
Search-AzGraph -Query $query |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment