Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 598 Bytes

PowerShell.md

File metadata and controls

22 lines (17 loc) · 598 Bytes

Sample PowerShell Commands

Pre-requisite

Install Az PowerShell modules

Install-Module Az -Repository PSGallery -Force

Code Sample

#Sign-in
Connect-AzAccount

#install Az.Graph module if necessary
install-module az.resourcegraph -force

#Define Resource graph search query
$Query = "where type =~ 'microsoft.storage/storageAccounts' and aliases['Microsoft.Storage/storageAccounts/networkAcls.defaultAction'] == 'Allow'" 

#Invoke search
Search-AzGraph -Query $Query | Format-Table kind, Location, ManagedBy, Name, ResourceGroup, SubscriptionId, TenantId