Azure / azure-cosmos-table-dotnet

.NET SDK for Azure Cosmos Table API
14 stars 6 forks source link

TableClient.StorageUri.SecondaryUri is null when using SAS connectionString #36

Closed golfalot closed 4 years ago

golfalot commented 4 years ago

Firstly may I state the problem DOES NOT occur when using master connection string from the storage account

** SDK version 1.0.6

** Issue reproduce steps StorageV2 (general purpose v2), Read-access geo-redundant storage (RA-GRS) Generate a SAS key with permissions as follows Allowed services: Table Allowed resource types: Object Allowed permissions: Read CloudStorageAccount storageAccount = CloudStorageAccount.Parse(SASconnectionString);
CloudTableClient tableClient = storageAccount.CreateCloudTableClient(new TableClientConfiguration());

inspect tableClient .StorageUri.SecondaryUri OR use TableRequestOptions.LocationMode.SecondaryOnly to force Exception

** Whether the issue is consistent or sporadic consistent

** Environment .Net Framework 4.7.2 connection string format is: BlobEndpoint=https://.blob.core.windows.net/;QueueEndpoint=https://.queue.core.windows.net/;FileEndpoint=https://.file.core.windows.net/;TableEndpoint=https://.table.core.windows.net/;SharedAccessSignature=

** Any other context, such as stack trace or log.

Possibly related to https://github.com/Azure/azure-storage-net/issues/948

golfalot commented 4 years ago

workaround using a tweaked connection string SecondaryUri is successfully populated

DefaultEndpointsProtocol=https;AccountName=;SharedAccessSignature=;EndpointSuffix=core.windows.net

Side note: the connection string format in my initial issue was generated using Azure Portal.

golfalot commented 4 years ago

workaround fail! Although SecondaryUri now has the expected Uri value, an exception is thrown Microsoft.Azure.Cosmos.Table.StorageException This operation can only be executed against the primary storage location.

When attempting to TableOperation retrieveOperation = TableOperation.Retrieve<CombinedLocationDataEntityConfiguration>(partitionKey, rowKey); TableResult tableResult = table.Execute(retrieveOperation);

sakash279 commented 4 years ago

@golfalot - this issue should be fixed in v1.0.8. Please give it a try, and confirm if you're able to retrieve from the secondary endpoint in table storage. https://docs.microsoft.com/en-us/azure/cosmos-db/table-sdk-dotnet-standard