Azure / azure-service-bus

☁️ Azure Service Bus service issue tracking and samples
https://azure.microsoft.com/services/service-bus
MIT License
580 stars 775 forks source link

Azure service Bus geo-recovery automation using az bash commands #699

Closed vivuu1989 closed 4 months ago

vivuu1989 commented 4 months ago

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
EldertGrootenboer commented 4 months ago

All the az commands can be found at https://learn.microsoft.com/en-us/cli/azure/servicebus?view=azure-cli-latest. In short, if you want to do a failover and set up GeoDR again, you would follow the following steps:

That said, we are working on a new GeoDR feature, which will make this process easier.