Skip to content

Commit 59b7fa0

Browse files
committed
Merge pull request #186 from AzureAutomationTeam/ignite
Ignite:Automation arm cmdlets
2 parents 35bc622 + 6bfa8a1 commit 59b7fa0

Some content is hidden

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

41 files changed

+1716
-435
lines changed

setup/azurecmdfiles.wxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<File Id="fil0DD0F16890E95B85B2B03CBB03E6CF07" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Automation\Hyak.Common.dll" />
1313
</Component>
1414
<Component Id="cmpAED5C5457E91FCFC34AB7C4734D3E8E0" Guid="*">
15-
<File Id="fil1AD0E938948206F4BFB4C07C8A7BC5ED" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Automation\Microsoft.Azure.Commands.Automation.dll-help.xml" />
15+
<File Id="fil1AD0E938948206F4BFB4C07C8A7BC5ED" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Automation\Microsoft.Azure.Commands.ResourceManager.Automation.dll-help.xml" />
1616
</Component>
1717
<Component Id="cmp9C538B9F96F953FD1A81796FC970EE9B" Guid="*">
1818
<File Id="filF256BE77EB57EFCA89959865C5AB0EED" KeyPath="yes" Source="$(var.sourceDir)\ResourceManager\AzureResourceManager\Automation\Microsoft.Azure.Commands.ResourceManager.Automation.dll" />

src/AzurePowershell.sln

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 2013
3-
VisualStudioVersion = 12.0.30501.0
3+
VisualStudioVersion = 12.0.31101.0
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8531411A-0137-4E27-9C5E-49E07C245048}"
66
ProjectSection(SolutionItems) = preProject
@@ -202,6 +202,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.TrafficManager2",
202202
EndProject
203203
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.TrafficManager2.Test", "ResourceManager\TrafficManager\Commands.TrafficManager2.Test\Commands.TrafficManager2.Test.csproj", "{5764A3A4-586C-4536-8481-13007CAC111B}"
204204
EndProject
205+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ResourceManagement.Automation.Test", "ResourceManager\Automation\Commands.Automation.Test\Commands.ResourceManagement.Automation.Test.csproj", "{59D1B5DC-9175-43EC-90C6-CBA601B3565F}"
206+
EndProject
205207
Global
206208
GlobalSection(SolutionConfigurationPlatforms) = preSolution
207209
Debug|Any CPU = Debug|Any CPU
@@ -488,6 +490,10 @@ Global
488490
{5764A3A4-586C-4536-8481-13007CAC111B}.Debug|Any CPU.Build.0 = Debug|Any CPU
489491
{5764A3A4-586C-4536-8481-13007CAC111B}.Release|Any CPU.ActiveCfg = Release|Any CPU
490492
{5764A3A4-586C-4536-8481-13007CAC111B}.Release|Any CPU.Build.0 = Release|Any CPU
493+
{59D1B5DC-9175-43EC-90C6-CBA601B3565F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
494+
{59D1B5DC-9175-43EC-90C6-CBA601B3565F}.Debug|Any CPU.Build.0 = Debug|Any CPU
495+
{59D1B5DC-9175-43EC-90C6-CBA601B3565F}.Release|Any CPU.ActiveCfg = Release|Any CPU
496+
{59D1B5DC-9175-43EC-90C6-CBA601B3565F}.Release|Any CPU.Build.0 = Release|Any CPU
491497
EndGlobalSection
492498
GlobalSection(SolutionProperties) = preSolution
493499
HideSolutionNode = FALSE
@@ -527,5 +533,6 @@ Global
527533
{37C44181-3F1B-4ABD-8089-26DFAB4B6BA8} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
528534
{A2DF4FE5-46EE-43E2-B246-E5CDDD47B752} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
529535
{5764A3A4-586C-4536-8481-13007CAC111B} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
536+
{59D1B5DC-9175-43EC-90C6-CBA601B3565F} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
530537
EndGlobalSection
531538
EndGlobal

src/ResourceManager.sln

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.StreamAnalytics.Te
4949
EndProject
5050
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Insights", "ResourceManager\Insights\Commands.Insights\Commands.Insights.csproj", "{DEA446A1-84E2-46CC-B780-EB4AFDE2460E}"
5151
EndProject
52-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Automation.Test", "ResourceManager\Automation\Commands.Automation.Test\Commands.Automation.Test.csproj", "{127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6}"
52+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ResourceManagement.Automation.Test", "ResourceManager\Automation\Commands.Automation.Test\Commands.ResourceManagement.Automation.Test.csproj", "{127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6}"
5353
EndProject
5454
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Websites", "ResourceManager\Websites\Commands.Websites\Commands.Websites.csproj", "{80A92297-7C92-456B-8EE7-9FB6CE30149D}"
5555
EndProject
@@ -187,6 +187,7 @@ Global
187187
{56ED8C97-53B9-4DF6-ACB5-7E6800105BF8} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
188188
{7E6683BE-ECFF-4709-89EB-1325E9E70512} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
189189
{127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
190+
{13E031E4-8A43-4B87-9D72-D70180C31C11} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
190191
{F4ABAD68-64A5-4B23-B09C-42559A7524DE} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
191192
{469F20E0-9D40-41AD-94C3-B47AD15A4C00} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}
192193
{133561EC-99AF-4ADC-AF41-39C4D3AD323B} = {95C16AED-FD57-42A0-86C3-2CF4300A4817}

src/ResourceManager/Automation/Commands.Automation.Test/Commands.Automation.Test.csproj renamed to src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<ProductVersion>
77
</ProductVersion>
88
<SchemaVersion>2.0</SchemaVersion>
9-
<ProjectGuid>{127D0D51-FDEA-4E1A-8CD8-34DEB5C2F7F6}</ProjectGuid>
9+
<ProjectGuid>{59D1B5DC-9175-43EC-90C6-CBA601B3565F}</ProjectGuid>
1010
<OutputType>Library</OutputType>
1111
<AppDesignerFolder>Properties</AppDesignerFolder>
1212
<RootNamespace>Microsoft.Azure.Commands.Automation.Test</RootNamespace>
13-
<AssemblyName>Microsoft.Azure.Commands.Automation.Test</AssemblyName>
13+
<AssemblyName>Microsoft.Azure.Commands.ResourceManager.Automation.Test</AssemblyName>
1414
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1515
<FileAlignment>512</FileAlignment>
1616
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@@ -50,28 +50,25 @@
5050
<Reference Include="Hyak.Common">
5151
<HintPath>..\..\..\packages\Hyak.Common.1.0.2\lib\portable-net403+win+wpa81\Hyak.Common.dll</HintPath>
5252
</Reference>
53-
<Reference Include="Microsoft.Azure.Commands.ResourceManager.Automation">
54-
<HintPath>..\..\..\Package\Debug\ResourceManager\AzureResourceManager\Automation\Microsoft.Azure.Commands.ResourceManager.Automation.dll</HintPath>
55-
</Reference>
5653
<Reference Include="Microsoft.Azure.Common">
57-
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.dll</HintPath>
54+
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.dll</HintPath>
5855
</Reference>
5956
<Reference Include="Microsoft.Azure.Common.Authentication, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6057
<SpecificVersion>False</SpecificVersion>
61-
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.14-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
58+
<HintPath>..\..\..\packages\Microsoft.Azure.Common.Authentication.1.0.25-preview\lib\net45\Microsoft.Azure.Common.Authentication.dll</HintPath>
6259
</Reference>
6360
<Reference Include="Microsoft.Azure.Common.NetFramework">
64-
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.0.2\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
61+
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
6562
</Reference>
6663
<Reference Include="Microsoft.Azure.ResourceManager">
67-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.12.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
64+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Resources.2.18.0-preview\lib\net40\Microsoft.Azure.ResourceManager.dll</HintPath>
6865
</Reference>
6966
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory">
7067
<SpecificVersion>False</SpecificVersion>
71-
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
68+
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll</HintPath>
7269
</Reference>
7370
<Reference Include="Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms">
74-
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.12.111071459\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
71+
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.14.201151115\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
7572
</Reference>
7673
<Reference Include="Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
7774
<SpecificVersion>False</SpecificVersion>
@@ -88,7 +85,7 @@
8885
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
8986
<Reference Include="Microsoft.WindowsAzure.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
9087
<SpecificVersion>False</SpecificVersion>
91-
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.0.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
88+
<HintPath>..\..\..\packages\Microsoft.WindowsAzure.Management.4.1.1\lib\net40\Microsoft.WindowsAzure.Management.dll</HintPath>
9289
</Reference>
9390
<Reference Include="Moq, Version=4.2.1402.2112, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
9491
<SpecificVersion>False</SpecificVersion>
@@ -127,6 +124,10 @@
127124
<Project>{5ee72c53-1720-4309-b54b-5fb79703195f}</Project>
128125
<Name>Commands.Common</Name>
129126
</ProjectReference>
127+
<ProjectReference Include="..\Commands.Automation\Commands.ResourceManagement.Automation.csproj">
128+
<Project>{90def35a-f7ff-40d0-b008-f489a4c092db}</Project>
129+
<Name>Commands.ResourceManagement.Automation</Name>
130+
</ProjectReference>
130131
</ItemGroup>
131132
<ItemGroup>
132133
<None Include="MSSharedLibKey.snk" />

src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationAccountTest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,19 @@ public void NewAzureAutomationAccountByNameSuccessfull()
4949
string resourceGroupName = "resourceGroup";
5050
string accountName = "account";
5151
string location = "East US";
52+
string plan = "Free";
5253

53-
this.mockAutomationClient.Setup(f => f.CreateAutomationAccount(resourceGroupName, accountName, location));
54+
this.mockAutomationClient.Setup(f => f.CreateAutomationAccount(resourceGroupName, accountName, location, plan,null));
5455

5556
// Test
5657
this.cmdlet.ResourceGroupName = resourceGroupName;
5758
this.cmdlet.Location = location;
5859
this.cmdlet.Name = accountName;
60+
this.cmdlet.Plan = plan;
5961
this.cmdlet.ExecuteCmdlet();
6062

6163
// Assert
62-
this.mockAutomationClient.Verify(f => f.CreateAutomationAccount(resourceGroupName, accountName, location), Times.Once());
64+
this.mockAutomationClient.Verify(f => f.CreateAutomationAccount(resourceGroupName, accountName, location,plan,null), Times.Once());
6365
}
6466
}
6567
}
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Hyak.Common" version="1.0.2" targetFramework="net45" />
4-
<package id="Microsoft.Azure.Common" version="2.0.2" targetFramework="net45" />
5-
<package id="Microsoft.Azure.Common.Authentication" version="1.0.14-preview" targetFramework="net45" />
4+
<package id="Microsoft.Azure.Common" version="2.1.0" targetFramework="net45" />
5+
<package id="Microsoft.Azure.Common.Authentication" version="1.0.25-preview" targetFramework="net45" />
66
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
7-
<package id="Microsoft.Azure.Management.Resources" version="2.12.0-preview" targetFramework="net45" />
7+
<package id="Microsoft.Azure.Management.Resources" version="2.18.0-preview" targetFramework="net45" />
88
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
99
<package id="Microsoft.Bcl.Async" version="1.0.168" targetFramework="net45" />
1010
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
11-
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.12.111071459" targetFramework="net45" />
11+
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.14.201151115" targetFramework="net45" />
1212
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
13-
<package id="Microsoft.WindowsAzure.Management" version="4.0.1" targetFramework="net45" />
13+
<package id="Microsoft.WindowsAzure.Management" version="4.1.1" targetFramework="net45" />
1414
<package id="Moq" version="4.2.1402.2112" targetFramework="net45" />
1515
<package id="Newtonsoft.Json" version="6.0.4" targetFramework="net45" />
16+
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
1617
</packages>
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System.IO;
16+
using System.Collections.Generic;
17+
using System.Globalization;
18+
using System.Management.Automation;
19+
using System.Security.Permissions;
20+
using Microsoft.Azure.Commands.Automation.Common;
21+
using Microsoft.Azure.Commands.Automation.Model;
22+
using Microsoft.WindowsAzure.Commands.Utilities.Common;
23+
24+
namespace Microsoft.Azure.Commands.Automation.Cmdlet
25+
{
26+
/// <summary>
27+
/// Gets configuration script for given configuration name and account name.
28+
/// </summary>
29+
[Cmdlet(VerbsData.Export, "AzureAutomationDscConfiguration", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
30+
[OutputType(typeof(DirectoryInfo))]
31+
public class ExportAzureAutomationDscConfiguration : AzureAutomationBaseCmdlet
32+
{
33+
/// <summary>
34+
/// True to overwrite the existing dsc configuration; false otherwise.
35+
/// </summary>
36+
private bool overwriteExistingFile;
37+
38+
/// <summary>
39+
/// Gets or sets the configfuration name.
40+
/// </summary>
41+
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The dsc configuration name.")]
42+
[Alias("ConfigurationName")]
43+
[ValidateNotNullOrEmpty]
44+
public string Name { get; set; }
45+
46+
/// <summary>
47+
/// Gets or sets the configuration version type
48+
/// </summary>
49+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Returns the draft or the published configuration version only. If not set, return published.")]
50+
[ValidateSet(Constants.Published, Constants.Draft)]
51+
public string Slot { get; set; }
52+
53+
/// <summary>
54+
/// Gets or sets the output folder for the configuration script.
55+
/// </summary>
56+
[Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The folder where configuration script should be placed.")]
57+
public string OutputFolder { get; set; }
58+
59+
/// <summary>
60+
/// Gets or sets switch parameter to confirm overwriting of existing configuration script.
61+
/// </summary>
62+
[Parameter(Mandatory = false, HelpMessage = "Forces an overwrite of an existing local file with the same name.")]
63+
public SwitchParameter Force
64+
{
65+
get { return this.overwriteExistingFile; }
66+
set { this.overwriteExistingFile = value; }
67+
}
68+
69+
/// <summary>
70+
/// Execute this cmdlet.
71+
/// </summary>
72+
[PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
73+
public override void ExecuteCmdlet()
74+
{
75+
bool? isDraft = this.IsDraft();
76+
77+
var ret = this.AutomationClient.GetConfigurationContent(this.ResourceGroupName, this.AutomationAccountName, this.Name, isDraft, OutputFolder, this.Force);
78+
79+
this.WriteObject(ret, true);
80+
}
81+
82+
/// <summary>
83+
/// Returns null if Slot is not provided; otherwise returns true if Slot is Draft.
84+
/// </summary>
85+
/// <returns>
86+
/// The <see cref="bool"/>.
87+
/// </returns>
88+
private bool? IsDraft()
89+
{
90+
bool? isDraft = null;
91+
92+
if (this.Slot != null)
93+
{
94+
isDraft = (0 == string.Compare(this.Slot, Constants.Draft, CultureInfo.InvariantCulture,
95+
CompareOptions.OrdinalIgnoreCase));
96+
}
97+
98+
return isDraft;
99+
}
100+
}
101+
}

0 commit comments

Comments
 (0)