Invokes failover of a Storage account. Failover request can be triggered for a storage account in case of availability issues.
The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover.
Please understand the following impact to your storage account before you initiate the failover:
1.1. Please check the Last Sync Time using GET Blob Service Stats (https://learn.microsoft.com/rest/api/storageservices/get-blob-service-stats), GET Table Service Stats (https://learn.microsoft.com/rest/api/storageservices/get-table-service-stats) and GET Queue Service Stats (https://learn.microsoft.com/rest/api/storageservices/get-queue-service-stats) for your account. This is the data you may lose if you initiate the failover.
2.After the failover, your storage account type will be converted to locally redundant storage(LRS). You can convert your account to use geo-redundant storage(GRS).
3.Once you re-enable GRS for your storage account, Microsoft will replicate data to your new secondary region. Replication time is dependent on the amount of data to replicate. Please note that there are bandwidth charges for the bootstrap. https://azure.microsoft.com/en-us/pricing/details/bandwidth/
Examples
Example 1: Invoke failover of a Storage account
$account = Get-AzStorageAccount -ResourceGroupName "MyResourceGroup" -Name "mystorageaccount" -IncludeGeoReplicationStats
$account.GeoReplicationStats
Status LastSyncTime
------ ------------
Live 11/13/2018 2:44:22 AM
$job = Invoke-AzStorageAccountFailover -ResourceGroupName "MyResourceGroup" -Name "mystorageaccount" -Force -AsJob
$job | Wait-Job
This command check the last sync time of a Storage account then invokes failover of it, the secondary cluster will become primary after failover. Since failover takes a long time, suggest to run it in the backend with -Asjob parameter, and then wait for the job complete.
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.