Skip to content

Commit d8824cb

Browse files
committed
Support Customer Key feature
1 parent 2898c3c commit d8824cb

File tree

18 files changed

+11851
-747
lines changed

18 files changed

+11851
-747
lines changed

src/ResourceManager/Storage/ChangeLog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Upgrade SRP SDK to 6.3.1
22+
* Add IdentityType setting support to resource mode storage account cmdlets
23+
- New-AzureRmStorageAccount
24+
- Set-AzureRmStorageAccount
25+
* Add Customer Key Support to resource mode storage account cmdlets
26+
- Set-AzureRmStorageAccount
27+
- New-AzureRmStorageAccountEncryptionKeySource
2128

2229
## Version 3.0.0
2330
* Upgrade SRP SDK to 6.3.0

src/ResourceManager/Storage/Commands.Management.Storage.Test/Commands.Management.Storage.Test.csproj

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.2.0.0\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5353
</Reference>
5454
<Reference Include="Microsoft.Azure.Management.Storage, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
55-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.6.3.0-preview\lib\net452\Microsoft.Azure.Management.Storage.dll</HintPath>
56-
<Private>True</Private>
55+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.6.4.0-preview\lib\net452\Microsoft.Azure.Management.Storage.dll</HintPath>
5756
</Reference>
5857
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5958
<SpecificVersion>False</SpecificVersion>
@@ -73,13 +72,10 @@
7372
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
7473
</Reference>
7574
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
76-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.6\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
77-
<Private>True</Private>
75+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
7876
</Reference>
7977
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
80-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.5\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
81-
<SpecificVersion>False</SpecificVersion>
82-
<Private>True</Private>
78+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.3.7\lib\net452\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
8379
</Reference>
8480
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
8581
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.2.9-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
@@ -155,7 +151,9 @@
155151
</ProjectReference>
156152
</ItemGroup>
157153
<ItemGroup>
158-
<None Include="packages.config" />
154+
<None Include="packages.config">
155+
<SubType>Designer</SubType>
156+
</None>
159157
<None Include="ScenarioTests\Common.ps1">
160158
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
161159
</None>
@@ -187,6 +185,9 @@
187185
<None Include="SessionRecords\Microsoft.Azure.Commands.Management.Storage.Test.ScenarioTests.StorageAccountTests\TestRemoveAzureStorageAccount.json">
188186
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
189187
</None>
188+
<None Include="SessionRecords\Microsoft.Azure.Commands.Management.Storage.Test.ScenarioTests.StorageAccountTests\TestSetAzureRmStorageAccountKeySource.json">
189+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
190+
</None>
190191
<None Include="SessionRecords\Microsoft.Azure.Commands.Management.Storage.Test.ScenarioTests.StorageAccountTests\TestSetAzureStorageAccount.json">
191192
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
192193
</None>

src/ResourceManager/Storage/Commands.Management.Storage.Test/ScenarioTests/Common.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,13 @@ function Get-StorageManagementTestResourceName
138138
}
139139

140140
return $assetName
141+
}
142+
143+
<#
144+
.SYNOPSIS
145+
Gets the default location for a provider
146+
#>
147+
function Get-ProviderLocation($provider)
148+
{
149+
"westus"
141150
}

src/ResourceManager/Storage/Commands.Management.Storage.Test/ScenarioTests/StorageAccountTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,12 @@ public void TestSetCurrentStorageAccount()
9898
TestController.NewInstance.RunPsTest("Test-SetAzureRmCurrentStorageAccount");
9999
}
100100

101+
[Fact]
102+
[Trait(Category.AcceptanceType, Category.CheckIn)]
103+
public void TestSetAzureRmStorageAccountKeySource()
104+
{
105+
TestController.NewInstance.RunPsTest("Test-SetAzureRmStorageAccountKeySource");
106+
}
107+
101108
}
102109
}

src/ResourceManager/Storage/Commands.Management.Storage.Test/ScenarioTests/StorageAccountTests.ps1

Lines changed: 62 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function Test-StorageAccount
2626
# Test
2727
$stoname = 'sto' + $rgname;
2828
$stotype = 'Standard_GRS';
29-
$loc = 'eastasia';
29+
$loc = Get-ProviderLocation ResourceManagement;
3030
$encryptionServiceBF = "Blob,File"
3131
$encryptionServiceB = "Blob"
3232
$encryptionServiceF = "File"
@@ -126,7 +126,7 @@ function Test-NewAzureStorageAccount
126126
# Test
127127
$stoname = 'sto' + $rgname;
128128
$stotype = 'Standard_GRS';
129-
$loc = 'westus';
129+
$loc = Get-ProviderLocation ResourceManagement;
130130

131131
New-AzureRmResourceGroup -Name $rgname -Location $loc;
132132

@@ -155,7 +155,7 @@ function Test-GetAzureStorageAccount
155155
# Test
156156
$stoname = 'sto' + $rgname;
157157
$stotype = 'Standard_GRS';
158-
$loc = 'westus';
158+
$loc = Get-ProviderLocation ResourceManagement;
159159
$kind = 'Storage'
160160

161161
New-AzureRmResourceGroup -Name $rgname -Location $loc;
@@ -200,7 +200,7 @@ function Test-SetAzureStorageAccount
200200
# Test
201201
$stoname = 'sto' + $rgname;
202202
$stotype = 'Standard_GRS';
203-
$loc = 'eastasia';
203+
$loc = Get-ProviderLocation ResourceManagement;
204204
$kind = 'Storage'
205205
$encryptionServiceBF = "File,Blob"
206206

@@ -264,7 +264,7 @@ function Test-RemoveAzureStorageAccount
264264
# Test
265265
$stoname = 'sto' + $rgname;
266266
$stotype = 'Standard_GRS';
267-
$loc = 'westus';
267+
$loc = Get-ProviderLocation ResourceManagement;
268268

269269
New-AzureRmResourceGroup -Name $rgname -Location $loc;
270270

@@ -279,6 +279,58 @@ function Test-RemoveAzureStorageAccount
279279
}
280280
}
281281

282+
<#
283+
.SYNOPSIS
284+
Test New-AzureRmStorageAccountEncryptionKeySource
285+
#>
286+
function Test-SetAzureRmStorageAccountKeySource
287+
{
288+
# Setup
289+
$rgname = Get-StorageManagementTestResourceName;
290+
291+
try
292+
{
293+
# Test
294+
$stoname = 'sto' + $rgname;
295+
$stotype = 'Standard_GRS';
296+
$loc = Get-ProviderLocation ResourceManagement;
297+
298+
New-AzureRmResourceGroup -Name $rgname -Location $loc;
299+
300+
New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype;
301+
302+
$sto = Set-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -EnableEncryptionService Blob -StorageEncryption
303+
$stotype = 'StandardGRS';
304+
Assert-AreEqual $sto.StorageAccountName $stoname;
305+
Assert-AreEqual $sto.Sku.Name $stotype;
306+
Assert-AreEqual $sto.Location $loc;
307+
Assert-AreEqual $sto.Encryption.Services.Blob.Enabled $true
308+
Assert-AreEqual $sto.Encryption.KeySource Microsoft.Storage;
309+
Assert-AreEqual $sto.Encryption.Keyvaultproperties.Keyname $null;
310+
Assert-AreEqual $sto.Encryption.Keyvaultproperties.KeyVersion $null;
311+
Assert-AreEqual $sto.Encryption.Keyvaultproperties.KeyVaultUri $null;
312+
313+
$sto = Set-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -EnableEncryptionService File -IdentityType SystemAssigned
314+
Assert-AreEqual $sto.StorageAccountName $stoname;
315+
Assert-AreEqual $sto.Sku.Name $stotype;
316+
Assert-AreEqual $sto.Location $loc;
317+
Assert-AreNotEqual $sto.Identity.Type SystemAssigned $null
318+
Assert-AreEqual $sto.Encryption.Services.Blob.Enabled $true
319+
Assert-AreEqual $sto.Encryption.Services.File.Enabled $true
320+
Assert-AreEqual $sto.Encryption.KeySource Microsoft.Storage;
321+
Assert-AreEqual $sto.Encryption.Keyvaultproperties.Keyname $null;
322+
Assert-AreEqual $sto.Encryption.Keyvaultproperties.KeyVersion $null;
323+
Assert-AreEqual $sto.Encryption.Keyvaultproperties.KeyVaultUri $null;
324+
325+
Remove-AzureRmStorageAccount -Force -ResourceGroupName $rgname -Name $stoname;
326+
}
327+
finally
328+
{
329+
# Cleanup
330+
Clean-ResourceGroup $rgname
331+
}
332+
}
333+
282334
<#
283335
.SYNOPSIS
284336
Test Get-AzureRmStorageAccountKey
@@ -293,7 +345,7 @@ function Test-GetAzureStorageAccountKey
293345
# Test
294346
$stoname = 'sto' + $rgname;
295347
$stotype = 'Standard_GRS';
296-
$loc = 'westus';
348+
$loc = Get-ProviderLocation ResourceManagement;
297349

298350
New-AzureRmResourceGroup -Name $rgname -Location $loc;
299351

@@ -325,7 +377,7 @@ function Test-NewAzureStorageAccountKey
325377
# Test
326378
$stoname = 'sto' + $rgname;
327379
$stotype = 'Standard_GRS';
328-
$loc = 'westus';
380+
$loc = Get-ProviderLocation ResourceManagement;
329381

330382
New-AzureRmResourceGroup -Name $rgname -Location $loc;
331383

@@ -369,7 +421,7 @@ function Test-PipingGetAccountToGetKey
369421
# Test
370422
$stoname = 'sto' + $rgname;
371423
$stotype = 'Standard_GRS';
372-
$loc = 'westus';
424+
$loc = Get-ProviderLocation ResourceManagement;
373425

374426
New-AzureRmResourceGroup -Name $rgname -Location $loc;
375427

@@ -401,7 +453,7 @@ function Test-PipingToSetAzureRmCurrentStorageAccount
401453
# Test
402454
$stoname = 'sto' + $rgname
403455
$stotype = 'Standard_GRS'
404-
$loc = 'westus'
456+
$loc = Get-ProviderLocation ResourceManagement
405457

406458
New-AzureRmResourceGroup -Name $rgname -Location $loc
407459
New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype
@@ -433,7 +485,7 @@ function Test-SetAzureRmCurrentStorageAccount
433485
# Test
434486
$stoname = 'sto' + $rgname
435487
$stotype = 'Standard_GRS'
436-
$loc = 'westus'
488+
$loc = Get-ProviderLocation ResourceManagement
437489

438490
New-AzureRmResourceGroup -Name $rgname -Location $loc
439491
New-AzureRmStorageAccount -ResourceGroupName $rgname -Name $stoname -Location $loc -Type $stotype

0 commit comments

Comments
 (0)