Skip to content

Fix issues in migrate to file track2 #19622

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Storage/Storage/Common/AzureStorageFileShare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ public static ShareClient GetTrack2FileShareClient(CloudFileShare cloudFileShare
else if (cloudFileShare.ServiceClient.Credentials.IsSharedKey) //Shared Key
{
fileShareClient = new ShareClient(cloudFileShare.SnapshotQualifiedUri,
new StorageSharedKeyCredential(context.StorageAccountName, cloudFileShare.ServiceClient.Credentials.ExportBase64EncodedKey()), clientOptions);
new StorageSharedKeyCredential(cloudFileShare.ServiceClient.Credentials.AccountName, cloudFileShare.ServiceClient.Credentials.ExportBase64EncodedKey()), clientOptions);
}
else //Anonymous
{
Expand Down
6 changes: 6 additions & 0 deletions src/Storage/Storage/File/Cmdlet/RemoveAzureStorageShare.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ public override void ExecuteCmdlet()
else
{
share = AzureStorageFileShare.GetTrack2FileShareClient(this.Share, (AzureStorageContext)this.Context, this.ClientOptions);

// when only track1 object input, will miss storage context, so need to build storage context for prepare the output object.
if (this.Context == null)
{
this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext);
}
}
break;

Expand Down
10 changes: 8 additions & 2 deletions src/Storage/Storage/File/Cmdlet/SetAzureStorageShareQuota.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@ public override void ExecuteCmdlet()
break;

case Constants.ShareParameterSetName:
share = AzureStorageFileShare.GetTrack2FileShareClient(this.Share, (AzureStorageContext)this.Context, this.ClientOptions);
share = AzureStorageFileShare.GetTrack2FileShareClient(this.Share, (AzureStorageContext)this.Context, this.ClientOptions);

// when only track1 object input, will miss storage context, so need to build storage context for prepare the output object.
if (this.Context == null)
{
this.Context = GetStorageContextFromTrack1FileServiceClient(this.Share.ServiceClient, DefaultContext);
}
break;

default:
Expand All @@ -88,7 +94,7 @@ public override void ExecuteCmdlet()
shareProperties = share.GetProperties(this.CmdletCancellationToken).Value;
}

WriteObject( new AzureStorageFileShare(share, this.Channel.StorageContext, shareProperties, ClientOptions));
WriteObject( new AzureStorageFileShare(share, (AzureStorageContext)this.Context, shareProperties, ClientOptions));
}
}
}