Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions src/Storage/Storage.Management/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
-->
## Upcoming Release
* Updated Azure.Core to 1.34.0.
* Added support for encryption context
- `New-AzDataLakeGen2Item`


## Version 5.9.0
* Supported OAuth authentication on File service cmdlets
Expand Down
16 changes: 12 additions & 4 deletions src/Storage/Storage/DatalakeGen2/Cmdlet/NewAzDataLakeGen2Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ public string Source
[ValidatePattern("([r-][w-][x-]){2}([r-][w-][xtT-])")]
public string Permission { get; set; }

[Parameter(Mandatory = false,
HelpMessage = "Encryption context of the file. Encryption context is metadata that is not encrypted when stored on the file. The primary application of this field is to store non-encrypted data that can be used to derive the customer-provided key for a file. Not applicable for directories.",
ParameterSetName = FileParameterSet)]
public string EncryptionContext { get; set; }

[Parameter(HelpMessage = "Specifies properties for the created directory or file. "+
"The supported properties for file are: CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, ContentMD5, ContentType." +
Expand Down Expand Up @@ -213,9 +217,12 @@ public override void ExecuteCmdlet()
DataLakeFileClient fileClient = fileSystem.GetFileClient(this.Path);
if (ShouldProcess(GetDataLakeItemUriWithoutSas(fileClient), "Create File: "))
{
// Use SDK to upload directly when use SAS credential, and need set permission, since set permission after upload will fail with SAS
if (Channel.StorageContext.StorageAccount != null && Channel.StorageContext.StorageAccount.Credentials != null &&
Channel.StorageContext.StorageAccount.Credentials.IsSAS && (!string.IsNullOrEmpty(this.Permission) || !string.IsNullOrEmpty(this.Umask)))
// Use SDK to upload directly when
// 1. use SAS credential, and need set permission, since set permission after upload will fail with SAS, or
// 2. file encryption context is set by user
if ((Channel.StorageContext.StorageAccount != null && Channel.StorageContext.StorageAccount.Credentials != null &&
Channel.StorageContext.StorageAccount.Credentials.IsSAS && (!string.IsNullOrEmpty(this.Permission) || !string.IsNullOrEmpty(this.Umask))) ||
this.EncryptionContext != null)
{
Func<long, Task> taskGenerator = (taskId) => UploadDataLakeFile(taskId, fileClient, ResolvedFileName);
RunTask(taskGenerator);
Expand Down Expand Up @@ -271,7 +278,8 @@ await fileClient.UploadAsync(ResolvedFileName,
Permissions = this.Permission,
Umask = this.Umask != null ? DataLakeModels.PathPermissions.ParseSymbolicPermissions(this.Umask).ToOctalPermissions() : null,
ProgressHandler = progressHandler,
HttpHeaders = pathHttpHeaders
HttpHeaders = pathHttpHeaders,
EncryptionContext = this.EncryptionContext
},
this.CmdletCancellationToken).ConfigureAwait(false);

Expand Down
8 changes: 4 additions & 4 deletions src/Storage/Storage/Storage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

<ItemGroup>
<PackageReference Include="Azure.Data.Tables" Version="12.8.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.16.0" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.14.0" />
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.14.0" />
<PackageReference Include="Azure.Storage.Queues" Version="12.14.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.17.0" />
Comment thread
yifanz7 marked this conversation as resolved.
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.15.0" />
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.15.0" />
<PackageReference Include="Azure.Storage.Queues" Version="12.15.0" />
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.8" />
<PackageReference Include="System.Security.Permissions" Version="4.7.0" />
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.2.2" />
Expand Down