Check the Last Sync Time property for a storage account

Geo-replication offers durability for your data, even during natural disasters and other significant outages in your primary region. When you configure a storage account, you can choose to have your data copied to a secondary region that is hundreds of miles from the primary region. In addition, you can choose to enable read access to the secondary region, ensuring that your data remains available for read operations if the primary region becomes unavailable. This approach enables you to design your highly available application to switch seamlessly to reading from the secondary region if the primary region is unresponsive.

Geo-redundant storage (GRS) and geo-zone-redundant storage (GZRS) both replicate your data asynchronously to a secondary region. For read access to the secondary region, enable read-access geo-redundant storage (RA-GRS) or read-access geo-zone-redundant storage (RA-GZRS). For more information about the various options for redundancy offered by Azure Storage, see Azure Storage redundancy.

This article describes how to check the Last Sync Time property for your storage account so that you can evaluate any discrepancy between the primary and secondary regions.

About the Last Sync Time property

Because geo-replication is asynchronous, it's possible that data written to the primary region hasn't yet been written to the secondary region at the time an outage occurs. The Last Sync Time property indicates the most recent time that data from the primary region is guaranteed to have been written to the secondary region. For accounts that have a hierarchical namespace, the same Last Sync Time property also applies to the metadata managed by the hierarchical namespace, including ACLs. All data and metadata written prior to the last sync time is available on the secondary, while data and metadata written after the last sync time may not have been written to the secondary, and may be lost. Use this property in the event of an outage to estimate the amount of data loss you may incur by initiating a customer-managed (unplanned) failover.

The Last Sync Time property is a GMT date/time value.

Get the Last Sync Time property

You can use PowerShell or Azure CLI to retrieve the value of the Last Sync Time property.

To get the last sync time for the storage account with PowerShell, install version 1.11.0 or later of the Az.Storage module. Then check the storage account's GeoReplicationStats.LastSyncTime property. Remember to replace the placeholder values with your own values:

$lastSyncTime = $(Get-AzStorageAccount -ResourceGroupName <resource-group> `
    -Name <storage-account> `
    -IncludeGeoReplicationStats).GeoReplicationStats.LastSyncTime

See also