I have created two Premium Azure Cache for Redis resources and set up geo replication. There is a button in the portal to failover manually.
How can I trigger this failover with Azure CLI?
I tried the az redis force-reboot --resource-group $resourceGroupName --name $redisPrimary --reboot-type $rebootType command to no avail.
I did it in PowerShell by breaking the (geo-replication) link between de caches and then re-creating it, making sure to reverse the primary and secondary cache.
Use the provisioning state to monitor the state after deleting or creating the link:
One gotcha, after removing the link
Remove-AzRedisCacheLinkand trying to create a new oneNew-AzRedisCacheLink, an error might occur even though the provisioning state will report 'Succeeded'. Error message:Operation returned an invalid status code 'Conflict'.In this case I created a while loop that breaks when the
New-AzRedisCacheLinkreturns no error: