简体   繁体   English

如何删除和重命名已在 Azure 服务总线命名空间中创建的订阅筛选器?

[英]How to delete and rename subscription filters that have already been created in the Azure Service Bus Namespace?

I have created a Service Bus Namespace in Azure using the ARM template.我使用 ARM 模板在 Azure 中创建了一个服务总线命名空间。 In that I have created multiple topics and subscriptions along with filters.为此,我创建了多个主题和订阅以及过滤器。

"type": "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules",
        "apiVersion": "2021-06-01-preview",
        "name": "[concat(parameters('servicebus_name'), '/XXXXXXXXXXXXX/XXXXXXXXXXXXX/XXXXXXXXXXXXX')]",
        "location": "[parameters('location')]",
        "dependsOn": [
            "[resourceId('Microsoft.ServiceBus/namespaces/topics/subscriptions', parameters('servicebus_name'), 'XXXXXXXXXXXXX', 'XXXXXXXXXXXXX')]",
            "[resourceId('Microsoft.ServiceBus/namespaces/topics', parameters('servicebus_name'), 'XXXXXXXXXXXXX)]",
            "[resourceId('Microsoft.ServiceBus/namespaces', parameters('servicebus_name'))]"
        ],
        "properties": {
            "action": {},
            "filterType": "CorrelationFilter",
            "correlationFilter": {
                "label": "XXXXXXXXXXXXX"
            }            
        }
    }

I tried to delete the few filters by removing the code from the ARM template.我试图通过从 ARM 模板中删除代码来删除少数过滤器。 But still, those filters will exist in the Azure portal.但是,这些过滤器仍将存在于 Azure 门户中。 and also tried to rename the few filters by changing the names of the filters, but the names couldn't be changed.并且还尝试通过更改过滤器的名称来重命名少数过滤器,但是无法更改名称。

I want to delete a few filters and rename a few filters (Filter Type: Correlation Filter).我想删除几个过滤器并重命名几个过滤器(过滤器类型:相关过滤器)。

Is it possible to delete the filters and rename the filters using the ARM template?是否可以使用 ARM 模板删除过滤器并重命名过滤器?

Note: I don't want to use complete deployment mode to deploy the Service Bus ARM template.注意:我不想使用完全部署模式来部署服务总线 ARM 模板。

Approach-1:方法一:

  1. Created filters.(Demo123PRADEEP, Demo456PRADEEP,Demo111PRADEEP)创建过滤器。(Demo123PRADEEP、Demo456PRADEEP、Demo111PRADEEP)
  2. Deployed the initial ARM template.部署初始 ARM 模板。
  3. Changed the names of the above filters, Demo123PRADEEP and Demo456PRADEEP, to Demo123 Pradeep and Demo456 Pradeep , respectively.将上述过滤器的名称 Demo123PRADEEP 和 Demo456PRADEEP 分别更改为 Demo123 Pradeep和 Demo456 Pradeep
  4. Removed the Demo111PRADEEP filter code from the ARM template.从 ARM 模板中删除了 Demo111PRADEEP 过滤器代码。
  5. Re-applied all of the changes.重新应用所有更改。
  6. Filter names can't be updated, and the above two filters are not deleted.过滤器名称无法更新,上面两个过滤器没有被删除。

Is it possible to delete the filters and rename the filters using the ARM template?是否可以使用 ARM 模板删除过滤器并重命名过滤器?

In my view Yes, it's possible.在我看来,是的,这是可能的。 Please try to modify existing resources using ARM template as mentioned below.请尝试使用 ARM 模板修改现有资源,如下所述。

  1. Export the template from the Azure Portal.从 Azure 门户导出模板。

  2. Then download it locally.然后下载到本地。

  3. Then modify it to update settings for filters.然后修改它以更新过滤器的设置。

  4. Reapply 重新申请

NOTE: ARM will not recreate the existing resource, if it was already specified in the template.注意:ARM 不会重新创建现有资源,如果它已在模板中指定。 Only its update the resource if the property values for a resource are changed.如果资源的属性值发生变化,它只会更新资源。 refer document .参考文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM