部署Azure防火墙IP组更改失败,出现冲突

jhkqcmku  于 2023-02-13  发布在  其他
关注(0)|答案(1)|浏览(97)

我正在尝试使用策略、规则和一组IPGroup部署Azure防火墙。当我部署ARM模板以启动所有工作时..稍后如果我想更改其中一个IPGroup中的某项内容,并尝试部署该IPGroup更改,Azure部署失败,并显示状态:与消息冲突:

{
    "status": "Failed",
    "error": {
        "code": "ResourceDeploymentFailure",
        "message": "The resource operation completed with terminal provisioning state 'Failed'."
    }
}

我已经尝试在自己的ARM模板中分别管理IP组,并将它们与Azure策略规则集合ARM模板一起放置,看看将它们部署在一起是否会有所帮助,但无论哪种方式,我们都会遇到“冲突”。我想我想知道更新作为防火墙网络规则一部分的IP组的适当方式是什么?如果我不能简单地更新IP组?
这里是我的完整ARM模板的一个例子,我的政策与IPGroups..

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
      "firewallPolicyName": {
            "defaultValue": "[concat('onelucki-fw-parent-policy', uniqueString(resourceGroup().id))]",
            "type": "String"
        },
        "DevSubnets": {
            "defaultValue": "DevSubnets",
            "type": "String"
        },
        "AzureSubnets": {
            "defaultValue": "AzureSubnets",
            "type": "String"
        }
    },
    "variables": {
        "fwPolicyName": "[parameters('firewallPolicyName')]"
    },
    "resources": [
          {
            "type": "Microsoft.Network/ipGroups",
            "apiVersion": "2020-05-01",
            "name": "AzureSubnets",
            "location": "centralus",
            "tags": { "Zone": "MixedZones" },
            "properties": {
                "ipAddresses": [
                    "10.99.1.1"
                ]
            }
        },
        {
            "type": "Microsoft.Network/ipGroups",
            "apiVersion": "2020-05-01",
            "name": "DevSubnets",
            "location": "centralus",
            "tags": { "Zone": "Dev" },
            "properties": {
                "ipAddresses": [
                    "10.99.2.2"
                ]
            }
        },
        {
            "type": "Microsoft.Network/firewallPolicies",
            "apiVersion": "2020-11-01",
            "name": "[parameters('firewallPolicyName')]",
            "location": "centralus",
            "properties": {
                "sku": {
                    "tier": "Standard"
                },
                "threatIntelMode": "Alert"
            }
        },
        {
            "type": "Microsoft.Network/firewallPolicies/ruleCollectionGroups",
            "apiVersion": "2020-11-01",
            "name": "[concat(parameters('firewallPolicyName'), '/DefaultNetworkRuleCollectionGroup')]",
            "location": "westus",
            "dependsOn": [
                "[resourceId('Microsoft.Network/ipGroups', parameters('AzureSubnets'))]",
                "[resourceId('Microsoft.Network/ipGroups', parameters('DevSubnets'))]",
                "[resourceId('Microsoft.Network/firewallPolicies', parameters('firewallPolicyName'))]"
            ],
            "properties": {
                "priority": 200,
                "ruleCollections": [
                    {
                        "ruleCollectionType": "FirewallPolicyFilterRuleCollection",
                        "action": {
                            "type": "Allow"
                        },
                        "rules": [
                            {
                                "ruleType": "NetworkRule",
                                "name": "DemoRule",
                                "ipProtocols": [
                                    "TCP"
                                ],
                                "sourceAddresses": [],
                                "sourceIpGroups": [
                                    "/subscriptions/<subscriptionIDHere>/resourceGroups/onelucki-fw/providers/Microsoft.Network/ipGroups/DevSubnets"
                                ],
                                "destinationAddresses": [],
                                "destinationIpGroups": [
                                     "/subscriptions/<subscriptionIDHere>/resourceGroups/onelucki-fw/providers/Microsoft.Network/ipGroups/AzureSubnets"
                                ],
                                "destinationFqdns": [],
                                "destinationPorts": [
                                    "135",
                                    "445"
                                ]
                            }
                        ],
                        "name": "DemoDeployRuleCollection",
                        "priority": 1300
                    }
                ]
            }
        }
    ]
}
w8ntj3qf

w8ntj3qf1#

IP组需要一次部署一个。防火墙策略也需要依赖于正在使用的IP组,尽管它没有列出它们。
IP组的部署似乎在部署期间对防火墙策略进行了一些验证/更新。
Deploy nested resources in Azure using DependsOn

相关问题