From fce9baecbb2e8bbb452daa85b5dc223c1f812688 Mon Sep 17 00:00:00 2001 From: Amanda Nguyen Date: Wed, 6 Nov 2024 16:18:44 -0800 Subject: [PATCH 1/2] On default using Entra ID with Share File will set the ShareFileIntent header --- .../src/ShareFilesStorageResourceProvider.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFilesStorageResourceProvider.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFilesStorageResourceProvider.cs index 16395130b57b6..6cadc20176d80 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFilesStorageResourceProvider.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFilesStorageResourceProvider.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Storage.Files.Shares; +using Azure.Storage.Files.Shares.Models; namespace Azure.Storage.DataMovement.Files.Shares { @@ -300,7 +301,10 @@ public StorageResource FromDirectory(Uri directoryUri, ShareFileStorageResourceO { CredentialType.None => new ShareDirectoryClient(directoryUri), CredentialType.SharedKey => new ShareDirectoryClient(directoryUri, _getStorageSharedKeyCredential(directoryUri, false)), - CredentialType.Token => new ShareDirectoryClient(directoryUri, _getTokenCredential(directoryUri, false)), + CredentialType.Token => new ShareDirectoryClient( + directoryUri, + _getTokenCredential(directoryUri, false), + new ShareClientOptions { ShareTokenIntent = ShareTokenIntent.Backup }), CredentialType.Sas => new ShareDirectoryClient(directoryUri, _getAzureSasCredential(directoryUri, false)), _ => throw BadCredentialTypeException(_credentialType), }; @@ -327,7 +331,10 @@ public StorageResource FromFile( { CredentialType.None => new ShareFileClient(fileUri), CredentialType.SharedKey => new ShareFileClient(fileUri, _getStorageSharedKeyCredential(fileUri, false)), - CredentialType.Token => new ShareFileClient(fileUri, _getTokenCredential(fileUri, false)), + CredentialType.Token => new ShareFileClient( + fileUri, + _getTokenCredential(fileUri, false), + new ShareClientOptions { ShareTokenIntent = ShareTokenIntent.Backup }), CredentialType.Sas => new ShareFileClient(fileUri, _getAzureSasCredential(fileUri, false)), _ => throw BadCredentialTypeException(_credentialType), }; From a6543eaafe0cbcc695dfbcab249207668b7f84c5 Mon Sep 17 00:00:00 2001 From: Amanda Nguyen Date: Thu, 7 Nov 2024 14:35:46 -0800 Subject: [PATCH 2/2] Extra whitespace --- .../src/ShareFilesStorageResourceProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFilesStorageResourceProvider.cs b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFilesStorageResourceProvider.cs index 6cadc20176d80..d7eccdafdffbb 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFilesStorageResourceProvider.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Files.Shares/src/ShareFilesStorageResourceProvider.cs @@ -304,7 +304,7 @@ public StorageResource FromDirectory(Uri directoryUri, ShareFileStorageResourceO CredentialType.Token => new ShareDirectoryClient( directoryUri, _getTokenCredential(directoryUri, false), - new ShareClientOptions { ShareTokenIntent = ShareTokenIntent.Backup }), + new ShareClientOptions { ShareTokenIntent = ShareTokenIntent.Backup }), CredentialType.Sas => new ShareDirectoryClient(directoryUri, _getAzureSasCredential(directoryUri, false)), _ => throw BadCredentialTypeException(_credentialType), };