【问题标题】:Azure Service Bus - ARM Template (Update existing Topic parameters)Azure 服务总线 - ARM 模板(更新现有主题参数)
【发布时间】:2019-07-10 08:51:32
【问题描述】:

我需要有关 Azure 服务总线服务的帮助。我需要使用 Visual Studio 在现有的服务总线服务中创建一个新主题,有什么方法可以实现这一点。因为当我尝试这样做时,我收到以下错误:

  • 模板部署返回以下错误: 15:28:14 - 15:28:13 - 资源 Microsoft.ServiceBus/namespaces “#######” 失败并显示消息“{ 15:28:14 - “错误”:{ 15:28:14 -“消息”:“命名空间更新失败,后端发生冲突。CorrelationId:3c155444-2c1e-525d-943f-8b25d0a1da7e”, 15:28:14 - “代码”:“冲突” 15:28:14 - }

任何帮助都会对我很有帮助。

【问题讨论】:

  • 这不是一个特别有用的错误文本 :) 您介意共享模板和您传递给模板的输入吗?
  • 请确保帐户中没有同名(您尝试创建的)队列或主题。
  • 我使用以下模板:github.com/Azure/azure-quickstart-templates/tree/master/… 但是,我知道使用此模板我们创建主题,在我的情况下,我想更新现有主题中的参数。

标签: visual-studio azure azureservicebus azure-resource-manager azure-servicebus-topics


【解决方案1】:

Microsoft.Resources/deployments 模板允许您update an existing resource。

修改快速入门模板以允许更新看起来像这样(我确实删除了订阅部署以使其更短一些)。请记住,某些参数(例如分区)无法修改 - 您必须删除资源并重新部署才能更改它们。

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "service_BusNamespace_Name": {
      "type": "String",
      "metadata": {
        "description": "Name of the Service Bus namespace"
      }
    },
    "serviceBusTopicName": {
      "type": "String",
      "metadata": {
        "description": "Name of the Topic"
      }
    },
    "serviceBusSubscriptionName": {
      "type": "String",
      "metadata": {
        "description": "Name of the Subscription"
      }
    },
    "location": {
      "defaultValue": "[resourceGroup().location]",
      "type": "String",
      "metadata": {
        "description": "Location for all resources."
      }
    }
  },
  "variables": {
    "defaultSASKey_Name": "RootManageSharedAccessKey",
    "authRuleResource_Id": "[resourceId('Microsoft.ServiceBus/namespaces/authorizationRules', parameters('service_BusNamespace_Name'), variables('defaultSASKey_Name'))]",
    "sbVersion": "2017-04-01"
  },
  "resources": [
    {
      "type": "Microsoft.Resources/deployments",
      "apiVersion": "2015-01-01",
      "name": "updateTopic",
      "properties": {
        "mode": "Incremental",
        "parameters": {},
        "template": {
          "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
          "contentVersion": "1.0.0.0",
          "parameters": {},
          "variables": {},
          "resources": [
            {
              "apiVersion": "2017-04-01",
              "name": "[parameters('service_BusNamespace_Name')]",
              "type": "Microsoft.ServiceBus/namespaces",
              "location": "[parameters('location')]",
              "sku": {
                "name": "Standard"
              },
              "resources": [
                {
                  "apiVersion": "2017-04-01",
                  "name": "[parameters('serviceBusTopicName')]",
                  "type": "Topics",
                  "dependsOn": [
                    "[concat('Microsoft.ServiceBus/namespaces/', parameters('service_BusNamespace_Name'))]"
                  ],
                  "properties": {
                    "defaultMessageTimeToLive": "P10675199DT2H48M5.4775807S",
                    "maxSizeInMegabytes": "1024",
                    "requiresDuplicateDetection": "false",
                    "duplicateDetectionHistoryTimeWindow": "PT10M",
                    "enableBatchedOperations": "false",
                    "supportOrdering": "false",
                    "autoDeleteOnIdle": "P10675199DT2H48M5.4775807S",
                    "enablePartitioning": "false",
                    "enableExpress": "false"
                  }
                }
              ]
            }
          ]
        }
      }
    }
  ],
  "outputs": {
    "NamespaceConnectionString": {
      "type": "String",
      "value": "[listkeys(variables('authRuleResource_Id'), variables('sbVersion')).primaryConnectionString]"
    },
    "SharedAccessPolicyPrimaryKey": {
      "type": "String",
      "value": "[listkeys(variables('authRuleResource_Id'), variables('sbVersion')).primaryKey]"
    }
  }
}

【讨论】:

    【解决方案2】:

    当您请求资源当前状态不允许的操作时,通常会出现“后端冲突”错误。

    例如,将服务总线升级到标准后,如果尝试降级到基本,部署将失败。

    实际上,针对这些情况的唯一解决方案是从头开始重新配置资源。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-16
      • 2013-10-10
      • 1970-01-01
      • 2019-07-25
      • 2018-10-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多