Skip to content

Commit

Permalink
[Storage] Fixed issue that table cmdlet fail when execute with Storag…
Browse files Browse the repository at this point in the history
…e context get from StorageAccount object and based on sharedkey authentication. (#26014)
  • Loading branch information
blueww authored Sep 5, 2024
1 parent f7fa73d commit 773a148
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
- Additional information about change #1
-->
## Upcoming Release
* Updated Storage account cmdlet output context based on OAuth token
* Fixed issue that table cmdlet fail when execute with Storage context get from StorageAccount object and based on sharedkey authentication.
* Refined Storage account cmdlet output context generation function based on OAuth token

## Version 7.3.0
* Supported account tier Cold
Expand Down
4 changes: 3 additions & 1 deletion src/Storage/Storage/Common/StorageCloudCmdletBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ internal AzureStorageContext GetCmdletStorageContext(bool outputErrorMessage = t
internal AzureStorageContext GetCmdletStorageContext(IStorageContext inContext, bool outputErrorMessage = true)
{
var context = inContext as AzureStorageContext;
if (context == null && inContext != null)

// if TableStorageAccount == null and not using Oauth, need create the TableStorageAccount track1 object for table cmdlets.
if ((context == null && inContext != null) || (context.TableStorageAccount == null && context.StorageAccount != null && context.StorageAccount.Credentials != null && !context.StorageAccount.Credentials.IsToken))
{
context = new AzureStorageContext(inContext.GetCloudStorageAccount(), null, DefaultContext, WriteDebug);
}
Expand Down

0 comments on commit 773a148

Please sign in to comment.