I have an Azure Storage account in WEST US with Geo-Replication enabled to sync with EAST US and I want to perform the failover using the bash script on demand basis.
I have defined the following function
_STORAGE_ACCOUNT_FAILOVER () {
echo "Storage account failover is initiated.."
az storage account failover --name $STORAGEACCOUNT --no-wait --yes
echo "Storage account failover is completed successfully.."
}
while trying to execute the above function, I got the following error
ERROR: (ResourceCollectionRequestsThrottled) Operation 'Microsoft.Storage/storageAccounts/read' failed as server encountered too many requests.
Please try after '17' seconds. Tracking Id is ''.
I want to implement the retry logic incase of any issues? how do I implement the retry logic?
something like
_STORAGE_ACCOUNT_FAILOVER () {
echo "Storage account failover is initiated.."
performFailover:
az storage account failover --name $STORAGEACCOUNT --no-wait --yes
if [ "$?" -ne 0 ]; then
goto performFailover;
fi
echo "Storage account failover is completed successfully.."
}
or something like this
_STORAGE_ACCOUNT_FAILOVER () {
echo "Storage account failover is initiated.."
while true; do
az storage account failover --name $STORAGEACCOUNT --no-wait --yes
if [ "$?" -eq 0 ]; then
break;
fi
sleep 30s
done
echo "Storage account failover is completed successfully.."
}