gpt4 book ai didi

visual-studio - Azure 服务总线 - ARM 模板(更新现有主题参数)

转载 作者:行者123 更新时间:2023-12-03 02:49:17 27 4
gpt4 key购买 nike

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

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

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

最佳答案

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]"
}
}
}

关于visual-studio - Azure 服务总线 - ARM 模板(更新现有主题参数),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56966945/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com