Skip to content

Commit 18be449

Browse files
author
Hovsep
committed
Merge pull request #2125 from vivsriaus/MoveRG
Move ARM cmdlets from Resources to Resources.Rest proj
2 parents 72b79da + 064e118 commit 18be449

File tree

143 files changed

+17651
-22944
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+17651
-22944
lines changed

ChangeLog.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
##2016.06.04 version 1.5.0
2+
* Azure Resource Manager
3+
- (Get/Set/New/Remove)-AzureRmResourceGroup cmdlets will now use the new autorest generated ARM assembly
4+
- (Get/New/Remove)-AzureRmResourceGroupDeployment cmdlets will now use the new autorest generated ARM assembly
5+
- (Get/Register)-AzureRmProviderFeature cmdlets will now use the new autorest generated ARM assembly
6+
- (Get/Register/Unregister)-AzureRmResourceProvider cmdlets will now use the new autorest generated ARM assembly
7+
- Use a constant backoff interval when polling for deployment progress in New-AzureRmResourceGroupDeployment cmdlet
8+
- Add support to specify file share paths for cmdlets that take input file as parameter
9+
- Improve error message when Move-AzureRmResource cmdlet fails
10+
- Improve error message when New-AzureRmResourceGroupDeployment cmdlet fails
11+
- Enable object and array type parameters for template deployment
12+
- Preserve casing for resource properties in New/Set-AzureRmResource cmdlet
13+
- PropertyObject parameter is now optional in New-AzureRmResource cmdlet
214
* Azure Storage
315
* Fix get Storage Account throttling failures when run it on subscription with many accounts
416
- Get-AzureRmStorageAccount
517
- Get-AzureStorageAccount
18+
619
##2016.05.04 version 1.4.0
720
* Azure Resource Manager
8-
- Get-AzureRmLocation cmdley: New cmdlet Lists all public Azure locatiosn with available provider namespaces
21+
- Get-AzureRmLocation cmdlet: New cmdlet Lists all public Azure locatiosn with available provider namespaces
922
- Get-AzureRMResourceGroupDeploymentOperations: Improved output format
1023
- Get-AzureRMDeployment: Responses contain all error details
1124
- Added cmdlet help anbd examples

setup/azurecmdfiles.wxi

Lines changed: 83 additions & 7 deletions
Large diffs are not rendered by default.

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.Resources.ps1">
183+
<Link>ScenarioTests\AzureRM.Resources.ps1</Link>
184+
</None>
182185
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\AzureRM.Storage.ps1">
183186
<Link>ScenarioTests\AzureRM.Storage.ps1</Link>
184187
</None>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ private void RunPowerShellTest(params string[] scripts)
177177
_helper.RMResourceModule,
178178
_helper.RMStorageDataPlaneModule,
179179
_helper.GetRMModulePath("AzureRM.ApiManagement.psd1"),
180-
"AzureRM.Storage.ps1");
180+
"AzureRM.Storage.ps1",
181+
"AzureRM.Resources.ps1");
181182

182183
_helper.RunPowerShellTest(scripts);
183184
}

src/ResourceManager/AzureBatch/Commands.Batch.Test/Commands.Batch.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@
274274
<Compile Include="Tasks\StopBatchTaskCommandTests.cs" />
275275
</ItemGroup>
276276
<ItemGroup>
277+
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\AzureRM.Resources.ps1">
278+
<Link>ScenarioTests\AzureRM.Resources.ps1</Link>
279+
</None>
277280
<None Include="MSSharedLibKey.snk" />
278281
<None Include="packages.config">
279282
<SubType>Designer</SubType>

src/ResourceManager/AzureBatch/Commands.Batch.Test/ScenarioTests/BatchController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ public void RunPsTestWorkflow(
107107
"Microsoft.Azure.Commands.Batch.Test.dll",
108108
helper.RMProfileModule,
109109
helper.RMResourceModule,
110-
helper.GetRMModulePath("AzureRM.Batch.psd1"));
110+
helper.GetRMModulePath("AzureRM.Batch.psd1"),
111+
"AzureRM.Resources.ps1");
111112

112113
try
113114
{

src/ResourceManager/Cdn/Commands.Cdn.Test/Commands.Cdn.Test.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@
124124
</Reference>
125125
</ItemGroup>
126126
<ItemGroup>
127+
<None Include="..\..\Common\Commands.ScenarioTests.ResourceManager.Common\AzureRM.Resources.ps1">
128+
<Link>ScenarioTests\AzureRM.Resources.ps1</Link>
129+
</None>
127130
<None Include="MSSharedLibKey.snk" />
128131
<None Include="packages.config">
129132
<SubType>Designer</SubType>

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/TestController.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ public void RunPsTestWorkflow(
136136
"ScenarioTests\\" + callingClassName + ".ps1",
137137
_helper.RMProfileModule,
138138
_helper.RMResourceModule,
139-
@"AzureRM.Cdn.psd1");
139+
@"AzureRM.Cdn.psd1",
140+
"AzureRM.Resources.ps1");
140141
try
141142
{
142143
if (scriptBuilder != null)
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
function Get-AzureRmResourceGroup
2+
{
3+
[CmdletBinding()]
4+
param(
5+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [alias("ResourceGroupName")] $Name,
6+
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] $Location,
7+
[string] [Parameter(ValueFromPipelineByPropertyName=$true)] $Id,
8+
[switch] $Force)
9+
BEGIN {
10+
$context = Get-Context
11+
$client = Get-ResourcesClient $context
12+
}
13+
PROCESS {
14+
if($Name -eq $null) {
15+
$getTask = $client.ResourceGroups.ListAsync($null, [System.Threading.CancellationToken]::None)
16+
$rg = $getTask.Result
17+
$resourceGroup = List-ResourceGroup
18+
Write-Output $resourceGroup
19+
} else {
20+
$getTask = $client.ResourceGroups.GetAsync($Name, [System.Threading.CancellationToken]::None)
21+
$rg = $getTask.Result
22+
$resourceGroup = Get-ResourceGroup $Name $Location $rg.ResourceGroup.Id
23+
Write-Output $resourceGroup
24+
}
25+
}
26+
END {}
27+
}
28+
29+
function Get-AzureRmResourceProvider
30+
{
31+
[CmdletBinding()]
32+
param(
33+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] $ProviderNamespace)
34+
BEGIN {
35+
$context = Get-Context
36+
$client = Get-ResourcesClient $context
37+
}
38+
PROCESS {
39+
$getTask = $client.Providers.GetAsync($ProviderNamespace, [System.Threading.CancellationToken]::None)
40+
$pr = $getTask.Result
41+
$provider = Get-Provider $pr.Provider.Namespace
42+
Write-Output $provider
43+
}
44+
END {}
45+
}
46+
47+
function New-AzureRmResourceGroup
48+
{
49+
[CmdletBinding()]
50+
param(
51+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [alias("ResourceGroupName")] $Name,
52+
[string] [Parameter(Position=1, ValueFromPipelineByPropertyName=$true)] $Location,
53+
[string] [Parameter(ValueFromPipelineByPropertyName=$true)] $Tags,
54+
[switch] $Force)
55+
BEGIN {
56+
$context = Get-Context
57+
$client = Get-ResourcesClient $context
58+
}
59+
PROCESS {
60+
$createParams = New-Object -Type Microsoft.Azure.Management.Resources.Models.ResourceGroup
61+
$createParams.Location = $Location
62+
$createTask = $client.ResourceGroups.CreateOrUpdateAsync($Name, $createParams, [System.Threading.CancellationToken]::None)
63+
$rg = $createTask.Result
64+
$resourceGroup = Get-ResourceGroup $Name $Location
65+
Write-Output $resourceGroup
66+
}
67+
END {}
68+
}
69+
70+
function New-AzureRmResourceGroupDeployment
71+
{
72+
[CmdletBinding()]
73+
param(
74+
[string] [alias("ResourceGroupName")] $Name,
75+
[string] $TemplateFile,
76+
[string] $serverName,
77+
[string] $databaseName,
78+
[string] $storageName,
79+
[string] $version,
80+
[string] $EnvLocation,
81+
[string] $administratorLogin,
82+
[switch] $Force)
83+
BEGIN {
84+
$context = Get-Context
85+
$client = Get-ResourcesClient $context
86+
}
87+
PROCESS {
88+
$createParams = New-Object -Type Microsoft.Azure.Management.Resources.Models.Deployment
89+
$createTask = $client.Deployments.CreateOrUpdateAsync($Name, $Name, $createParams, [System.Threading.CancellationToken]::None)
90+
$rg = $createTask.Result
91+
}
92+
END {}
93+
}
94+
95+
function Remove-AzureRmResourceGroup
96+
{
97+
[CmdletBinding()]
98+
param(
99+
[string] [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [alias("ResourceGroupName")] $Name,
100+
[switch] $Force)
101+
BEGIN {
102+
$context = Get-Context
103+
$client = Get-ResourcesClient $context
104+
}
105+
PROCESS {
106+
$deleteTask = $client.ResourceGroups.DeleteAsync($Name, [System.Threading.CancellationToken]::None)
107+
$rg = $deleteTask.Result
108+
}
109+
END {}
110+
}
111+
112+
function Get-Context
113+
{
114+
[Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext]$context = $null
115+
$profile = [Microsoft.WindowsAzure.Commands.Common.AzureRmProfileProvider]::Instance.Profile
116+
if ($profile -ne $null)
117+
{
118+
$context = $profile.Context
119+
}
120+
return $context
121+
}
122+
123+
function Get-ResourcesClient
124+
{
125+
param([Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext] $context)
126+
$factory = [Microsoft.Azure.Commands.Common.Authentication.AzureSession]::ClientFactory
127+
[System.Type[]]$types = [Microsoft.Azure.Commands.Common.Authentication.Models.AzureContext], [Microsoft.Azure.Commands.Common.Authentication.Models.AzureEnvironment+Endpoint]
128+
$method = [Microsoft.Azure.Commands.Common.Authentication.IClientFactory].GetMethod("CreateClient", $types)
129+
$closedMethod = $method.MakeGenericMethod([Microsoft.Azure.Management.Resources.ResourceManagementClient])
130+
$arguments = $context, [Microsoft.Azure.Commands.Common.Authentication.Models.AzureEnvironment+Endpoint]::ResourceManager
131+
$client = $closedMethod.Invoke($factory, $arguments)
132+
return $client
133+
}
134+
135+
function Get-ResourceGroup {
136+
param([string] $name, [string] $location, [string] $id)
137+
$rg = New-Object PSObject -Property @{"ResourceGroupName" = $name; "Location" = $location; "ResourceId" = $id}
138+
return $rg
139+
}
140+
141+
function Get-Provider {
142+
param([string] $name)
143+
$rtype = New-Object PSObject -Property @{"ResourceTypeName" = "virtualMachines"; "Locations" = @("East US"); "ApiVersions" = @("2015-01-01"); }
144+
$pr = New-Object PSObject -Property @{"ProviderNamespace" = $name; "RegistrationState" = "Registered"; "Locations" = @("East US"); "ResourceTypes" = $rtype;}
145+
return $pr
146+
}
147+
148+
function List-ResourceGroup {
149+
$rg = New-Object PSObject -Property @{"ResourceGroupName" = $name; "Location" = $location; }
150+
return $rg
151+
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@
4949
<Reference Include="Microsoft.Azure.Common.NetFramework">
5050
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
5151
</Reference>
52+
<Reference Include="Microsoft.Azure.Management.ResourceManager">
53+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.ResourceManager.1.1.1-preview\lib\net45\Microsoft.Azure.Management.ResourceManager.dll</HintPath>
54+
</Reference>
5255
<Reference Include="Microsoft.Azure.ResourceManager, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
5356
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.20.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
5457
<Private>True</Private>
@@ -72,6 +75,9 @@
7275
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.2.1.0\lib\net45\Microsoft.Rest.ClientRuntime.dll</HintPath>
7376
<Private>True</Private>
7477
</Reference>
78+
<Reference Include="Microsoft.Rest.ClientRuntime.Azure">
79+
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.3.1.0\lib\net45\Microsoft.Rest.ClientRuntime.Azure.dll</HintPath>
80+
</Reference>
7581
<Reference Include="Microsoft.Rest.ClientRuntime.Azure.Authentication, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
7682
<HintPath>..\..\..\packages\Microsoft.Rest.ClientRuntime.Azure.Authentication.2.0.1-preview\lib\net45\Microsoft.Rest.ClientRuntime.Azure.Authentication.dll</HintPath>
7783
<Private>True</Private>
@@ -145,6 +151,7 @@
145151
<Compile Include="Mocks\MockCommandRuntime.cs" />
146152
<Compile Include="Mocks\MockDeploymentClientFactory.cs" />
147153
<Compile Include="PermissiveRecordMatcherWithApiExclusion.cs" />
154+
<Compile Include="PageExtensions.cs" />
148155
<Compile Include="ProfileClient.cs" />
149156
<Compile Include="PSCmdletExtensions.cs" />
150157
<Compile Include="Constants.cs" />
@@ -162,6 +169,9 @@
162169
<None Include="Assert.ps1">
163170
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
164171
</None>
172+
<None Include="AzureRM.Resources.ps1">
173+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
174+
</None>
165175
<None Include="AzureRM.Storage.ps1">
166176
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
167177
</None>

0 commit comments

Comments
 (0)