1

In MS docs for AzureCLI, we couldn't find, az command to do perform the Switchover activity from our primary Service Bus to the Secondary Service Bus.

We are performing, below activities as part of the switchover and couldn't find the required AZ commands to fulfill our requirements.

Task 1. Re-initiate the Pairing with secondary namespace (for which the alias already present, for which we already have the alias created). Here we cold find only to create a new paring , but not with existing.

az servicebus georecovery-alias create --alias <prim-second-existing alias-name> --namespace-name <primary-sb-namespace-name> --partner-namespace <secondary-sb-namespace-name>  --resource-group <primary-sb-namespace-RGName>

Perform Failover:-

az servicebus georecovery-alias fail-over <prim-second-existing alias-name> --ids <secondary-sb-namespace-name>  --is-safe-failover y -namespace-name <primary-sb-namespace-name> --resource-group <primary-sb-namespace-RGName>

task3:- Once Failover done, Delete Ques and topics from the Primary-SB-instance Namespace. Here how to find the pending ques and topics in the primary instance to set it for deletion

    az servicebus topic delete --ids pending-TopicIds --name yyyy --namespace-name <primary-sb-namespace-name> --resource-group <primary-sb-namespace-RGName> --subscription ssssss

For ques

    az servicebus queue delete --ids pending-queids --name que-name --namespace-name <primary-sb-namespace-name> --resource-group <primary-sb-namespace-RGName> --subscription ssssssss
1

1 Answer 1

1

Azure service Bus geo-recovery automation using AZ bash commands:

Firstly, I have created an alias for disaster recovery configuration of a service bus namespace with the partner namespace as shown below.

enter image description here

Now before reinitiating the pair, use az servicebus georecovery-alias break-pair bash command to disable the disaster recovery existed alias configuration for avoiding conflicts.

az servicebus georecovery-alias break-pair --alias newaliaas --namespace-name bus1jah --resource-group xxxx

enter image description here

Once it is disabled, now again set it with the new alias or the same alias with the az servicebus georecovery-alias set as shown.

 az servicebus georecovery-alias set --resource-group xxxx --namespace-name bus1jah --alias newaliaas --partner-namespace <ResourceID of partner service bus namespace>

enter image description here

Note:

If you wanted to check the existed or recently created alias under a service bus namespace, use below command to list it out.

az servicebus georecovery-alias list --namespace-name bus1jah --resource-group xxxx 

Now you can go ahead with the other tasks like fail over as well as deleting the topics or queues according to your requirement with the corresponding commands.

az servicebus georecovery-alias fail-over --alias newaliaas --namespace-name bus2new --resource-group xxxx

az servicebus queue delete

enter image description here

Refer MS Doc for Az bash commands az servicebus georecovery-alias.

Sign up to request clarification or add additional context in comments.

5 Comments

But here the failover command bit confusing..
But here the failover command bit confusing.. "az servicebus georecovery-alias fail-over --alias xxxx --ids xxxxxx --is-safe-failover y --namespace-name xxxxxx --resource-group --subscription ". here id , namespace, RG, subscription etc are belongs to primary instance or secondary insatnce?
--name is primary-second-existing alias-name --namespace-name is secondary-service bus-namespace-name --resource-group xx. @Vowneee
Thanks.. so the --id is optional and , RG and Subscription is of secondary instance here?
Yes correct. @Vowneee

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.