【Azure Key Vaule】使用Kusto查询语句从Azure Resource Graph Explorer中获取资源公网开启/关闭状态结果

问题描述

在Azure Resource Graph Explorer页面中,查看Azure Key Vault资源的公网访问状态,哪一种值才表示公网不可访问此资源呢?

 查询的Query语句:

resources
// |  where name == <your keyvault name>
| where type == "microsoft.keyvault/vaults"
| extend ipRulesCount = array_length(properties.networkAcls.ipRules), vnrCount = array_length(properties.networkAcls.virtualNetworkRules)
| project  properties.publicNetworkAccess, properties.networkAcls.defaultAction, ipRulesCount , vnrCount 

PS: Azure Resource Graph Explorer 页面 ( https://portal.azure.cn/#view/HubsExtension/ArgQueryBlade )

 

问题解答

对比Key Vault的Networking配置,可以得出如下表格:

 

Allow public access from all networks

允许所有公网访问

Allow public access from specific virtual networks and IP addresses

只允许指定的IP地址或者私网访问

Disable public access

关闭公网访问

properties.publicNetworkAccess Enabled Enabled Disabled
properties.networkAcls.defaultAction null  /   Allow  Deny Deny

根据以上表格,只要 properties.networkAcls.defaultAction == Deny 或者 properties.publicNetworkAccess == Disabled 就可以表示,当前资源是不可以被全部公网访问的。

 

参考资料

posted @ 2025-05-05 20:51  路边两盏灯  阅读(21)  评论(0)    收藏  举报