<PackageReference Include="Azure.Storage.Common" Version="12.25.0-beta.1" />

GeoRedundantReadPolicy

This policy is used if the SecondaryUri property is passed in on the clientOptions. It allows for storage accounts configured with RA-GRS to retry GET or HEAD requests against the secondary storage Uri.
using Azure.Core; using Azure.Core.Pipeline; using System; namespace Azure.Storage { internal class GeoRedundantReadPolicy : HttpPipelineSynchronousPolicy { private readonly string _secondaryStorageHost; public GeoRedundantReadPolicy(Uri secondaryStorageUri) { if (secondaryStorageUri == (Uri)null) throw Errors.ArgumentNull("secondaryStorageUri"); _secondaryStorageHost = secondaryStorageUri.Host; } public override void OnSendingRequest(HttpMessage message) { if (!(message.Request.Method != RequestMethod.Get) || !(message.Request.Method != RequestMethod.Head)) { object value; string text = message.TryGetProperty("AlternateHostKey", out value) ? (value as string) : null; object value2; if (text == null) message.SetProperty("AlternateHostKey", _secondaryStorageHost); else if (!message.TryGetProperty("ResourceNotReplicated", out value2) || !(bool)value2) { string host = message.Request.Uri.Host; if (message.HasResponse && message.Response.Status == 404 && host == _secondaryStorageHost) message.SetProperty("ResourceNotReplicated", true); message.Request.Uri.Host = text; message.SetProperty("AlternateHostKey", host); } } } } }