View Firewalls and virtual networks settings values for storage accounts using azure graph

67 Views Asked by At

I would like to write an azure graph query that shows the firewall and virtual networks settings for each storage account.Under public network there are 3 possible values

  • enabled for all networks
  • enabled from selected virtual networks and IP addresses
  • disabled

would like to project this with name,resourcegroup, typedisplayname, kind. Any help is appreciated.

1

There are 1 best solutions below

1
Sridevi On BEST ANSWER

You can make use of below sample KQL query to view firewall and virtual networks settings for each storage account:

resources
| where type == "microsoft.storage/storageaccounts"
| extend firewallSettings = 
    case(
        properties.publicNetworkAccess == "Disabled",
        "Disabled",
        isempty(properties.publicNetworkAccess) or (properties.publicNetworkAccess == "Enabled" and properties.networkAcls.defaultAction == "Allow"), 
        "Enabled for all networks",
        "Enabled from selected virtual networks and IP addresses")
| project name, resourceGroup, type, kind, firewallSettings, properties

Response:

enter image description here