在 Azure Resource Graph 中查询资源子类型
Querying Resource Sub-Types in Azure Resource Graph
我正在尝试使用 Azure Policy 的资源图查询事件中心防火墙 IP 规则。我目前已经使用以下防火墙 IP 规则配置了一个事件中心。
{
"type": "Microsoft.EventHub/namespaces/ipfilterrules",
"apiVersion": "2018-01-01-preview",
"name": "[concat(parameters('namespaces_myeventhub_name'), '/e51110a0-c074-43b3-85b7-b43e2eab4d9b')]",
"location": "West US 2",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', parameters('namespaces_myeventhub_name'))]"
],
"properties": {
"ipMask": "47.xxx.xxx.xxx",
"action": "Accept",
"filterName": "e51110a0-c074-43b3-85b7-b43e2eax4d9b"
}
}
查询
"where type =~ 'Microsoft.EventHub/namespaces'"
将在没有任何防火墙 IP 规则信息的情况下显示我的事件中心。以及
的查询
where type =~ 'Microsoft.EventHub/namespaces/ipfilterrules'
returns 没什么。我希望能够使用资源图查询此信息,并最终针对这些属性编写 Azure Policy。我已使用以下
使用此信息搜索可能的别名
"where type =~ 'Microsoft.EventHub/namespaces' | limit 1 | project aliases"
但列表 returns 不包含事件中心的防火墙 IP 规则信息。这似乎是 Resource Graph 中应该提供的基本信息......我错过了什么?
经过测试,不幸的是,通过Azure Resource Graph APIs只能查询event hub命名空间的级别,不能直接通过Azure Resource Graph查询ipfilterrules,
请参考以下解决方案作为解决方法:
1:查询订阅下的所有事件中心命名空间
例如:
https://management.azure.com/subscriptions//providers/Microsoft.EventHub/namespaces?api-version=2018-01-01-预览
2:查询事件中心命名空间下的所有ipfilterrules,在你的程序中逐一过滤ipfilterrules。
例如
https://management.azure.com/subscriptions//resourceGroups/ericm/providers/Microsoft.EventHub/namespaces//ipfilterrules?api-version=2018-01-01-preview
希望对您的关注有所帮助。
我正在尝试使用 Azure Policy 的资源图查询事件中心防火墙 IP 规则。我目前已经使用以下防火墙 IP 规则配置了一个事件中心。
{
"type": "Microsoft.EventHub/namespaces/ipfilterrules",
"apiVersion": "2018-01-01-preview",
"name": "[concat(parameters('namespaces_myeventhub_name'), '/e51110a0-c074-43b3-85b7-b43e2eab4d9b')]",
"location": "West US 2",
"dependsOn": [
"[resourceId('Microsoft.EventHub/namespaces', parameters('namespaces_myeventhub_name'))]"
],
"properties": {
"ipMask": "47.xxx.xxx.xxx",
"action": "Accept",
"filterName": "e51110a0-c074-43b3-85b7-b43e2eax4d9b"
}
}
查询
"where type =~ 'Microsoft.EventHub/namespaces'"
将在没有任何防火墙 IP 规则信息的情况下显示我的事件中心。以及
的查询where type =~ 'Microsoft.EventHub/namespaces/ipfilterrules'
returns 没什么。我希望能够使用资源图查询此信息,并最终针对这些属性编写 Azure Policy。我已使用以下
使用此信息搜索可能的别名"where type =~ 'Microsoft.EventHub/namespaces' | limit 1 | project aliases"
但列表 returns 不包含事件中心的防火墙 IP 规则信息。这似乎是 Resource Graph 中应该提供的基本信息......我错过了什么?
经过测试,不幸的是,通过Azure Resource Graph APIs只能查询event hub命名空间的级别,不能直接通过Azure Resource Graph查询ipfilterrules, 请参考以下解决方案作为解决方法:
1:查询订阅下的所有事件中心命名空间 例如: https://management.azure.com/subscriptions//providers/Microsoft.EventHub/namespaces?api-version=2018-01-01-预览
2:查询事件中心命名空间下的所有ipfilterrules,在你的程序中逐一过滤ipfilterrules。 例如 https://management.azure.com/subscriptions//resourceGroups/ericm/providers/Microsoft.EventHub/namespaces//ipfilterrules?api-version=2018-01-01-preview
希望对您的关注有所帮助。