Skip to content

Commit e1ec26c

Browse files
authored
Fix GenerateSasUri on TableClient from TableServiceClient (Azure#25896)
* GenerateSasCredential on TableClient from TableServiceClient
1 parent 7db825d commit e1ec26c

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

sdk/tables/Azure.Data.Tables/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
### Bugs Fixed
1010
- Fixed a an issue when using `TableEntity.GetDateTime` that resulted in an `InvalidOperationException` exception. ([#25323](https://github.com/Azure/azure-sdk-for-net/issues/25323))
11-
11+
- `TableClient.GenerateSasUri(...)` does not throw if the client was constructed via `TableServiceClient.GetTableClient(string tableName)` ([#25881](https://github.com/Azure/azure-sdk-for-net/issues/25881))
1212
### Other Changes
1313

1414
## 12.3.0 (2021-11-09)

sdk/tables/Azure.Data.Tables/src/TableClient.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ internal TableClient(
318318
ClientDiagnostics diagnostics,
319319
bool isPremiumEndpoint,
320320
Uri endpoint,
321-
HttpPipeline pipeline)
321+
HttpPipeline pipeline,
322+
TableSharedKeyCredential credential)
322323
{
323324
_endpoint = TableUriBuilder.GetEndpointWithoutTableName(endpoint, table);
324325
_tableOperations = tableOperations;
@@ -329,6 +330,7 @@ internal TableClient(
329330
_diagnostics = diagnostics;
330331
_isCosmosEndpoint = isPremiumEndpoint;
331332
_pipeline = pipeline;
333+
_tableSharedKeyCredential = credential;
332334
}
333335

334336
/// <summary>

sdk/tables/Azure.Data.Tables/src/TableServiceClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public virtual TableClient GetTableClient(string tableName)
351351
{
352352
Argument.AssertNotNull(tableName, nameof(tableName));
353353

354-
return new TableClient(tableName, _accountName, _tableOperations, _version, _diagnostics, _isCosmosEndpoint, _endpoint, _pipeline);
354+
return new TableClient(tableName, _accountName, _tableOperations, _version, _diagnostics, _isCosmosEndpoint, _endpoint, _pipeline, _tableSharedKeyCredential);
355355
}
356356

357357
/// <summary>

sdk/tables/Azure.Data.Tables/tests/TableClientTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,11 @@ private static IEnumerable<object[]> TableClients()
483483
$"DefaultEndpointsProtocol=https;AccountName={AccountName};AccountKey={Secret};TableEndpoint=https://{AccountName}.table.cosmos.azure.com:443/;",
484484
TableName);
485485
var devStorageClient = new TableClient("UseDevelopmentStorage=true", TableName);
486+
var fromTableServiceClient = new TableServiceClient(_url, cred).GetTableClient(TableName);
486487
yield return new object[] { sharedKeyClient, cred };
487488
yield return new object[] { connStringClient, cred };
488489
yield return new object[] { devStorageClient, devCred };
490+
yield return new object[] { fromTableServiceClient, cred };
489491
}
490492

491493
[TestCaseSource(nameof(TableClients))]

0 commit comments

Comments
 (0)