diff --git a/src/Storage/Storage.Management/ChangeLog.md b/src/Storage/Storage.Management/ChangeLog.md index fbc7a0e7b84b..55e4583d6922 100644 --- a/src/Storage/Storage.Management/ChangeLog.md +++ b/src/Storage/Storage.Management/ChangeLog.md @@ -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 diff --git a/src/Storage/Storage/Common/StorageCloudCmdletBase.cs b/src/Storage/Storage/Common/StorageCloudCmdletBase.cs index 31e330656f21..3552e302b4df 100644 --- a/src/Storage/Storage/Common/StorageCloudCmdletBase.cs +++ b/src/Storage/Storage/Common/StorageCloudCmdletBase.cs @@ -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); }