将事件中心地理恢复DR别名引用为命名空间

时间:2020-09-02 23:45:21

标签: azure azure-eventhub azure-monitoring azure-policy bastion-host

我们有一个DeployIfNotExists策略,该策略在环境中的资源上创建诊断设置。该策略包含诊断设置的ARM模板,该模板在评估后触发该设置,该触发器在资源上不存在。请参见下面:(这是Azure堡垒主机的一个示例设置)

    "resources": [
            {
              "type": "Microsoft.Network/bastionHosts/providers/diagnosticSettings",
              "apiVersion": "2017-05-01-preview",
              "name": "[concat(parameters('resourceName'), '/Microsoft.Insights/', parameters('profileName'))]",
              "location": "[parameters('location')]",
              "dependsOn": [],
              "properties": {
                "eventHubAuthorizationRuleId": "[parameters('eventHubRuleId')]",
                "eventHubName": "[parameters('eventHubName')]",
                "logs": [
                  {
                    "category": "BastionAuditLogs",
                    "enabled": true
                  }
                ]
              }
            }
          ],

“事件中心授权规则ID”的一行,我们传入了一个参数。之前,我们只是传递了主要Event Hub的信息。但是,位于不同区域中的某些资源将失败,因为它们无法将跨区域写入事件中心。因此,现在我们正在使用地理恢复别名。

我们有一个Geo-Recovery DR别名,可在两个不同的区域中连接主要/次要事件中心。我想通过此DR别名的EventHubAuthorizationRuleID,但是这样做时会出现以下问题:

    Resource type 'microsoft.eventhub/namespaces/disasterrecoveryconfigs/authorizationrules' is invalid for property 'properties.eventHubAuthorizationRuleId'. Expected types are 'microsoft.servicebus/namespaces/authorizationrules', 'microsoft.eventhub/namespaces/authorizationrules

我们使用以下Powershell命令获取DR别名的授权规则:

    PS: Get-AzEventHubAuthorizationRule -AliasName xxxxxxxxxxxxxx -Namespace xxxxxxxxxxxx -ResourceGroupName xxxxxxxxxxxxxxxx


    Id       : /subscriptions/xxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxx/providers/Microsoft.EventHub/namespaces/xxxxxxxxxxx/disasterRecoveryConfigs/xxxxxxxxxxxxxxx/AuthorizationRules/RootManageSharedAccessKey
    Type     : Microsoft.EventHub/Namespaces/AuthorizationRules
    Name     : RootManageSharedAccessKey
    Location : 
    Tags     : 
    Rights   : {Listen, Manage, Send}

上面的ID是我们作为参数传入的,并导致失败。 Powershell响应中的类型为“ Microsoft.EventHub / Namespaces / AuthorizationRules”,即使它明确包含“ disasterRecoveryConfigs”部分。

问题:我们如何引用DR别名,以便将其读取为常规名称空间?

0 个答案:

没有答案