azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[BUG] Null Response returned while trying to retrieve GeoReplicationStatistics property from StorageAccount

Open svangipurapu-msft opened this issue 2 years ago • 4 comments

Library name and version

Azure.ResourceManager.Storage v1.1.0

Describe the bug

Hi,

I am getting null response while trying to retrieve LastSyncTime property of a storage account. The LastSyncOn roperty is part of GeoReplicationStatistics class under the StorageAccountData

I want to perform a failover action on a storage account for which I have to verify if LastSyncOn property is available before I trigger a failover action. But I see that GeoReplicationStats is retruned as null.

image

Expected behavior

When retrieving StorageAccountData.GeoiRelicationStats it should return an object which has information about the following properties

  1. CanFailover
  2. LastSyncOn
  3. Status https://learn.microsoft.com/en-us/dotnet/api/azure.resourcemanager.storage.models.georeplicationstatistics?view=azure-dotnet

Actual behavior

Getting a null response while trying to retrieve StorageAccountData.GeoRelicationStats

Reproduction Steps

For any storage account. Try accessing StorageAccountData and retrieve GeoReplicationStats propery.

StorageAccountResource.Data.GeoReplicationStats

Environment

No response

svangipurapu-msft avatar Feb 09 '23 21:02 svangipurapu-msft

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Feb 09 '23 22:02 jsquire

@svangipurapu-msft

When you retrieve the storage account from server, have you added the StorageAccountExpand.GeoReplicationStats. The GeoReplicationStats won't be returned from server until you add this parameter like following code:

StorageAccountResource account2 = await storageAccountCollection.GetAsync(accountName, StorageAccountExpand.GeoReplicationStats)

blueww avatar Feb 10 '23 02:02 blueww

@blueww

Thanks for the suggestion. I havent added it earlier. I modified my code and included StorageAccountExpand.GeoReplicationStats as below

Response<StorageAccountResource> operationResponse = await armClient.GetStorageAccountResource(new ResourceIdentifier(targetInfo.ResourceId)).GetAsync(StorageAccountExpand.GeoReplicationStats).ConfigureAwait(false);

Now this is throwing an exception when running this operation on a Storage account with SKU type as Standard_LRS. Is this an expected error? It is working fine, when running against a Storage Account with sku type as RA_GRS. Is it because Geo Replication Stats are only available for GRS account types?

svangipurapu-msft avatar Feb 10 '23 19:02 svangipurapu-msft

@svangipurapu-msft

Yes, Geo Replication Stats are only available for GRS account types.

blueww avatar Feb 14 '23 02:02 blueww

Thanks for the confirmation

svangipurapu-msft avatar Feb 14 '23 21:02 svangipurapu-msft

@svangipurapu-msft

As your issue is already resolved, I will close this issue. Feel free to contact us again if need any assistance on Azure .net SDK.

blueww avatar Feb 15 '23 02:02 blueww