Skip to content

Commit 43bd025

Browse files
bluewwdingmeng-xue
andauthored
[Storage] Support dfs sas encryptionscope (Azure#19814)
* Upgrade to new storage dataplane SDK * [Storage] Support dfs sas encryptionscope * Update DependencyAnalyzer.cs (#21) Co-authored-by: Dingmeng Xue <[email protected]>
1 parent cc9af65 commit 43bd025

File tree

7 files changed

+51
-17
lines changed

7 files changed

+51
-17
lines changed

src/Storage/Storage.Management.Test/Storage.Management.Test.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Azure.Storage.Blobs" Version="12.12.0" />
15-
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.10.0" />
16-
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.10.0" />
17-
<PackageReference Include="Azure.Storage.Queues" Version="12.10.0" />
14+
<PackageReference Include="Azure.Storage.Blobs" Version="12.14.0" />
15+
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.12.0" />
16+
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.12.0" />
17+
<PackageReference Include="Azure.Storage.Queues" Version="12.12.0" />
1818
</ItemGroup>
1919

2020
<ItemGroup>

src/Storage/Storage.Management/ChangeLog.md

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Supported generate DataLakeGen2 Sas token with Encryption scope
22+
- `New-AzDataLakeGen2SasToken`
2123
* Supported blob type conversions in sync blob copy
2224
- `Copy-AzStorageBlob`
2325
* Supported create/upgrade storage account with Keyvault from another tenant and access Keyvault with FederatedClientId

src/Storage/Storage.Management/help/New-AzDataLakeGen2SasToken.md

+20-5
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ Generates a SAS token for Azure DatalakeGen2 item.
1616
```
1717
New-AzDataLakeGen2SasToken [-FileSystem] <String> [-Path <String>] [-Permission <String>]
1818
[-Protocol <SasProtocol>] [-IPAddressOrRange <String>] [-StartTime <DateTimeOffset>]
19-
[-ExpiryTime <DateTimeOffset>] [-FullUri] [-Context <IStorageContext>]
19+
[-ExpiryTime <DateTimeOffset>] [-EncryptionScope <String>] [-FullUri] [-Context <IStorageContext>]
2020
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2121
```
2222

2323
### ItemPipeline
2424
```
2525
New-AzDataLakeGen2SasToken -InputObject <AzureDataLakeGen2Item> [-Permission <String>]
2626
[-Protocol <SasProtocol>] [-IPAddressOrRange <String>] [-StartTime <DateTimeOffset>]
27-
[-ExpiryTime <DateTimeOffset>] [-FullUri] [-Context <IStorageContext>]
27+
[-ExpiryTime <DateTimeOffset>] [-EncryptionScope <String>] [-FullUri] [-Context <IStorageContext>]
2828
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
2929
```
3030

@@ -40,12 +40,12 @@ New-AzDataLakeGen2SasToken -FileSystem "filesystem1" -Path "dir1/dir2" -Permissi
4040

4141
This example generates a DatalakeGen2 SAS token with full permission.
4242

43-
### Example 2: Generate a SAS token with specific StartTime, ExpireTime, Protocal, IPAddressOrRange, by pipeline a datalakegen2 item
43+
### Example 2: Generate a SAS token with specific StartTime, ExpireTime, Protocal, IPAddressOrRange, Encryption Scope, by pipeline a datalakegen2 item
4444
```
45-
Get-AzDataLakeGen2Item -FileSystem test -Path "testdir/dir2" | New-AzDataLakeGen2SasToken -Permission rw -Protocol Https -IPAddressOrRange 10.0.0.0-12.10.0.0 -StartTime (Get-Date) -ExpiryTime (Get-Date).AddDays(6)
45+
Get-AzDataLakeGen2Item -FileSystem test -Path "testdir/dir2" | New-AzDataLakeGen2SasToken -Permission rw -Protocol Https -IPAddressOrRange 10.0.0.0-12.10.0.0 -StartTime (Get-Date) -ExpiryTime (Get-Date).AddDays(6) -EncryptionScope scopename
4646
```
4747

48-
This example generates a DatalakeGen2 SAS token by pipeline a datalake gen2 item, and with specific StartTime, ExpireTime, Protocal, IPAddressOrRange.
48+
This example generates a DatalakeGen2 SAS token by pipeline a datalake gen2 item, and with specific StartTime, ExpireTime, Protocal, IPAddressOrRange, Encryption Scope.
4949

5050
## PARAMETERS
5151

@@ -79,6 +79,21 @@ Accept pipeline input: False
7979
Accept wildcard characters: False
8080
```
8181
82+
### -EncryptionScope
83+
Encryption scope to use when sending requests authorized with this SAS URI.
84+
85+
```yaml
86+
Type: System.String
87+
Parameter Sets: (All)
88+
Aliases:
89+
90+
Required: False
91+
Position: Named
92+
Default value: None
93+
Accept pipeline input: False
94+
Accept wildcard characters: False
95+
```
96+
8297
### -ExpiryTime
8398
Expiry Time
8499

src/Storage/Storage/DatalakeGen2/Cmdlet/NewAzDataLakeGen2Item.cs

+12-4
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,18 @@ public override void ExecuteCmdlet()
191191
PathHttpHeaders pathHttpHeaders = SetDatalakegen2ItemProperties(dirClient, BlobProperties, setToServer: false);
192192
IDictionary<string, string> metadata = SetDatalakegen2ItemMetaData(dirClient, BlobMetadata, setToServer: false);
193193

194-
dirClient.Create(pathHttpHeaders,
195-
metadata,
196-
this.Permission,
197-
this.Umask != null ? DataLakeModels.PathPermissions.ParseSymbolicPermissions(this.Umask).ToOctalPermissions() : null);
194+
DataLakePathCreateOptions createOptions = new DataLakePathCreateOptions()
195+
{
196+
HttpHeaders = pathHttpHeaders,
197+
Metadata = metadata,
198+
AccessOptions = new DataLakeAccessOptions()
199+
{
200+
Permissions = this.Permission,
201+
Umask = this.Umask != null ? DataLakeModels.PathPermissions.ParseSymbolicPermissions(this.Umask).ToOctalPermissions() : null
202+
}
203+
};
204+
205+
dirClient.Create(createOptions, this.CmdletCancellationToken);
198206

199207
WriteDataLakeGen2Item(localChannel, dirClient);
200208
}

src/Storage/Storage/DatalakeGen2/Cmdlet/NewAzDataLakeGen2SasToken.cs

+8
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ public class NewDataLakeGen2SasTokenCommand : StorageCloudBlobCmdletBase
7777
[ValidateNotNull]
7878
public DateTimeOffset? ExpiryTime { get; set; }
7979

80+
[Parameter(Mandatory = false, HelpMessage = "Encryption scope to use when sending requests authorized with this SAS URI.")]
81+
[ValidateNotNullOrEmpty]
82+
public string EncryptionScope { get; set; }
83+
8084
[Parameter(Mandatory = false, HelpMessage = "Display full uri with sas token")]
8185
public SwitchParameter FullUri { get; set; }
8286

@@ -170,6 +174,10 @@ public override void ExecuteCmdlet()
170174
{
171175
sasBuilder.Protocol = this.Protocol.Value;
172176
}
177+
if (this.EncryptionScope != null)
178+
{
179+
sasBuilder.EncryptionScope = this.EncryptionScope;
180+
}
173181

174182
DataLakeFileSystemClient fileSystem = GetFileSystemClientByName(localChannel, this.FileSystem);
175183

src/Storage/Storage/Storage.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Azure.Data.Tables" Version="12.2.0" />
16-
<PackageReference Include="Azure.Storage.Blobs" Version="12.12.0" />
17-
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.10.0" />
18-
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.10.0" />
19-
<PackageReference Include="Azure.Storage.Queues" Version="12.10.0" />
16+
<PackageReference Include="Azure.Storage.Blobs" Version="12.14.0" />
17+
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.12.0" />
18+
<PackageReference Include="Azure.Storage.Files.Shares" Version="12.12.0" />
19+
<PackageReference Include="Azure.Storage.Queues" Version="12.12.0" />
2020
<PackageReference Include="Microsoft.Azure.Cosmos.Table" Version="1.0.8" />
2121
<PackageReference Include="System.Security.Permissions" Version="4.5.0" />
2222
<PackageReference Include="Microsoft.Azure.Storage.Blob" Version="11.2.2" />

tools/StaticAnalysis/DependencyAnalyzer/DependencyAnalyzer.cs

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public class DependencyAnalyzer : IStaticAnalyzer
119119
"System.Resources.ResourceManager",
120120
"System.Resources.Writer",
121121
"System.Runtime",
122+
"System.Runtime.CompilerServices.Unsafe",
122123
"System.Runtime.CompilerServices.VisualC",
123124
"System.Runtime.Extensions",
124125
"System.Runtime.Handles",

0 commit comments

Comments
 (0)