Skip to content

Commit c841ea3

Browse files
committed
Merge pull request Azure#2119 from wastoresh/dev
Add E@R and Cool Support when Create Account, Add "add" and "create" permission when genreating SAS token
2 parents c84b700 + 6a98682 commit c841ea3

File tree

39 files changed

+1673
-909
lines changed

39 files changed

+1673
-909
lines changed

ChangeLog.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
##2016.05.03 version 1.4.0
2+
* Azure Storage
3+
* Upgrade to Microsoft.Azure.Management.Storage nuget package v5.0 preview
4+
* Add Encryption and Hot/Cool features support to resource mode storage account cmdlets
5+
- New-AzureRmStorageAccount
6+
- Set-AzureRmStorageAccount
7+
* Add "Add" and "Create" permission to Blob SAS cmdlets
8+
- New-AzureStorageBlobSASToken
9+
- New-AzureStorageContainerSASToken
10+
- New-AzureStorageContainerStoredAccessPolicy
11+
- Set-AzureStorageContainerStoredAccessPolicy
12+
* Add "Create" permission to File SAS cmdlets
13+
- New-AzureStorageFileSASToken
14+
- New-AzureStorageShareSASToken
15+
- New-AzureStorageShareStoredAccessPolicy
16+
- Set-AzureStorageShareStoredAccessPolicy
17+
118
##2016.04.19 version 1.3.2
219
* Add support for specifying NIC/VMSS as application gateway backend address
320
* Fix HDI ADL cluster creation and live test

setup/azurecmdfiles.wxi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2538,6 +2538,9 @@
25382538
<Component Id="cmpA2A4B67ACC8738C88A82A9576BD82026" Guid="*">
25392539
<File Id="fil2E6EA8F5997FA6DBE29FCE3A58F051DF" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Storage\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll" />
25402540
</Component>
2541+
<Component Id="cmp3AE4D7EAA86E455A89006A85332F6B3A" Guid="*">
2542+
<File Id="fil6C5492894C2F4DDD80E710891D53B6D2" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Storage\Microsoft.Rest.ClientRuntime.Azure.dll" />
2543+
</Component>
25412544
<Component Id="cmpE56C0006C325EFBAD7984DBBCF689FD2" Guid="*">
25422545
<File Id="filDAF92272D69F4A127139311912333F8B" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\AzureRM.Storage\Microsoft.Rest.ClientRuntime.dll" />
25432546
</Component>
@@ -5798,6 +5801,7 @@
57985801
<ComponentRef Id="cmp4EA5A818E3BE7C67C27B69ADABCE5CBF" />
57995802
<ComponentRef Id="cmpBF600E80A7D04977AF21CAA07A79254C" />
58005803
<ComponentRef Id="cmpA2A4B67ACC8738C88A82A9576BD82026" />
5804+
<ComponentRef Id="cmp3AE4D7EAA86E455A89006A85332F6B3A" />
58015805
<ComponentRef Id="cmpE56C0006C325EFBAD7984DBBCF689FD2" />
58025806
<ComponentRef Id="cmpA94FD747C692B4A9A45D9DE5D869DE53" />
58035807
<ComponentRef Id="cmp7F0D9683DB4D431F6A1A42EBCAD0E4E3" />

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/Commands.ApiManagement.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@
179179
</ProjectReference>
180180
</ItemGroup>
181181
<ItemGroup>
182+
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\AzureRM.Storage.ps1">
183+
<Link>ScenarioTests\AzureRM.Storage.ps1</Link>
184+
</None>
182185
<None Include="packages.config">
183186
<SubType>Designer</SubType>
184187
</None>

src/ResourceManager/ApiManagement/Commands.ApiManagement.Test/ScenarioTests/ApiManagementTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ private void RunPowerShellTest(params string[] scripts)
176176
_helper.RMProfileModule,
177177
_helper.RMResourceModule,
178178
_helper.RMStorageDataPlaneModule,
179-
_helper.RMStorageModule,
180-
_helper.GetRMModulePath("AzureRM.ApiManagement.psd1"));
179+
_helper.GetRMModulePath("AzureRM.ApiManagement.psd1"),
180+
"AzureRM.Storage.ps1");
181181

182182
_helper.RunPowerShellTest(scripts);
183183
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
2+
function Get-AzureRmStorageAccount
3+
{
4+
5+
[CmdletBinding()]
6+
param(
7+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
8+
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] [alias("StorageAccountName")] $Name)
9+
BEGIN {
10+
$context = Get-Context
11+
$client = Get-StorageClient $context
12+
}
13+
PROCESS {
14+
$getTask = $client.StorageAccounts.GetPropertiesAsync($ResourceGroupName, $name, [System.Threading.CancellationToken]::None)
15+
$sa = $getTask.Result
16+
$account = Get-StorageAccount $ResourceGroupName $Name
17+
Write-Output $account
18+
}
19+
END {}
20+
21+
}
22+
23+
function New-AzureRmStorageAccount
24+
{
25+
[CmdletBinding()]
26+
param(
27+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
28+
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)][alias("StorageAccountName")] $Name,
29+
[string] [Parameter(Position=2, ValueFromPipelineByPropertyName=$true)] $Location,
30+
[string] [Parameter(Position=3, ValueFromPipelineByPropertyName=$true)] $Type)
31+
BEGIN {
32+
$context = Get-Context
33+
$client = Get-StorageClient $context
34+
}
35+
PROCESS {
36+
$createParms = New-Object -Type Microsoft.Azure.Management.Storage.Models.StorageAccountCreateParameters
37+
$createParms.AccountType = [Microsoft.Azure.Management.Storage.Models.AccountType]::StandardLRS
38+
$createParms.Location = $Location
39+
$getTask = $client.StorageAccounts.CreateAsync($ResourceGroupName, $name, $createParms, [System.Threading.CancellationToken]::None)
40+
$sa = $getTask.Result
41+
}
42+
END {}
43+
44+
}
45+
46+
function Get-AzureRmStorageAccountKey
47+
{
48+
[CmdletBinding()]
49+
param(
50+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
51+
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] [alias("StorageAccountName")] $Name)
52+
BEGIN {
53+
$context = Get-Context
54+
$client = Get-StorageClient $context
55+
}
56+
PROCESS {
57+
$getTask = $client.StorageAccounts.ListKeysAsync($ResourceGroupName, $name, [System.Threading.CancellationToken]::None)
58+
Write-Output $getTask.Result.StorageAccountKeys
59+
}
60+
END {}
61+
}
62+
63+
function Remove-AzureRmStorageAccount
64+
{
65+
66+
[CmdletBinding()]
67+
param(
68+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ResourceGroupName,
69+
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] [alias("StorageAccountName")] $Name)
70+
BEGIN {
71+
$context = Get-Context
72+
$client = Get-StorageClient $context
73+
}
74+
PROCESS {
75+
$getTask = $client.StorageAccounts.DeleteAsync($ResourceGroupName, $name, [System.Threading.CancellationToken]::None)
76+
$sa = $getTask.Result
77+
}
78+
END {}
79+
80+
}
81+
82+
function Get-Context
83+
{
84+
[Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext]$context = $null
85+
$profile = [Microsoft.WindowsAzure.Commands.Common.AzureRmProfileProvider]::Instance.Profile
86+
if ($profile -ne $null)
87+
{
88+
$context = $profile.Context
89+
}
90+
91+
return $context
92+
}
93+
94+
function Get-StorageClient
95+
{
96+
param([Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext] $context)
97+
$factory = [Microsoft.Azure.Commands.Common.Authentication.AzureSession]::ClientFactory
98+
[System.Type[]]$types = [Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext], [Microsoft.Azure.Commands.Common.Authentication.Models.AzureEnvironment+Endpoint]
99+
$method = [Microsoft.Azure.Commands.Common.Authentication.IClientFactory].GetMethod("CreateClient", $types)
100+
$closedMethod = $method.MakeGenericMethod([Microsoft.Azure.Management.Storage.StorageManagementClient])
101+
$arguments = $context, [Microsoft.Azure.Commands.Common.Authentication.Models.AzureEnvironment+Endpoint]::ResourceManager
102+
$client = $closedMethod.Invoke($factory, $arguments)
103+
return $client
104+
}
105+
106+
function Get-StorageAccount {
107+
param([string] $resourceGroupName, [string] $name)
108+
$endpoints = New-Object PSObject -Property @{"Blob" = "https://$name.blob.core.windows.net/"}
109+
$sa = New-Object PSObject -Property @{"Name" = $name; "ResourceGroupName" = $resourceGroupName;
110+
"PrimaryEndpoints" = $endpoints
111+
}
112+
return $sa
113+
}

src/ResourceManager/Common/Commands.ScenarioTests.ResourceManager.Common/Commands.ScenarioTests.ResourceManager.Common.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,9 @@
161161
<None Include="Assert.ps1">
162162
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
163163
</None>
164+
<None Include="AzureRM.Storage.ps1">
165+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
166+
</None>
164167
<None Include="Common.ps1">
165168
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
166169
</None>

src/ResourceManager/Compute/Commands.Compute.Test/Commands.Compute.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,9 @@
218218
<Link>ScenarioTests\Assert.ps1</Link>
219219
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
220220
</None>
221+
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\AzureRM.Storage.ps1">
222+
<Link>ScenarioTests\AzureRM.Storage.ps1</Link>
223+
</None>
221224
<None Include="..\..\Resources\Commands.Resources.Test\ScenarioTests\Common.ps1">
222225
<Link>ScenarioTests\Common.ps1</Link>
223226
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

src/ResourceManager/Compute/Commands.Compute.Test/Common/ComputeTestController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ public void RunPsTestWorkflow(
134134
helper.RMStorageDataPlaneModule,
135135
helper.RMStorageModule,
136136
helper.GetRMModulePath("AzureRM.Compute.psd1"),
137-
helper.GetRMModulePath("AzureRM.Network.psd1"));
137+
helper.GetRMModulePath("AzureRM.Network.psd1"),
138+
"AzureRM.Storage.ps1");
138139

139140
try
140141
{

src/ResourceManager/Sql/Commands.Sql.Test/ScenarioTests/SqlTestsBase.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ protected void RunPowerShellTest(params string[] scripts)
8484
"ScenarioTests\\" + this.GetType().Name + ".ps1",
8585
helper.RMProfileModule,
8686
helper.RMResourceModule,
87-
helper.RMStorageDataPlaneModule,
88-
helper.RMStorageModule,
87+
helper.RMStorageDataPlaneModule,
8988
helper.GetRMModulePath(@"AzureRM.Insights.psd1"),
90-
helper.GetRMModulePath(@"AzureRM.Sql.psd1"));
89+
helper.GetRMModulePath(@"AzureRM.Sql.psd1"),
90+
"AzureRM.Storage.ps1");
9191
helper.RunPowerShellTest(scripts);
9292
}
9393
}

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
<HintPath>..\..\..\packages\Microsoft.Azure.KeyVault.Core.1.0.0\lib\net40\Microsoft.Azure.KeyVault.Core.dll</HintPath>
6161
<Private>True</Private>
6262
</Reference>
63-
<Reference Include="Microsoft.Azure.Management.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
64-
<SpecificVersion>False</SpecificVersion>
65-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.3.0.0\lib\net40\Microsoft.Azure.Management.Storage.dll</HintPath>
63+
<Reference Include="Microsoft.Azure.Management.Storage, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
64+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Storage.5.0.0-preview\lib\net45\Microsoft.Azure.Management.Storage.dll</HintPath>
65+
<Private>True</Private>
6666
</Reference>
6767
<Reference Include="Microsoft.Data.Edm">
6868
<HintPath>..\..\..\packages\Microsoft.Data.Edm.5.6.4\lib\net40\Microsoft.Data.Edm.dll</HintPath>
@@ -88,8 +88,9 @@
8888
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.1.0\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
8989
<Private>True</Private>
9090
</Reference>
91-
<Reference Include="Microsoft.Rest.ClientRuntime.Azure">
92-
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.2.5.4\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
91+
<Reference Include="Microsoft.Rest.ClientRuntime.Azure, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
92+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.1.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
93+
<Private>True</Private>
9394
</Reference>
9495
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
9596
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
@@ -135,12 +136,6 @@
135136
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
136137
</ItemGroup>
137138
<ItemGroup>
138-
<Compile Include="..\..\..\Common\Commands.Common.Storage\Adapters\ARM.Storage.3\ARMStorageProvider.cs">
139-
<Link>Models\ARMStorageProvider.cs</Link>
140-
</Compile>
141-
<Compile Include="..\..\..\Common\Commands.Common.Storage\Adapters\ARM.Storage.3\ARMStorageService.cs">
142-
<Link>Models\ARMStorageService.cs</Link>
143-
</Compile>
144139
<Compile Include="Models\PSStorageAccount.cs" />
145140
<Compile Include="Models\PSUsage.cs" />
146141
<Compile Include="Properties\AssemblyInfo.cs" />

0 commit comments

Comments
 (0)