Skip to content

Commit 773a148

Browse files
authored
[Storage] Fixed issue that table cmdlet fail when execute with Storage context get from StorageAccount object and based on sharedkey authentication. (#26014)
1 parent f7fa73d commit 773a148

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Storage/Storage.Management/ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21-
* Updated Storage account cmdlet output context based on OAuth token
21+
* Fixed issue that table cmdlet fail when execute with Storage context get from StorageAccount object and based on sharedkey authentication.
22+
* Refined Storage account cmdlet output context generation function based on OAuth token
2223

2324
## Version 7.3.0
2425
* Supported account tier Cold

src/Storage/Storage/Common/StorageCloudCmdletBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,9 @@ internal AzureStorageContext GetCmdletStorageContext(bool outputErrorMessage = t
278278
internal AzureStorageContext GetCmdletStorageContext(IStorageContext inContext, bool outputErrorMessage = true)
279279
{
280280
var context = inContext as AzureStorageContext;
281-
if (context == null && inContext != null)
281+
282+
// if TableStorageAccount == null and not using Oauth, need create the TableStorageAccount track1 object for table cmdlets.
283+
if ((context == null && inContext != null) || (context.TableStorageAccount == null && context.StorageAccount != null && context.StorageAccount.Credentials != null && !context.StorageAccount.Credentials.IsToken))
282284
{
283285
context = new AzureStorageContext(inContext.GetCloudStorageAccount(), null, DefaultContext, WriteDebug);
284286
}

0 commit comments

Comments
 (0)