Get Azure Storage Account GRS Replication Status using PowerShell and Azure Portal

by Bharat Suneja

You can use Azure Geo-Redundant Storage (GRS) to replicate a storage account to another Azure region. In the rare event of a catastrophic failure where the entire Azure region (with multiple zones) has an outage, you can fail over the storage account to the secondary region. Much like an Exchange geo-cluster. Failover is initiated manually.

The replicated copy in the secondary region, which is selected automatically by Azure when you set up the storage account, will not always be up-to-date. The LastSyncTime property of the storage account provide an indication of the lag, which can help you decide whether to fail over to the secondary region.

LastSyncTime is displayed in the storage account > properties > Geo-replication page, but it’s hidden away in the Failover blade. Click the Prepare for failover button to reveal it.


Figure 1: The Azure storage account’s Geo-replication page shows the Last Sync Time. (Click image for a larger version.)

This PowerShell command displays the LastSyncTime.

(Get-AzStorageAccount -ResourceGroupName <resource group name> -Name <storage account name> -IncludeGeoReplicationStats).GeoReplicationStats.LastSyncTime

You can omit the LastSyncTime to have display the two other properties – status and CanFailover.

(Get-AzStorageAccount -ResourceGroupName <resource group name> -Name <storage account name> -IncludeGeoReplicationStats).GeoReplicationStats.LastSyncTime

If you use this frequently, add it as a function to your PowerShell profile. For example:

Function GRSStats {
(Get-AzStorageAccount -ResourceGroupName <resource group name> -Name <storage account name> -IncludeGeoReplicationStats).GeoReplicationStats     
}

{ 0 comments… add one now }

Leave a Comment

Previous post:

Next post: