【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 就可以表示,當前資源是不可以被全部公網訪問的。
參考資料
Kusto Query Language overview : https://learn.microsoft.com/en-us/kusto/query/?view=microsoft-fabric
array_length() :https://learn.microsoft.com/en-us/kusto/query/array-length-function?view=microsoft-fabric
當在復雜的環境中面臨問題,格物之道需:濁而靜之徐清,安以動之徐生。 云中,恰是如此!

浙公網安備 33010602011771號