1

I have created a Service Bus Namespace in Azure using the ARM template. 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. But still, those filters will exist in the Azure portal. 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?

Note: I don’t want to use complete deployment mode to deploy the Service Bus ARM template.

Approach-1:

  1. Created filters.(Demo123PRADEEP, Demo456PRADEEP,Demo111PRADEEP)
  2. Deployed the initial ARM template.
  3. Changed the names of the above filters, Demo123PRADEEP and Demo456PRADEEP, to Demo123Pradeep and Demo456Pradeep, respectively.
  4. Removed the Demo111PRADEEP filter code from the ARM template.
  5. Re-applied all of the changes.
  6. Filter names can't be updated, and the above two filters are not deleted.
Pradeep
  • 5,101
  • 14
  • 68
  • 140
  • If you don't want to use complete mode, you cannot do this using ARM only. – Peter Bons Jan 09 '23 at 10:51
  • @PeterBons, If I use the complete mode, how do I manage the existing resources that I manually created using the Azure portal? – Pradeep Jan 09 '23 at 10:57
  • Either recreate the manual created resources using ARM or put the service bus in a separate resource group so you can use the complete mode ARM deployment to that resource group – Peter Bons Jan 09 '23 at 11:12

1 Answers1

-1

Is it possible to delete the filters and rename the filters using the ARM template?

In my view Yes, it's possible. Please try to modify existing resources using ARM template as mentioned below.

  1. Export the template from the Azure Portal.

  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. Only its update the resource if the property values for a resource are changed. refer document.

Got one more way to update a resource in an Azure Resource Manager template using PowerShell with ARM, here is the reference tutorial.

once template is ready, we can run below commands.

az group create --location <location> --name <resource-group-name>
az deployment group create -g <resource-group-name> \
    --template-uri https://*************/deploy.json
Swarna Anipindi
  • 792
  • 2
  • 9