• 主页
  • Arm模板:无法使用应用程序网关诊断设置配置事件中心

Arm模板:无法使用应用程序网关诊断设置配置事件中心

我已经创建了一个带有事件中心的Event Hub命名空间,并尝试将其添加到应用程序网关诊断设置中,但它不起作用。(注意:使用嵌套模板)

以下是event-hub的工作臂模板:

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "hapiEnvironmentName": {
            "type": "string"
        },
        "location": {
            "type": "string",
            "defaultValue": "[resourceGroup().location]"
        },
        "eventHubSku": {
            "type": "string",
            "defaultValue": "Standard",
            "allowedValues": [ "Basic", "Standard" ]
        }
    },
    "variables": {
        "eventHubNamespaceName": "[concat(parameters('hapiEnvironmentName'), 'GatewayWafLogs')]",
        "eventHubName": "[concat(parameters('hapiEnvironmentName'), 'AppGWafLogs')]"
    },
    "resources": [
        {
            "type": "Microsoft.EventHub/namespaces",
            "apiVersion": "2017-04-01",
            "name": "[variables('eventHubNamespaceName')]",
            "location": "[parameters('location')]",
            "sku": {
                "name": "[parameters('eventHubSku')]",
                "tier": "[parameters('eventHubSku')]",
                "capacity": 5
            },
            "properties": {
                "isAutoInflateEnabled": true,
                "maximumThroughputUnits": 10
            }
        },
        {
            "type": "Microsoft.EventHub/namespaces/eventhubs",
            "apiVersion": "2017-04-01",
            "name": "[concat(variables('eventHubNamespaceName'), '/', variables('eventHubName'))]",
            "location": "[parameters('location')]",
            "dependsOn": [
                "[resourceId('Microsoft.EventHub/namespaces', variables('eventHubNamespaceName'))]"
            ],
            "properties": {
                "messageRetentionInDays": 5,
                "partitionCount": 1
            }
        }
    ]
}

这是一段应用程序网关arm模板,我试图通过它添加事件中心作为诊断设置。

{
            "apiVersion": "2017-05-01-preview",
            "type": "Microsoft.Network/applicationGateways/providers/diagnosticSettings",
            "name": "[variables('diagnosticSettingsNameForWafLogs')]",
            "properties": {
                "storageAccountId": null,
                "workspaceId": null,
                "eventHubAuthorizationRuleId": "/subscriptions/xxx-xxxx-xxxx-xxxxxxx/resourceGroups/xxxxxxxx/providers/Microsoft.EventHub/namespaces/xxxxxxxxx/authorizationrules/RootManageSharedAccessKey",
                "eventHubName": "param[('eventhubname')]",
                "metrics": [
                  {
                    "category": "AllMetrics",
                    "enabled": false,
                    "retentionPolicy": {
                      "enabled": false,
                      "days": 0
                    }
                  }
                ],
                "logs": [
                    {
                        "category": "ApplicationGatewayAccessLog",
                        "enabled": false,
                        "retentionPolicy": {
                            "enabled": false,
                            "days": 0
                        }
                    },
                    {
                        "category": "ApplicationGatewayFirewallLog",
                        "enabled": true,
                        "retentionPolicy": {
                            "enabled": false,
                            "days": 0
                        }
                    },
                    {
                        "category": "ApplicationGatewayPerformanceLog",
                        "enabled": false,
                        "retentionPolicy": {
                            "enabled": false,
                            "days": 0
                        }
                    }
                ]
            },
            "dependsOn": [
                "[resourceId('Microsoft.Network/applicationGateways', variables('agwafv2Name'))]"
            ]
        }

我得到的错误是:

{
  "code": "DeploymentFailed",
  "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.",
  "details": [
    {
      "code": "NoRegisteredProviderFound",
      "message": "No registered resource provider found for location 'westcentralus' and API version '2017-05-01-preview' for type 'applicationGateways'. The supported api-versions are '2014-12-01-preview, 2015-05-01-preview, 2015-06-15, 2016-03-30, 2016-06-01, 2016-07-01, 2016-08-01, 2016-09-01, 2016-10-01, 2016-11-01, 2016-12-01, 2017-03-01, 2017-04-01, 2017-06-01, 2017-08-01, 2017-09-01, 2017-10-01, 2017-11-01, 2018-01-01, 2018-02-01, 2018-03-01, 2018-04-01, 2018-05-01, 2018-06-01, 2018-07-01, 2018-08-01, 2018-10-01, 2018-11-01, 2018-12-01, 2019-02-01, 2019-04-01, 2019-06-01, 2019-07-01, 2019-08-01, 2019-09-01, 2019-11-01, 2019-12-01, 2020-01-01, 2020-03-01, 2020-04-01, 2020-05-01, 2020-06-01, 2020-07-01, 2020-08-01, 2020-11-01, 2021-01-01, 2021-02-01, 2021-03-01'. The supported locations are 'westus, eastus, northeurope, westeurope, eastasia, southeastasia, northcentralus, southcentralus, centralus, eastus2, japaneast, japanwest, brazilsouth, australiaeast, australiasoutheast, centralindia, southindia, westindia, canadacentral, canadaeast, westcentralus, westus2, ukwest, uksouth, koreacentral, koreasouth, francecentral, australiacentral, southafricanorth, uaenorth, switzerlandnorth, germanywestcentral, norwayeast, westus3, jioindiawest'."
    }
  ]
}

但这同样适用于Log Analytics。

转载请注明出处:http://www.jubohx.com/article/20230517/1721058.html