diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj b/src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj
index 3350d5ab8d0d..7ec8839c45d3 100644
--- a/src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/Commands.ResourceManagement.Automation.Test.csproj
@@ -9,7 +9,7 @@
{59D1B5DC-9175-43EC-90C6-CBA601B3565F}
Library
Properties
- Microsoft.Azure.Commands.Automation.Test
+ Microsoft.Azure.Commands.ResourceManager.Automation.Test
Microsoft.Azure.Commands.ResourceManager.Automation.Test
v4.5
512
@@ -111,13 +111,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationAccountTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationAccountTest.cs
index 8bd40cb37b6b..7bd1759cdb7e 100644
--- a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationAccountTest.cs
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationAccountTest.cs
@@ -22,7 +22,7 @@
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Moq;
-namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
{
[TestClass]
public class GetAzureAutomationAccountTest : TestBase
@@ -55,6 +55,7 @@ public void GetAzureAutomationAllAccountsSuccessfull()
this.mockAutomationClient.Setup(f => f.ListAutomationAccounts(resourceGroupName, ref nextLink)).Returns((string a, string b) => new List());
// Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
this.cmdlet.ExecuteCmdlet();
// Assert
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCertificateTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCertificateTest.cs
new file mode 100644
index 000000000000..3566c2867068
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCertificateTest.cs
@@ -0,0 +1,89 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class GetAzureAutomationCertificateTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private GetAzureAutomationCertificate cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new GetAzureAutomationCertificate
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationCertificateByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string certificateName = "certificate";
+
+ this.mockAutomationClient.Setup(f => f.GetCertificate(resourceGroupName, accountName, certificateName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = certificateName;
+ this.cmdlet.SetParameterSet("ByCertificateName");
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.GetCertificate(resourceGroupName, accountName, certificateName), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationCertificateByAllSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListCertificates(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List());
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListCertificates(resourceGroupName, accountName, ref nextLink), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationConnectionTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationConnectionTest.cs
new file mode 100644
index 000000000000..83254184efe1
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationConnectionTest.cs
@@ -0,0 +1,110 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class GetAzureAutomationConnectionTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private GetAzureAutomationConnection cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new GetAzureAutomationConnection
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationConnectionByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string connectionName = "connection";
+
+ this.mockAutomationClient.Setup(f => f.GetConnection(resourceGroupName, accountName, connectionName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = connectionName;
+ this.cmdlet.SetParameterSet("ByConnectionName");
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.GetConnection(resourceGroupName, accountName, connectionName), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationConnectionByAllSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListConnections(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List());
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListConnections(resourceGroupName, accountName, ref nextLink), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationConnectionByTypeSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string connectionTypeName = "connectionType";
+
+ this.mockAutomationClient.Setup(f => f.ListConnectionsByType(resourceGroupName, accountName, connectionTypeName)).Returns((string a, string b, string c) => new List());
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.ConnectionTypeName = connectionTypeName;
+ this.cmdlet.SetParameterSet("ByConnectionTypeName");
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListConnectionsByType(resourceGroupName, accountName, connectionTypeName), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCredentialTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCredentialTest.cs
new file mode 100644
index 000000000000..39f14d584cf3
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationCredentialTest.cs
@@ -0,0 +1,87 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class GetAzureAutomationCredentialTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private GetAzureAutomationCredential cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new GetAzureAutomationCredential
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationCredentialByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string credentialName = "credential";
+
+ this.mockAutomationClient.Setup(f => f.GetCredential(resourceGroupName, accountName, credentialName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = credentialName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.GetCredential(resourceGroupName, accountName, credentialName), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationCredentialByAllSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListCredentials(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List());
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListCredentials(resourceGroupName, accountName, ref nextLink), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationJobTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationJobTest.cs
new file mode 100644
index 000000000000..4e330a040a13
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationJobTest.cs
@@ -0,0 +1,209 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class GetAzureAutomationJobTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private GetAzureAutomationJob cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new GetAzureAutomationJob
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationJobByRunbookNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListJobsByRunbookName(resourceGroupName, accountName, runbookName, null, null, null, ref nextLink));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.RunbookName = runbookName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListJobsByRunbookName(resourceGroupName, accountName, runbookName, null, null, null, ref nextLink), Times.Once());
+ }
+
+ public void GetAzureAutomationJobByRunbookNamAndStartTimeEndTimeeSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+ string nextLink = string.Empty;
+
+ DateTime startTime = new DateTime(2014, 12, 30, 17, 0, 0, 0);
+ DateTime endTime = new DateTime(2014, 12, 30, 18, 0, 0, 0);
+
+ this.mockAutomationClient.Setup(f => f.ListJobsByRunbookName(resourceGroupName, accountName, runbookName, startTime, endTime, null, ref nextLink));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.RunbookName = runbookName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListJobsByRunbookName(resourceGroupName, accountName, runbookName, startTime, endTime, null, ref nextLink), Times.Once());
+ }
+
+ public void GetAzureAutomationCompletedJobByRunbookNamAndStartTimeEndTimeeSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+ string nextLink = string.Empty;
+
+ DateTime startTime = new DateTime(2014, 12, 30, 17, 0, 0, 0);
+ DateTime endTime = new DateTime(2014, 12, 30, 18, 0, 0, 0);
+ string status = "Completed";
+
+ this.mockAutomationClient.Setup(f => f.ListJobsByRunbookName(resourceGroupName, accountName, runbookName, startTime, endTime, status, ref nextLink));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.RunbookName = runbookName;
+ this.cmdlet.Status = status;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListJobsByRunbookName(resourceGroupName, accountName, runbookName, startTime, endTime, status, ref nextLink), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationAllJobsSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListJobs(resourceGroupName, accountName, null, null, null, ref nextLink));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListJobs(resourceGroupName, accountName, null, null, null, ref nextLink), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationAllJobsBetweenStartAndEndTimeSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ DateTime startTime = new DateTime(2014, 12, 30, 17, 0, 0, 0);
+ DateTime endTime = new DateTime(2014, 12, 30, 18, 0, 0, 0);
+
+ // look for jobs between 5pm to 6pm on 30th december 2014
+ this.mockAutomationClient.Setup(f => f.ListJobs(resourceGroupName, accountName, startTime, endTime, null, ref nextLink));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.StartTime = startTime;
+ this.cmdlet.EndTime = endTime;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListJobs(resourceGroupName, accountName, startTime, endTime, null, ref nextLink), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationAllCompletedJobsBetweenStartAndEndTimeSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ DateTime startTime = new DateTime(2014, 12, 30, 17, 0, 0, 0);
+ DateTime endTime = new DateTime(2014, 12, 30, 18, 0, 0, 0);
+ string status = "Completed";
+
+ // look for jobs between 5pm to 6pm on 30th december 2014
+ this.mockAutomationClient.Setup(f => f.ListJobs(resourceGroupName, accountName, startTime, endTime, status, ref nextLink));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.StartTime = startTime;
+ this.cmdlet.EndTime = endTime;
+ this.cmdlet.Status = status;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListJobs(resourceGroupName, accountName, startTime, endTime, status, ref nextLink), Times.Once());
+ }
+
+ public void GetAzureAutomationJobByIdSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ Guid jobId = Guid.NewGuid();
+
+ // look for jobs between 5pm to 6pm on 30th december 2014
+ this.mockAutomationClient.Setup(f => f.GetJob(resourceGroupName, accountName, jobId));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Id = jobId;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.GetJob(resourceGroupName, accountName, jobId), Times.Once());
+ }
+
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationRunbookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationRunbookTest.cs
new file mode 100644
index 000000000000..8e99877007b1
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationRunbookTest.cs
@@ -0,0 +1,90 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class GetAzureAutomationRunbookTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private GetAzureAutomationRunbook cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new GetAzureAutomationRunbook
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationRunbookByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+
+ this.mockAutomationClient.Setup(f => f.GetRunbook(resourceGroupName, accountName, runbookName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = runbookName;
+ this.cmdlet.SetParameterSet("ByRunbookName");
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.GetRunbook(resourceGroupName, accountName, runbookName), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationRunbookByAllSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListRunbooks(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List()); ;
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.SetParameterSet("ByAll");
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListRunbooks(resourceGroupName, accountName, ref nextLink), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationScheduleTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationScheduleTest.cs
new file mode 100644
index 000000000000..86422586d72c
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationScheduleTest.cs
@@ -0,0 +1,90 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class GetAzureAutomationScheduleTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private GetAzureAutomationSchedule cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new GetAzureAutomationSchedule
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationScheduleByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+
+ this.mockAutomationClient.Setup(f => f.GetSchedule(resourceGroupName, accountName, scheduleName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByName);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.GetSchedule(resourceGroupName, accountName, scheduleName), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationScheduleByAllSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListSchedules(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List());
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByAll);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListSchedules(resourceGroupName, accountName, ref nextLink), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationScheduledRunbookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationScheduledRunbookTest.cs
new file mode 100644
index 000000000000..965bddf28504
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationScheduledRunbookTest.cs
@@ -0,0 +1,157 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class GetAzureAutomationScheduledRunbookTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private GetAzureAutomationScheduledRunbook cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new GetAzureAutomationScheduledRunbook
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationScheduledRunbookByIdSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ var jobScheduleId = new Guid();
+
+ this.mockAutomationClient.Setup(f => f.GetJobSchedule(resourceGroupName, accountName, jobScheduleId));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.JobScheduleId = jobScheduleId;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByJobScheduleId);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.GetJobSchedule(resourceGroupName, accountName, jobScheduleId), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationScheduledRunbookByrunbookNameAndScheduleNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+ string scheduleName = "schedule";
+
+ this.mockAutomationClient.Setup(f => f.GetJobSchedule(resourceGroupName, accountName, runbookName, scheduleName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.RunbookName = runbookName;
+ this.cmdlet.ScheduleName = scheduleName;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByRunbookNameAndScheduleName);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.GetJobSchedule(resourceGroupName, accountName, runbookName, scheduleName), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationScheduledRunbookByRunbookNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListJobSchedules(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List());
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.RunbookName = runbookName;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByRunbookName);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListJobSchedules(resourceGroupName, accountName, ref nextLink), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationScheduledRunbookByScheduleNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListJobSchedules(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List());
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.ScheduleName = scheduleName;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByScheduleName);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListJobSchedules(resourceGroupName, accountName, ref nextLink), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationScheduledRunbookByAllSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListJobSchedules(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List());
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByAll);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListJobSchedules(resourceGroupName, accountName, ref nextLink), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationVariableTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationVariableTest.cs
new file mode 100644
index 000000000000..3e4592ca0060
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationVariableTest.cs
@@ -0,0 +1,90 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class GetAzureAutomationVariableTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private GetAzureAutomationVariable cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new GetAzureAutomationVariable
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationVariableByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string variableName = "variable";
+
+ this.mockAutomationClient.Setup(f => f.GetVariable(resourceGroupName, accountName, variableName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = variableName;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByName);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.GetVariable(resourceGroupName, accountName, variableName), Times.Once());
+ }
+
+ [TestMethod]
+ public void GetAzureAutomationVariableByAllSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string nextLink = string.Empty;
+
+ this.mockAutomationClient.Setup(f => f.ListVariables(resourceGroupName, accountName, ref nextLink)).Returns((string a, string b, string c) => new List());
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByAll);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ListVariables(resourceGroupName, accountName, ref nextLink), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationWebhookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationWebhookTest.cs
index d0d3c6011b4c..183687f7b057 100644
--- a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationWebhookTest.cs
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/GetAzureAutomationWebhookTest.cs
@@ -20,7 +20,7 @@
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Moq;
-namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
{
[TestClass]
public class GetAzureAutomationWebhookTest : TestBase
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationAccountTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationAccountTest.cs
index deb2f3062141..bfbb3e3e9ed9 100644
--- a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationAccountTest.cs
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationAccountTest.cs
@@ -19,7 +19,7 @@
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Moq;
-namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
{
[TestClass]
public class NewAzureAutomationAccountTest : TestBase
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationCertificateTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationCertificateTest.cs
new file mode 100644
index 000000000000..6c87ee501b43
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationCertificateTest.cs
@@ -0,0 +1,80 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+using System.Management.Automation;
+using System.Security;
+using System;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class NewAzureAutomationCertificateTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private NewAzureAutomationCertificate cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new NewAzureAutomationCertificate
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationCertificateByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string certificateName = "certificate";
+ string path = "testCert.pfx";
+ string password = "password";
+ string description = "desc";
+
+ var secureString = new SecureString();
+ Array.ForEach(password.ToCharArray(), secureString.AppendChar);
+ secureString.MakeReadOnly();
+
+ this.mockAutomationClient.Setup(
+ f => f.CreateCertificate(resourceGroupName, accountName, certificateName, path, secureString, description, false));
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = certificateName;
+ this.cmdlet.Description = description;
+ this.cmdlet.Path = path;
+ this.cmdlet.Password = secureString;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.CreateCertificate(resourceGroupName, accountName, certificateName, path, secureString, description, false), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationConnectionTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationConnectionTest.cs
new file mode 100644
index 000000000000..2b4058a9017e
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationConnectionTest.cs
@@ -0,0 +1,76 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+using System.Management.Automation;
+using System.Security;
+using System;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class NewAzureAutomationConnectionTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private NewAzureAutomationConnection cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new NewAzureAutomationConnection
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationConnectionByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string connectionName = "connection";
+ string connectionTypeName = "connectiontype";
+ string password = "password";
+ string description = "desc";
+
+ this.mockAutomationClient.Setup(
+ f => f.CreateConnection(resourceGroupName, accountName, connectionName, connectionTypeName, null, description));
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = connectionName;
+ this.cmdlet.Description = description;
+ this.cmdlet.ConnectionTypeName = connectionTypeName;
+ this.cmdlet.ConnectionFieldValues = null;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.CreateConnection(resourceGroupName, accountName, connectionName, connectionTypeName, null, description), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationCredentialTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationCredentialTest.cs
new file mode 100644
index 000000000000..8e075f278b24
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationCredentialTest.cs
@@ -0,0 +1,81 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+using System.Management.Automation;
+using System.Security;
+using System;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class NewAzureAutomationCredentialTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private NewAzureAutomationCredential cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new NewAzureAutomationCredential
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationCredentialByPathSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string credentialName = "credential";
+ string username = "testUser";
+ string password = "password";
+ string description = "desc";
+
+ var secureString = new SecureString();
+ Array.ForEach(password.ToCharArray(), secureString.AppendChar);
+ secureString.MakeReadOnly();
+
+ var value = new PSCredential(username, secureString);
+
+ this.mockAutomationClient.Setup(
+ f => f.CreateCredential(resourceGroupName, accountName, credentialName, username, password, description));
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = credentialName;
+ this.cmdlet.Description = description;
+ this.cmdlet.Value = value;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.CreateCredential(resourceGroupName, accountName, credentialName, username, password, description), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationRunbookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationRunbookTest.cs
new file mode 100644
index 000000000000..64dd9f283e94
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationRunbookTest.cs
@@ -0,0 +1,73 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class NewAzureAutomationRunbookTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private NewAzureAutomationRunbook cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new NewAzureAutomationRunbook
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationRunbookByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+ string description = "desc";
+ var tags = new Dictionary();
+ tags.Add("tag1", "tags2");
+
+ this.mockAutomationClient.Setup(
+ f => f.CreateRunbookByName(resourceGroupName, accountName, runbookName, description, tags, null, null, null, false));
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = runbookName;
+ this.cmdlet.Description = description;
+ this.cmdlet.Tags = tags;
+ this.cmdlet.SetParameterSet("ByRunbookName");
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.CreateRunbookByName(resourceGroupName, accountName, runbookName, description, tags, null, null, null, false), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationScheduleTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationScheduleTest.cs
new file mode 100644
index 000000000000..37c93fc901f1
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationScheduleTest.cs
@@ -0,0 +1,325 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Linq;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class NewAzureAutomationScheduleTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private NewAzureAutomationSchedule cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new NewAzureAutomationSchedule
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationScheduleByOneTimeSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+
+ this.mockAutomationClient.Setup(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()));
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.StartTime = DateTimeOffset.Now;
+ this.cmdlet.OneTime = true;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByOneTime);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient
+ .Verify(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()), Times.Once());
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationScheduleByDailySuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+ byte dayInterval = 1;
+
+ this.mockAutomationClient.Setup(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()));
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.StartTime = DateTimeOffset.Now;
+ this.cmdlet.DayInterval = dayInterval;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByDaily);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient
+ .Verify(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()), Times.Once());
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationScheduleByHourlySuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+ byte hourInterval = 1;
+
+ this.mockAutomationClient.Setup(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()));
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.StartTime = DateTimeOffset.Now;
+ this.cmdlet.HourInterval = hourInterval;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByHourly);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient
+ .Verify(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()), Times.Once());
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationScheduleByDailyWithDefaultExpiryTimeDayIntervalSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+ byte dayInterval = 1;
+
+ this.mockAutomationClient
+ .Setup(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()))
+ .Returns((string a, string b, Schedule s) => s);
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.StartTime = DateTimeOffset.Now;
+ this.cmdlet.DayInterval = dayInterval;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByDaily);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient
+ .Verify(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()), Times.Once());
+
+ Assert.AreEqual(1, ((MockCommandRuntime)this.cmdlet.CommandRuntime).OutputPipeline.Count);
+ var schedule = (Schedule)((MockCommandRuntime)this.cmdlet.CommandRuntime)
+ .OutputPipeline
+ .FirstOrDefault();
+ Assert.IsNotNull(schedule);
+ Assert.AreEqual(scheduleName, schedule.Name, "Schedule name is unexpectedly {0}", schedule.Name);
+
+ // Test for default values
+ Assert.AreEqual(
+ Constants.DefaultScheduleExpiryTime,
+ schedule.ExpiryTime,
+ "Expiry time is unexpectedly {0}",
+ schedule.ExpiryTime);
+ Assert.AreEqual(
+ dayInterval,
+ schedule.Interval,
+ "Day Interval is unexpectedly {0}",
+ schedule.Interval);
+ Assert.AreEqual(
+ ScheduleFrequency.Day,
+ schedule.Frequency,
+ "Day Frequency is unexpectedly {0}",
+ schedule.Frequency);
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationScheduleByHourlyWithDefaultExpiryTimeDayIntervalSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+ byte hourInterval = 1;
+
+ this.mockAutomationClient
+ .Setup(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()))
+ .Returns((string a, string b, Schedule s) => s);
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.StartTime = DateTimeOffset.Now;
+ this.cmdlet.HourInterval = hourInterval;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByHourly);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient
+ .Verify(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()), Times.Once());
+
+ Assert.AreEqual(1, ((MockCommandRuntime)this.cmdlet.CommandRuntime).OutputPipeline.Count);
+ var schedule = (Schedule)((MockCommandRuntime)this.cmdlet.CommandRuntime)
+ .OutputPipeline
+ .FirstOrDefault();
+ Assert.IsNotNull(schedule);
+ Assert.AreEqual(scheduleName, schedule.Name, "Schedule name is unexpectedly {0}", schedule.Name);
+
+ // Test for default values
+ Assert.AreEqual(
+ Constants.DefaultScheduleExpiryTime,
+ schedule.ExpiryTime,
+ "Expiry time is unexpectedly {0}",
+ schedule.ExpiryTime);
+ Assert.AreEqual(
+ hourInterval,
+ schedule.Interval,
+ "Hour Interval is unexpectedly {0}",
+ schedule.Interval);
+ Assert.AreEqual(
+ ScheduleFrequency.Hour,
+ schedule.Frequency,
+ "Hour Frequency is unexpectedly {0}",
+ schedule.Frequency);
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationScheduleByDailyWithExpiryTimeSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+ byte dayInterval = 1;
+ var startTime = DateTimeOffset.Now;
+ var expiryTime = startTime.AddDays(10);
+
+ this.mockAutomationClient
+ .Setup(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()))
+ .Returns((string a, string b, Schedule s) => s);
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.StartTime = startTime;
+ this.cmdlet.ExpiryTime = expiryTime;
+ this.cmdlet.DayInterval = dayInterval;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByDaily);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient
+ .Verify(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()), Times.Once());
+
+ Assert.AreEqual(1, ((MockCommandRuntime)this.cmdlet.CommandRuntime).OutputPipeline.Count);
+ var schedule = (Schedule)((MockCommandRuntime)this.cmdlet.CommandRuntime)
+ .OutputPipeline
+ .FirstOrDefault();
+ Assert.IsNotNull(schedule);
+ Assert.AreEqual(scheduleName, schedule.Name, "Schedule name is unexpectedly {0}", schedule.Name);
+
+ Assert.AreEqual(
+ expiryTime,
+ schedule.ExpiryTime,
+ "Expiry time is unexpectedly {0}",
+ schedule.ExpiryTime);
+ Assert.AreEqual(
+ dayInterval,
+ schedule.Interval,
+ "Day Interval is unexpectedly {0}",
+ schedule.Interval);
+ Assert.AreEqual(
+ ScheduleFrequency.Day,
+ schedule.Frequency,
+ "Day Frequency is unexpectedly {0}",
+ schedule.Frequency);
+ }
+
+ [TestMethod]
+ public void NewAzureAutomationScheduleByHourlyWithExpiryTimeSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+ byte hourInterval = 2;
+ var startTime = DateTimeOffset.Now;
+ var expiryTime = startTime.AddDays(10);
+
+ this.mockAutomationClient
+ .Setup(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()))
+ .Returns((string a, string b, Schedule s) => s);
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.StartTime = startTime;
+ this.cmdlet.ExpiryTime = expiryTime;
+ this.cmdlet.HourInterval = hourInterval;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByHourly);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient
+ .Verify(f => f.CreateSchedule(resourceGroupName, accountName, It.IsAny()), Times.Once());
+
+ Assert.AreEqual(1, ((MockCommandRuntime)this.cmdlet.CommandRuntime).OutputPipeline.Count);
+ var schedule = (Schedule)((MockCommandRuntime)this.cmdlet.CommandRuntime)
+ .OutputPipeline
+ .FirstOrDefault();
+ Assert.IsNotNull(schedule);
+ Assert.AreEqual(scheduleName, schedule.Name, "Schedule name is unexpectedly {0}", schedule.Name);
+
+ // Test for default values
+ Assert.AreEqual(
+ expiryTime,
+ schedule.ExpiryTime,
+ "Expiry time is unexpectedly {0}",
+ schedule.ExpiryTime);
+ Assert.AreEqual(
+ hourInterval,
+ schedule.Interval,
+ "Hour Interval is unexpectedly {0}",
+ schedule.Interval);
+ Assert.AreEqual(
+ ScheduleFrequency.Hour,
+ schedule.Frequency,
+ "Hour Frequency is unexpectedly {0}",
+ schedule.Frequency);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationVariableTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationVariableTest.cs
new file mode 100644
index 000000000000..9f0da9adeae7
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationVariableTest.cs
@@ -0,0 +1,84 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Linq;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class NewAzureAutomationVariableTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private NewAzureAutomationVariable cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new NewAzureAutomationVariable
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ [Ignore]
+ public void NewAzureAutomationVariableByPathSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string variableName = "variable";
+ string value = "value";
+ string description = "desc";
+
+ var variable = new Variable();
+ variable.ResourceGroupName = resourceGroupName;
+ variable.Name = variableName;
+ variable.Value = value;
+ variable.Description = description;
+ variable.Encrypted = true;
+ variable.AutomationAccountName = accountName;
+
+ this.mockAutomationClient.Setup(
+ f => f.CreateVariable(variable));
+
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = variableName;
+ this.cmdlet.Description = description;
+ this.cmdlet.Value = value;
+ this.cmdlet.Encrypted = true;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByName);
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.CreateVariable(variable), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationWebhookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationWebhookTest.cs
index de06407b96d2..17372d0b10fa 100644
--- a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationWebhookTest.cs
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/NewAzureAutomationWebhookTest.cs
@@ -20,7 +20,7 @@
using Moq;
using System;
-namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
{
[TestClass]
public class NewAzureAutomationWebhookTest : TestBase
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/PublishAzureAutomationRunbookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/PublishAzureAutomationRunbookTest.cs
new file mode 100644
index 000000000000..8e173632c0a8
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/PublishAzureAutomationRunbookTest.cs
@@ -0,0 +1,66 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class PublishAzureAutomationRunbookTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private PublishAzureAutomationRunbook cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new PublishAzureAutomationRunbook
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void PublishAzureAutomationRunbookByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+
+ this.mockAutomationClient.Setup(f => f.PublishRunbook(resourceGroupName, accountName, runbookName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = runbookName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.PublishRunbook(resourceGroupName, accountName, runbookName), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RegisterAzureAutomationScheduledRunbookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RegisterAzureAutomationScheduledRunbookTest.cs
new file mode 100644
index 000000000000..a9316c283f1c
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RegisterAzureAutomationScheduledRunbookTest.cs
@@ -0,0 +1,69 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class RegisterAzureAutomationScheduledJobTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private RegisterAzureAutomationScheduledRunbook cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new RegisterAzureAutomationScheduledRunbook
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void RegisterAzureAutomationScheduledRunbookSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+ string scheduleName = "schedule";
+
+ this.mockAutomationClient.Setup(
+ f => f.RegisterScheduledRunbook(resourceGroupName, accountName, runbookName, scheduleName, null));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.RunbookName = runbookName;
+ this.cmdlet.ScheduleName = scheduleName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.RegisterScheduledRunbook(resourceGroupName, accountName, runbookName, scheduleName, null), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationAccountTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationAccountTest.cs
index be031020e1f4..612777efbe05 100644
--- a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationAccountTest.cs
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationAccountTest.cs
@@ -20,7 +20,7 @@
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Moq;
-namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
{
[TestClass]
public class RemoveAzureAutomationAccountTest : TestBase
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationCertificateTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationCertificateTest.cs
new file mode 100644
index 000000000000..c62c2860628a
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationCertificateTest.cs
@@ -0,0 +1,67 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class RemoveAzureAutomationCertificateTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private RemoveAzureAutomationCertificate cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new RemoveAzureAutomationCertificate
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void RemoveAzureAutomationCertificateByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string certificateName = "cert";
+
+ this.mockAutomationClient.Setup(f => f.DeleteCertificate(resourceGroupName, accountName, certificateName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = certificateName;
+ this.cmdlet.Force = true;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.DeleteCertificate(resourceGroupName, accountName, certificateName), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationConnectionTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationConnectionTest.cs
new file mode 100644
index 000000000000..80bfeda8b083
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationConnectionTest.cs
@@ -0,0 +1,67 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class RemoveAzureAutomationConnectionTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private RemoveAzureAutomationConnection cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new RemoveAzureAutomationConnection
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void RemoveAzureAutomationConnectionByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string connectionName = "connection";
+
+ this.mockAutomationClient.Setup(f => f.DeleteConnection(resourceGroupName, accountName, connectionName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = connectionName;
+ this.cmdlet.Force = true;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.DeleteConnection(resourceGroupName, accountName, connectionName), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationModuleTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationModuleTest.cs
new file mode 100644
index 000000000000..f3d2b19e035a
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationModuleTest.cs
@@ -0,0 +1,67 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class RemoveAzureAutomationModuleTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private RemoveAzureAutomationModule cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new RemoveAzureAutomationModule
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void RemoveAzureAutomationModuleByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string moduleName = "module";
+
+ this.mockAutomationClient.Setup(f => f.DeleteModule(resourceGroupName, accountName, moduleName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = moduleName;
+ this.cmdlet.Force = true;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.DeleteModule(resourceGroupName, accountName, moduleName), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationRunbookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationRunbookTest.cs
new file mode 100644
index 000000000000..24cce73bf8f4
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationRunbookTest.cs
@@ -0,0 +1,67 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class RemoveAzureAutomationRunbookTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private RemoveAzureAutomationRunbook cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new RemoveAzureAutomationRunbook
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void RemoveAzureAutomationRunbookByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+
+ this.mockAutomationClient.Setup(f => f.DeleteRunbook(resourceGroupName, accountName, runbookName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = runbookName;
+ this.cmdlet.Force = true;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.DeleteRunbook(resourceGroupName, accountName, runbookName), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationScheduleTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationScheduleTest.cs
new file mode 100644
index 000000000000..277769340aa1
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationScheduleTest.cs
@@ -0,0 +1,67 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class RemoveAzureAutomationScheduleTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private RemoveAzureAutomationSchedule cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new RemoveAzureAutomationSchedule
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void RemoveAzureAutomationScheduleByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+
+ this.mockAutomationClient.Setup(f => f.DeleteSchedule(resourceGroupName, accountName, scheduleName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.Force = true;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.DeleteSchedule(resourceGroupName, accountName, scheduleName), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationVariableTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationVariableTest.cs
new file mode 100644
index 000000000000..1e21e689e4fd
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationVariableTest.cs
@@ -0,0 +1,67 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class RemoveAzureAutomationVariableTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private RemoveAzureAutomationVariable cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new RemoveAzureAutomationVariable
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void RemoveAzureAutomationVariableByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string variableName = "variable";
+
+ this.mockAutomationClient.Setup(f => f.DeleteVariable(resourceGroupName, accountName, variableName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = variableName;
+ this.cmdlet.Force = true;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.DeleteVariable(resourceGroupName, accountName, variableName), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationWebhookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationWebhookTest.cs
index 469d514ca486..df4c7c4ded81 100644
--- a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationWebhookTest.cs
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/RemoveAzureAutomationWebhookTest.cs
@@ -20,7 +20,7 @@
using Microsoft.WindowsAzure.Commands.Utilities.Common;
using Moq;
-namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
{
[TestClass]
public class RemoveAzureAutomationWebhookTest : TestBase
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/ResumeAzureAutomationJobTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/ResumeAzureAutomationJobTest.cs
new file mode 100644
index 000000000000..7b1c73f1e37a
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/ResumeAzureAutomationJobTest.cs
@@ -0,0 +1,68 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class ResumeAzureAutomationJobTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private ResumeAzureAutomationJob cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new ResumeAzureAutomationJob
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void ResumeAzureAutomationJobSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ Guid jobId = Guid.NewGuid();
+
+ this.mockAutomationClient.Setup(f => f.ResumeJob(resourceGroupName, accountName, jobId));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Id = jobId;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.ResumeJob(resourceGroupName, accountName, jobId), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationCredentialTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationCredentialTest.cs
new file mode 100644
index 000000000000..ef6a834f7332
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationCredentialTest.cs
@@ -0,0 +1,100 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+using System.Security;
+using System.Management.Automation;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class SetAzureAutomationCredentialTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private SetAzureAutomationCredential cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new SetAzureAutomationCredential
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void SetAzureAutomationCredentialByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string credentialName = "credential";
+
+ this.mockAutomationClient.Setup(f => f.UpdateCredential(resourceGroupName, accountName, credentialName, null, null, null));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = credentialName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.UpdateCredential(resourceGroupName, accountName, credentialName, null, null, null), Times.Once());
+ }
+
+ [TestMethod]
+ public void SetAzureAutomationCredentialByNameWithParametersSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string credentialName = "credential";
+ string username = "testUser";
+ string password = "password";
+ string description = "desc";
+
+ var secureString = new SecureString();
+ Array.ForEach(password.ToCharArray(), secureString.AppendChar);
+ secureString.MakeReadOnly();
+
+ var value = new PSCredential(username, secureString);
+
+ this.mockAutomationClient.Setup(f => f.UpdateCredential(resourceGroupName, accountName, credentialName, username, password, description));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = credentialName;
+ this.cmdlet.Description = description;
+ this.cmdlet.Value = value;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.UpdateCredential(resourceGroupName, accountName, credentialName, username, password, description), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationRunbookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationRunbookTest.cs
new file mode 100644
index 000000000000..eebcc93a0084
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationRunbookTest.cs
@@ -0,0 +1,92 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class SetAzureAutomationRunbookTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private SetAzureAutomationRunbook cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new SetAzureAutomationRunbook
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void SetAzureAutomationRunbookByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+
+ this.mockAutomationClient.Setup(f => f.UpdateRunbook(resourceGroupName, accountName, runbookName, null, null, null, null));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = runbookName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.UpdateRunbook(resourceGroupName, accountName, runbookName, null, null, null, null), Times.Once());
+ }
+
+ [TestMethod]
+ public void SetAzureAutomationRunbookByNameWithParametersSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+ bool? logProgress = false;
+ var tags = new Dictionary();
+ tags.Add("tag1", "tags2");
+
+ this.mockAutomationClient.Setup(f => f.UpdateRunbook(resourceGroupName, accountName, runbookName, null, tags, logProgress, null));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = runbookName;
+ this.cmdlet.Tags = tags;
+ this.cmdlet.LogProgress = logProgress;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.UpdateRunbook(resourceGroupName, accountName, runbookName, null, tags, logProgress, null), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationScheduleTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationScheduleTest.cs
new file mode 100644
index 000000000000..d6cb509ab80c
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationScheduleTest.cs
@@ -0,0 +1,68 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class SetAzureAutomationScheduleTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private SetAzureAutomationSchedule cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new SetAzureAutomationSchedule
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void SetAzureAutomationScheduleByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string scheduleName = "schedule";
+ string description = "desc";
+
+ this.mockAutomationClient.Setup(f => f.UpdateSchedule(resourceGroupName, accountName, scheduleName, null, description));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = scheduleName;
+ this.cmdlet.Description = description;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.UpdateSchedule(resourceGroupName, accountName, scheduleName, null, description), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationWebhookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationWebhookTest.cs
index bb837670fe6b..0ef67fe995c2 100644
--- a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationWebhookTest.cs
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SetAzureAutomationWebhookTest.cs
@@ -19,7 +19,7 @@
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Moq;
-namespace Microsoft.Azure.Commands.Automation.Test.UnitTests
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
{
[TestClass]
public class SetAzureAutomationWebhookTest : TestBase
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/StartAzureAutomationRunbookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/StartAzureAutomationRunbookTest.cs
new file mode 100644
index 000000000000..3e9a75ef16e1
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/StartAzureAutomationRunbookTest.cs
@@ -0,0 +1,66 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class StartAzureAutomationRunbookTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private StartAzureAutomationRunbook cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new StartAzureAutomationRunbook
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void StartAzureAutomationRunbookByNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+
+ this.mockAutomationClient.Setup(f => f.StartRunbook(resourceGroupName, accountName, runbookName, null, null));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Name = runbookName;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.StartRunbook(resourceGroupName, accountName, runbookName, null, null), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/StopAzureAutomationJobTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/StopAzureAutomationJobTest.cs
new file mode 100644
index 000000000000..d3d992390378
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/StopAzureAutomationJobTest.cs
@@ -0,0 +1,68 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class StopAzureAutomationJobTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private StopAzureAutomationJob cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new StopAzureAutomationJob
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void StopAzureAutomationJobSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ Guid jobId = Guid.NewGuid();
+
+ this.mockAutomationClient.Setup(f => f.StopJob(resourceGroupName, accountName, jobId));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Id = jobId;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.StopJob(resourceGroupName, accountName, jobId), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SuspendAzureAutomationJobTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SuspendAzureAutomationJobTest.cs
new file mode 100644
index 000000000000..c566ac6b7d6a
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/SuspendAzureAutomationJobTest.cs
@@ -0,0 +1,68 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class SuspendAzureAutomationJobTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private SuspendAzureAutomationJob cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new SuspendAzureAutomationJob
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void SuspendAzureAutomationJobSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ Guid jobId = Guid.NewGuid();
+
+ this.mockAutomationClient.Setup(f => f.SuspendJob(resourceGroupName, accountName, jobId));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.Id = jobId;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.SuspendJob(resourceGroupName, accountName, jobId), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/UnregisterAzureAutomationScheduledRunbookTest.cs b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/UnregisterAzureAutomationScheduledRunbookTest.cs
new file mode 100644
index 000000000000..e91e179d282c
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation.Test/UnitTests/UnregisterAzureAutomationScheduledRunbookTest.cs
@@ -0,0 +1,93 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.WindowsAzure.Commands.Common.Test.Mocks;
+using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+using Moq;
+
+namespace Microsoft.Azure.Commands.ResourceManager.Automation.Test.UnitTests
+{
+ [TestClass]
+ public class UnregisterAzureAutomationScheduledRunbookTest : TestBase
+ {
+ private Mock mockAutomationClient;
+
+ private MockCommandRuntime mockCommandRuntime;
+
+ private UnregisterAzureAutomationScheduledRunbook cmdlet;
+
+ [TestInitialize]
+ public void SetupTest()
+ {
+ this.mockAutomationClient = new Mock();
+ this.mockCommandRuntime = new MockCommandRuntime();
+ this.cmdlet = new UnregisterAzureAutomationScheduledRunbook
+ {
+ AutomationClient = this.mockAutomationClient.Object,
+ CommandRuntime = this.mockCommandRuntime
+ };
+ }
+
+ [TestMethod]
+ public void UnregisterAzureAutomationScheduledRunbookByIdSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ var jobScheduleId = new Guid();
+
+ this.mockAutomationClient.Setup(f => f.UnregisterScheduledRunbook(resourceGroupName, accountName, jobScheduleId));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.JobScheduleId = jobScheduleId;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByJobScheduleId);
+ this.cmdlet.Force = true;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.UnregisterScheduledRunbook(resourceGroupName, accountName, jobScheduleId), Times.Once());
+ }
+
+ [TestMethod]
+ public void UnregisterAzureAutomationScheduledRunbookByRunbookNameAndScheduleNameSuccessfull()
+ {
+ // Setup
+ string resourceGroupName = "resourceGroup";
+ string accountName = "automation";
+ string runbookName = "runbook";
+ string scheduleName = "schedule";
+
+ this.mockAutomationClient.Setup(f => f.UnregisterScheduledRunbook(resourceGroupName, accountName, runbookName, scheduleName));
+
+ // Test
+ this.cmdlet.ResourceGroupName = resourceGroupName;
+ this.cmdlet.AutomationAccountName = accountName;
+ this.cmdlet.RunbookName = runbookName;
+ this.cmdlet.ScheduleName = scheduleName;
+ this.cmdlet.SetParameterSet(AutomationCmdletParameterSets.ByRunbookNameAndScheduleName);
+ this.cmdlet.Force = true;
+ this.cmdlet.ExecuteCmdlet();
+
+ // Assert
+ this.mockAutomationClient.Verify(f => f.UnregisterScheduledRunbook(resourceGroupName, accountName, runbookName, scheduleName), Times.Once());
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/ExportAzureAutomationRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/ExportAzureAutomationRunbook.cs
new file mode 100644
index 000000000000..bac672c16d2e
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/ExportAzureAutomationRunbook.cs
@@ -0,0 +1,92 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using System.Globalization;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation runbook definitions for a given account.
+ ///
+ [Cmdlet(VerbsData.Export, "AzureAutomationRunbook")]
+ [OutputType(typeof(DirectoryInfo))]
+ public class ExportAzureAutomationRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the runbook name
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name.")]
+ [Alias("RunbookName")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the runbook version type
+ ///
+ [Parameter(Mandatory = false, HelpMessage = "Specifies what version of the runbook, draft or published, should be returned.")]
+ [ValidateSet(Constants.Published, Constants.Draft, IgnoreCase = true)]
+ public string Slot { get; set; }
+
+ ///
+ /// Gets or sets the output folder for the configuration script.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The folder where the runbook should be placed.")]
+ public string OutputFolder { get; set; }
+
+ ///
+ /// Gets or sets switch parameter to confirm overwriting of existing local runbook file.
+ ///
+ [Parameter(Mandatory = false, HelpMessage = "Forces an overwrite of an existing local file with the same name.")]
+ public SwitchParameter Force { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ bool? isDraft = this.IsDraft();
+
+ var outputFolder = this.AutomationClient.ExportRunbook(this.ResourceGroupName, this.AutomationAccountName, this.Name, isDraft, this.OutputFolder, this.Force.IsPresent);
+
+ this.WriteObject(outputFolder, true);
+ }
+
+ ///
+ /// Returns null if Slot is not provided; otherwise returns true if Slot is Draft.
+ ///
+ ///
+ /// The .
+ ///
+ private bool? IsDraft()
+ {
+ bool? isDraft = null;
+
+ if (this.Slot != null)
+ {
+ isDraft = (0 == String.Compare(this.Slot, Constants.Draft, CultureInfo.InvariantCulture,
+ CompareOptions.OrdinalIgnoreCase));
+ }
+
+ return isDraft;
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationCertificate.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationCertificate.cs
new file mode 100644
index 000000000000..582b4472712c
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationCertificate.cs
@@ -0,0 +1,66 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets a certificate for automation.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureAutomationCertificate", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
+ [OutputType(typeof(CertificateInfo))]
+ public class GetAzureAutomationCertificate : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the certificate name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The certificate name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ IEnumerable ret = null;
+ if (this.ParameterSetName == AutomationCmdletParameterSets.ByCertificateName)
+ {
+ ret = new List
+ {
+ this.AutomationClient.GetCertificate(this.ResourceGroupName, this.AutomationAccountName, this.Name)
+ };
+ this.GenerateCmdletOutput(ret);
+ }
+ else
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ ret = this.AutomationClient.ListCertificates(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
+ this.GenerateCmdletOutput(ret);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationConnection.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationConnection.cs
new file mode 100644
index 000000000000..2740179b40cd
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationConnection.cs
@@ -0,0 +1,78 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets a connection for automation.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureAutomationConnection", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
+ [OutputType(typeof(Connection))]
+ public class GetAzureAutomationConnection : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the connection name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConnectionName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The connection name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the connection name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConnectionTypeName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The connection name.")]
+ [ValidateNotNullOrEmpty]
+ public string ConnectionTypeName { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ IEnumerable ret = null;
+ if (this.ParameterSetName == AutomationCmdletParameterSets.ByConnectionName)
+ {
+ ret = new List
+ {
+ this.AutomationClient.GetConnection(this.ResourceGroupName, this.AutomationAccountName, this.Name)
+ };
+ this.GenerateCmdletOutput(ret);
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByConnectionTypeName)
+ {
+ ret = this.AutomationClient.ListConnectionsByType(this.ResourceGroupName, this.AutomationAccountName, this.ConnectionTypeName);
+ this.GenerateCmdletOutput(ret);
+ }
+ else
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ ret = this.AutomationClient.ListConnections(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
+ this.GenerateCmdletOutput(ret);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationCredential.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationCredential.cs
new file mode 100644
index 000000000000..6c333089232d
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationCredential.cs
@@ -0,0 +1,67 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets a Credential for automation.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
+ [OutputType(typeof(CredentialInfo))]
+ public class GetAzureAutomationCredential : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the credential name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The credential name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ IEnumerable ret = null;
+ if (!string.IsNullOrEmpty(this.Name))
+ {
+ ret = new List
+ {
+ this.AutomationClient.GetCredential(this.ResourceGroupName, this.AutomationAccountName, this.Name)
+ };
+
+ this.GenerateCmdletOutput(ret);
+ }
+ else
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ ret = this.AutomationClient.ListCredentials(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
+ this.GenerateCmdletOutput(ret);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationJob.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationJob.cs
new file mode 100644
index 000000000000..4b99d750b55d
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationJob.cs
@@ -0,0 +1,107 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets a Job object for automation.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureAutomationJob", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
+ [OutputType(typeof(Microsoft.Azure.Commands.Automation.Model.Job))]
+ public class GetAzureAutomationJob : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the job id.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByJobId, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The job id.")]
+ [Alias("JobId")]
+ public Guid Id { get; set; }
+
+ ///
+ /// Gets or sets the runbook name of the job.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = true, HelpMessage = "The runbook name of the job.")]
+ [Alias("Name")]
+ public string RunbookName { get; set; }
+
+ ///
+ /// Gets or sets the status of a job.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = false, HelpMessage = "The runbook name of the job.")]
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs based on their status.")]
+ [ValidateSet("Completed", "Failed", "Queued", "Starting", "Resuming", "Running", "Stopped", "Stopping", "Suspended", "Suspending", "Activating")]
+ public string Status { get; set; }
+
+ ///
+ /// Gets or sets the start time filter.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = false, HelpMessage = "Filter jobs so that job start time >= StartTime.")]
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs so that job start time >= StartTime.")]
+ public DateTimeOffset? StartTime { get; set; }
+
+ ///
+ /// Gets or sets the end time filter.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = false, HelpMessage = "Filter jobs so that job end time <= EndTime.")]
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByAll, Mandatory = false, HelpMessage = "Filter jobs so that job end time <= EndTime.")]
+ public DateTimeOffset? EndTime { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ IEnumerable jobs = null;
+
+ if (this.Id != null && !Guid.Empty.Equals(this.Id))
+ {
+ // ByJobId
+ jobs = new List { this.AutomationClient.GetJob(this.ResourceGroupName, this.AutomationAccountName, this.Id) };
+ this.WriteObject(jobs, true);
+ }
+ else if (this.RunbookName != null)
+ {
+ // ByRunbookName
+ var nextLink = string.Empty;
+
+ do
+ {
+ jobs = this.AutomationClient.ListJobsByRunbookName(this.ResourceGroupName, this.AutomationAccountName, this.RunbookName, this.StartTime, this.EndTime, this.Status, ref nextLink);
+ this.WriteObject(jobs, true);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ else
+ {
+ // ByAll
+ var nextLink = string.Empty;
+
+ do
+ {
+ jobs = this.AutomationClient.ListJobs(this.ResourceGroupName, this.AutomationAccountName, this.StartTime, this.EndTime, this.Status, ref nextLink);
+ this.WriteObject(jobs, true);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationJobOutput.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationJobOutput.cs
new file mode 100644
index 000000000000..663230d05b2e
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationJobOutput.cs
@@ -0,0 +1,60 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation variables for a given account.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureAutomationJobOutput")]
+ [OutputType(typeof(JobStream))]
+ public class GetAzureAutomationJobOutput : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the job id
+ ///
+ [Alias("JobId")]
+ [Parameter(Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, HelpMessage = "The job name or Id")]
+ public Guid Id { get; set; }
+
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The stream type. Defaults to Any.")]
+ public StreamType Stream { get; set; }
+
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Retrieves output created after this time")]
+ public DateTimeOffset? StartTime { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ var ret = this.AutomationClient.GetJobStream(this.ResourceGroupName, this.AutomationAccountName, this.Id, this.StartTime, this.Stream.ToString(), ref nextLink);
+ this.GenerateCmdletOutput(ret);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationRunbook.cs
new file mode 100644
index 000000000000..c6fdbe62df4c
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationRunbook.cs
@@ -0,0 +1,68 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation runbooks for a given account.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureAutomationRunbook", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
+ [OutputType(typeof(Runbook))]
+ public class GetAzureAutomationRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the runbook name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name.")]
+ [Alias("RunbookName")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ IEnumerable ret = null;
+ if (this.ParameterSetName == AutomationCmdletParameterSets.ByRunbookName)
+ {
+ ret = new List
+ {
+ this.AutomationClient.GetRunbook(this.ResourceGroupName, this.AutomationAccountName, this.Name)
+ };
+
+ this.GenerateCmdletOutput(ret);
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByAll)
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ ret = this.AutomationClient.ListRunbooks(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
+ this.GenerateCmdletOutput(ret);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationSchedule.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationSchedule.cs
new file mode 100644
index 000000000000..51d229e23882
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationSchedule.cs
@@ -0,0 +1,69 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation schedules for a given account.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureAutomationSchedule", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
+ [OutputType(typeof(Schedule))]
+ public class GetAzureAutomationSchedule : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the schedule name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The schedule name.")]
+ [Alias("ScheduleName")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ IEnumerable schedules = null;
+ if (this.ParameterSetName == AutomationCmdletParameterSets.ByName)
+ {
+ schedules = new List
+ {
+ this.AutomationClient.GetSchedule(
+ this.ResourceGroupName, this.AutomationAccountName, this.Name)
+ };
+ this.GenerateCmdletOutput(schedules);
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByAll)
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ schedules = this.AutomationClient.ListSchedules(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
+ this.GenerateCmdletOutput(schedules);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationScheduledRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationScheduledRunbook.cs
new file mode 100644
index 000000000000..50443fff4bcd
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationScheduledRunbook.cs
@@ -0,0 +1,121 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation job schedules for a given account.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureAutomationScheduledRunbook", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
+ [OutputType(typeof(JobSchedule))]
+ public class GetAzureAutomationScheduledRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the job id.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByJobScheduleId, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The job schedule id.")]
+ public Guid? JobScheduleId { get; set; }
+
+ ///
+ /// Gets or sets the runbook name of the job.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name of the job schedule.")]
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name of the job schedule.")]
+ [Alias("Name")]
+ public string RunbookName { get; set; }
+
+ ///
+ /// Gets or sets the runbook name of the job.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The schedule name of the job schedule.")]
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The schedule name of the job schedule.")]
+ public string ScheduleName { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ IEnumerable jobSchedules = null;
+
+ if (this.ParameterSetName == AutomationCmdletParameterSets.ByJobScheduleId)
+ {
+ jobSchedules = new List
+ {
+ this.AutomationClient.GetJobSchedule(
+ this.ResourceGroupName, this.AutomationAccountName, this.JobScheduleId .Value)
+ };
+ this.GenerateCmdletOutput(jobSchedules);
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByRunbookNameAndScheduleName)
+ {
+ jobSchedules = new List
+ {
+ this.AutomationClient.GetJobSchedule(
+ this.ResourceGroupName, this.AutomationAccountName, this.RunbookName, this.ScheduleName)
+ };
+ this.GenerateCmdletOutput(jobSchedules);
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByRunbookName)
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ var schedules = this.AutomationClient.ListJobSchedules(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
+ if (schedules != null)
+ {
+ this.GenerateCmdletOutput(schedules.ToList().Where(js => String.Equals(js.RunbookName, this.RunbookName, StringComparison.OrdinalIgnoreCase)));
+ }
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByScheduleName)
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ var schedules = this.AutomationClient.ListJobSchedules(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
+ if (schedules != null)
+ {
+ this.GenerateCmdletOutput(schedules.ToList().Where(js => String.Equals(js.ScheduleName, this.ScheduleName, StringComparison.OrdinalIgnoreCase)));
+ }
+
+ } while (!string.IsNullOrEmpty(nextLink));
+
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByAll)
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ jobSchedules = this.AutomationClient.ListJobSchedules(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
+ this.GenerateCmdletOutput(jobSchedules);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationVariable.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationVariable.cs
new file mode 100644
index 000000000000..6f15206e08c3
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/GetAzureAutomationVariable.cs
@@ -0,0 +1,66 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation variables for a given account.
+ ///
+ [Cmdlet(VerbsCommon.Get, "AzureAutomationVariable", DefaultParameterSetName = AutomationCmdletParameterSets.ByAll)]
+ [OutputType(typeof(Variable))]
+ public class GetAzureAutomationVariable : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the variable name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The variable name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ IEnumerable ret = null;
+ if (this.ParameterSetName == AutomationCmdletParameterSets.ByName)
+ {
+ ret = new List
+ {
+ this.AutomationClient.GetVariable(this.ResourceGroupName, this.AutomationAccountName, this.Name)
+ };
+ this.GenerateCmdletOutput(ret);
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByAll)
+ {
+ var nextLink = string.Empty;
+
+ do
+ {
+ ret = this.AutomationClient.ListVariables(this.ResourceGroupName, this.AutomationAccountName, ref nextLink);
+ this.GenerateCmdletOutput(ret);
+
+ } while (!string.IsNullOrEmpty(nextLink));
+ }
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/ImportAzureAutomationRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/ImportAzureAutomationRunbook.cs
new file mode 100644
index 000000000000..dd56a875d372
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/ImportAzureAutomationRunbook.cs
@@ -0,0 +1,106 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Sets an azure automation runbook definition.
+ ///
+ [Cmdlet(VerbsData.Import, "AzureAutomationRunbook")]
+ [OutputType(typeof(Runbook))]
+ public class ImportAzureAutomationRunbook : AzureAutomationBaseCmdlet
+ {
+
+ ///
+ /// Gets or sets the path of the runbook script
+ ///
+ [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook file path.")]
+ [Alias("SourcePath")]
+ [ValidateNotNullOrEmpty]
+ public string Path { get; set; }
+
+ ///
+ /// Gets or sets the runbook description
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the runbook tags.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook tags.")]
+ [Alias("Tag")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets or sets the runbook version type
+ ///
+ [Parameter(Mandatory = true, HelpMessage = "Runbook definition type.")]
+ [ValidateSet(Constants.RunbookType.Graph, Constants.RunbookType.PowerShell, Constants.RunbookType.PowerShellWorkflow, IgnoreCase = true)]
+ [ValidateNotNullOrEmpty]
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether progress logging should be turned on or off.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Indicate whether progress logging should be turned on or off.")]
+ public bool? LogProgress { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether verbose logging should be turned on or off.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Indicate whether verbose logging should be turned on or off.")]
+ public bool? LogVerbose { get; set; }
+
+ ///
+ /// Gets or sets the switch parameter to publish the configuration
+ ///
+ [Parameter(Mandatory = false, HelpMessage = "Import the runbook in published state.")]
+ public SwitchParameter Published { get; set; }
+
+ ///
+ /// Gets or sets switch parameter to confirm overwriting of existing runbook definition.
+ ///
+ [Parameter(Mandatory = false, HelpMessage = "Forces the command to overwrite an existing runbook definition.")]
+ public SwitchParameter Force { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ var runbook = this.AutomationClient.ImportRunbook(
+ this.ResourceGroupName,
+ this.AutomationAccountName,
+ this.ResolvePath(this.Path),
+ this.Description,
+ this.Tags,
+ this.Type,
+ this.LogProgress,
+ this.LogVerbose,
+ this.Published.IsPresent,
+ this.Force.IsPresent);
+
+ this.WriteObject(runbook);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationCertificate.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationCertificate.cs
new file mode 100644
index 000000000000..cc5e38b91fa6
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationCertificate.cs
@@ -0,0 +1,80 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Create a new Certificate for automation.
+ ///
+ [Cmdlet(VerbsCommon.New, "AzureAutomationCertificate", DefaultParameterSetName = AutomationCmdletParameterSets.ByCertificateName)]
+ [OutputType(typeof(CertificateInfo))]
+ public class NewAzureAutomationCertificate : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the certificate name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The certificate name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the certificate description.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The certificate description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the certificate password.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The certificate password.")]
+ public SecureString Password { get; set; }
+
+ ///
+ /// Gets or sets the certificate path.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The certificate file path.")]
+ public string Path { get; set; }
+
+ ///
+ /// Gets or sets the certificate exportable Property.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The exportable property of the certificate.")]
+ public SwitchParameter Exportable { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+
+ var createdCertificate = this.AutomationClient.CreateCertificate(this.ResourceGroupName, this.AutomationAccountName, this.Name, this.ResolvePath(this.Path), this.Password, this.Description, this.Exportable.IsPresent);
+
+ this.WriteObject(createdCertificate);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationConnection.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationConnection.cs
new file mode 100644
index 000000000000..030d40904e2b
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationConnection.cs
@@ -0,0 +1,76 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Create a new Connection for automation.
+ ///
+ [Cmdlet(VerbsCommon.New, "AzureAutomationConnection", DefaultParameterSetName = AutomationCmdletParameterSets.ByConnectionName)]
+ [OutputType(typeof(Connection))]
+ public class NewAzureAutomationConnection : AzureAutomationBaseCmdlet
+ {
+
+ ///
+ /// Gets or sets the connection name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConnectionName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The connection name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the connection type name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConnectionName, Position = 3, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The connection type name.")]
+ [ValidateNotNullOrEmpty]
+ public string ConnectionTypeName { get; set; }
+
+ ///
+ /// Gets or sets the connection field values.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConnectionName, Position = 4, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The connection field values.")]
+ public IDictionary ConnectionFieldValues { get; set; }
+
+ ///
+ /// Gets or sets the connection description.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConnectionName, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The connection description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+
+ var createdConnection = this.AutomationClient.CreateConnection(this.ResourceGroupName, this.AutomationAccountName, this.Name, this.ConnectionTypeName, this.ConnectionFieldValues, this.Description);
+
+ this.WriteObject(createdConnection);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationCredential.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationCredential.cs
new file mode 100644
index 000000000000..2dc3f6c0def7
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationCredential.cs
@@ -0,0 +1,72 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Create a new Credential for automation.
+ ///
+ [Cmdlet(VerbsCommon.New, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
+ [OutputType(typeof(CredentialInfo))]
+ public class NewAzureAutomationCredential : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the credential name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The credential name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the credential name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The credential description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the credential UserName.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 3, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The credential value.")]
+ public PSCredential Value { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ string userName = null, password = null;
+
+ if (Value != null)
+ {
+ userName = Value.UserName;
+ password = Value.GetNetworkCredential().Password;
+ }
+
+ var createdCredential = this.AutomationClient.CreateCredential(this.ResourceGroupName, this.AutomationAccountName, Name, userName, password, Description);
+
+ this.WriteObject(createdCredential);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationRunbook.cs
new file mode 100644
index 000000000000..2706673161b8
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationRunbook.cs
@@ -0,0 +1,87 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation schedules for a given account.
+ ///
+ [Cmdlet(VerbsCommon.New, "AzureAutomationRunbook", DefaultParameterSetName = AutomationCmdletParameterSets.ByRunbookName)]
+ [OutputType(typeof (Runbook))]
+ public class NewAzureAutomationRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the runbook name
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name.")]
+ [Alias("RunbookName")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the runbook description
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the runbook tags.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook tags.")]
+ [Alias("Tag")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets or sets the runbook version type
+ ///
+ [Parameter(Mandatory = true, HelpMessage = "Runbook definition type.")]
+ [ValidateSet(Constants.RunbookType.Graph, Constants.RunbookType.PowerShell, Constants.RunbookType.PowerShellWorkflow, IgnoreCase = true)]
+ [ValidateNotNullOrEmpty]
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether progress logging should be turned on or off.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Indicate whether progress logging should be turned on or off.")]
+ public bool? LogProgress { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether verbose logging should be turned on or off.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Indicate whether verbose logging should be turned on or off.")]
+ public bool? LogVerbose { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ Runbook runbook = null;
+
+ // ByRunbookName
+ runbook = this.AutomationClient.CreateRunbookByName(
+ this.ResourceGroupName, this.AutomationAccountName, this.Name, this.Description, this.Tags, this.Type, this.LogProgress, this.LogVerbose, false);
+
+ this.WriteObject(runbook);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationSchedule.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationSchedule.cs
new file mode 100644
index 000000000000..2bf672b68a45
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationSchedule.cs
@@ -0,0 +1,120 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Creates an azure automation Schedule.
+ ///
+ [Cmdlet(VerbsCommon.New, "AzureAutomationSchedule", DefaultParameterSetName = AutomationCmdletParameterSets.ByDaily)]
+ [OutputType(typeof(Schedule))]
+ public class NewAzureAutomationSchedule : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public NewAzureAutomationSchedule()
+ {
+ this.ExpiryTime = Constants.DefaultScheduleExpiryTime;
+ }
+
+ ///
+ /// Gets or sets the schedule name.
+ ///
+ [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The schedule name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the schedule start time.
+ ///
+ [Parameter(Position = 3, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The schedule start time.")]
+ [ValidateNotNull]
+ public DateTimeOffset StartTime { get; set; }
+
+ ///
+ /// Gets or sets the schedule description.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The schedule description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the switch parameter to create a one time schedule.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByOneTime, Mandatory = true, HelpMessage = "To create a one time schedule.")]
+ public SwitchParameter OneTime { get; set; }
+
+ ///
+ /// Gets or sets the schedule expiry time.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByDaily, Mandatory = false, HelpMessage = "The schedule expiry time.")]
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByHourly, Mandatory = false, HelpMessage = "The schedule expiry time.")]
+ public DateTimeOffset ExpiryTime { get; set; }
+
+ ///
+ /// Gets or sets the daily schedule day interval.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByDaily, Mandatory = true, HelpMessage = "The daily schedule day interval.")]
+ [ValidateRange(1, byte.MaxValue)]
+ public byte DayInterval { get; set; }
+
+ ///
+ /// Gets or sets the hourly schedule hour interval.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByHourly, Mandatory = true, HelpMessage = "The hourly schedule hour interval.")]
+ [ValidateRange(1, byte.MaxValue)]
+ public byte HourInterval { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ var schedule = new Schedule
+ {
+ Name = this.Name,
+ StartTime = this.StartTime,
+ Description = this.Description,
+ ExpiryTime = this.ExpiryTime
+ };
+
+ if (this.ParameterSetName == AutomationCmdletParameterSets.ByOneTime)
+ {
+ schedule.Frequency = ScheduleFrequency.Onetime;
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByDaily)
+ {
+ schedule.Frequency = ScheduleFrequency.Day;
+ schedule.Interval = this.DayInterval;
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByHourly)
+ {
+ schedule.Frequency = ScheduleFrequency.Hour;
+ schedule.Interval = this.HourInterval;
+ }
+
+ Schedule createdSchedule = this.AutomationClient.CreateSchedule(this.ResourceGroupName, this.AutomationAccountName, schedule);
+ this.WriteObject(createdSchedule);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationVariable.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationVariable.cs
new file mode 100644
index 000000000000..79fcb1e9edde
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/NewAzureAutomationVariable.cs
@@ -0,0 +1,76 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation variables for a given account.
+ ///
+ [Cmdlet(VerbsCommon.New, "AzureAutomationVariable")]
+ [OutputType(typeof(Variable))]
+ public class NewAzureAutomationVariable : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the variable name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = true, Position = 2, ValueFromPipelineByPropertyName = true, HelpMessage = "The variable name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the variable encrypted Property.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The encrypted property of the variable.")]
+ [ValidateNotNull]
+ public bool Encrypted { get; set; }
+
+ ///
+ /// Gets or sets the variable description.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The description of the variable.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the variable value.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The value of the variable.")]
+ public object Value { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ Variable variable = new Variable()
+ {
+ Name = this.Name,
+ Encrypted = this.Encrypted,
+ Description = this.Description,
+ Value = this.Value,
+ AutomationAccountName = this.AutomationAccountName,
+ ResourceGroupName = this.ResourceGroupName
+ };
+
+ var ret = this.AutomationClient.CreateVariable(variable);
+
+ this.GenerateCmdletOutput(ret);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/PublishAzureAutomationRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/PublishAzureAutomationRunbook.cs
new file mode 100644
index 000000000000..dbb7aad3861d
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/PublishAzureAutomationRunbook.cs
@@ -0,0 +1,49 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Publishes an azure automation runbook.
+ ///
+ [Cmdlet(VerbsData.Publish, "AzureAutomationRunbook", DefaultParameterSetName = AutomationCmdletParameterSets.ByRunbookName)]
+ [OutputType(typeof(Runbook))]
+ public class PublishAzureAutomationRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the runbook name
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name.")]
+ [ValidateNotNullOrEmpty]
+ [Alias("RunbookName")]
+ public string Name { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ var runbook = this.AutomationClient.PublishRunbook(this.ResourceGroupName, this.AutomationAccountName, this.Name);
+
+ this.WriteObject(runbook);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RegisterAzureAutomationScheduledRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RegisterAzureAutomationScheduledRunbook.cs
new file mode 100644
index 000000000000..264e28196394
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RegisterAzureAutomationScheduledRunbook.cs
@@ -0,0 +1,68 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Registers an azure automation scheduled runbook.
+ ///
+ [Cmdlet(VerbsLifecycle.Register, "AzureAutomationScheduledRunbook", DefaultParameterSetName = AutomationCmdletParameterSets.ByRunbookName)]
+ [OutputType(typeof(JobSchedule))]
+ public class RegisterAzureAutomationScheduledRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the runbook name
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The runbook name.")]
+ [ValidateNotNullOrEmpty]
+ [Alias("Name")]
+ public string RunbookName { get; set; }
+
+ ///
+ /// Gets or sets the schedule that will be used to start the runbook.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The name of the schedule on which the runbook will be started.")]
+ [ValidateNotNullOrEmpty]
+ public string ScheduleName { get; set; }
+
+ ///
+ /// Gets or sets the runbook parameters.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = false, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The runbook parameters.")]
+ public IDictionary Parameters { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ JobSchedule jobSchedule;
+
+ jobSchedule = this.AutomationClient.RegisterScheduledRunbook(
+ this.ResourceGroupName, this.AutomationAccountName, this.RunbookName, this.ScheduleName, this.Parameters);
+
+ this.WriteObject(jobSchedule);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationCertificate.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationCertificate.cs
new file mode 100644
index 000000000000..c9a7a9efb8d3
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationCertificate.cs
@@ -0,0 +1,58 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Properties;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Removes a Certificate for automation.
+ ///
+ [Cmdlet(VerbsCommon.Remove, "AzureAutomationCertificate", DefaultParameterSetName = AutomationCmdletParameterSets.ByCertificateName)]
+ public class RemoveAzureAutomationCertificate : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the certificate name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The certificate name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, Position = 3, HelpMessage = "Confirm the removal of the certificate")]
+ public SwitchParameter Force { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ ConfirmAction(
+ Force.IsPresent,
+ string.Format(Resources.RemovingAzureAutomationResourceWarning, "Certificate"),
+ string.Format(Resources.RemoveAzureAutomationResourceDescription, "Certificate"),
+ Name,
+ () =>
+ {
+ this.AutomationClient.DeleteCertificate(this.ResourceGroupName, this.AutomationAccountName, Name);
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationConnection.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationConnection.cs
new file mode 100644
index 000000000000..3600af5bae45
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationConnection.cs
@@ -0,0 +1,58 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Properties;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Removes a Connection for automation.
+ ///
+ [Cmdlet(VerbsCommon.Remove, "AzureAutomationConnection", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
+ public class RemoveAzureAutomationConnection : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the connection name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The connection name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 3, HelpMessage = "Confirm the removal of the connection")]
+ public SwitchParameter Force { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ ConfirmAction(
+ Force.IsPresent,
+ string.Format(Resources.RemovingAzureAutomationResourceWarning, "Connection"),
+ string.Format(Resources.RemoveAzureAutomationResourceDescription, "Connection"),
+ Name,
+ () =>
+ {
+ this.AutomationClient.DeleteConnection(this.ResourceGroupName, this.AutomationAccountName, Name);
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationCredential.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationCredential.cs
new file mode 100644
index 000000000000..75dd3a17b833
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationCredential.cs
@@ -0,0 +1,58 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Properties;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Removes a Credential for automation.
+ ///
+ [Cmdlet(VerbsCommon.Remove, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
+ public class RemoveAzureAutomationCredential : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the credential name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The credential name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 3, HelpMessage = "Confirm the removal of the credential")]
+ public SwitchParameter Force { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ ConfirmAction(
+ Force.IsPresent,
+ string.Format(Resources.RemovingAzureAutomationResourceWarning, "Credential"),
+ string.Format(Resources.RemoveAzureAutomationResourceDescription, "Credential"),
+ Name,
+ () =>
+ {
+ this.AutomationClient.DeleteCredential(this.ResourceGroupName, this.AutomationAccountName, Name);
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationRunbook.cs
new file mode 100644
index 000000000000..8c9f2e0512f7
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationRunbook.cs
@@ -0,0 +1,61 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Globalization;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Properties;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Removes an azure automation runbook.
+ ///
+ [Cmdlet(VerbsCommon.Remove, "AzureAutomationRunbook", SupportsShouldProcess = true, DefaultParameterSetName = AutomationCmdletParameterSets.ByRunbookName)]
+ public class RemoveAzureAutomationRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the runbook name
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name.")]
+ [Alias("RunbookName")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the switch parameter not to confirm on removing the runbook.
+ ///
+ [Parameter(Mandatory = false, HelpMessage = "Forces the command to run without asking for user confirmation.")]
+ public SwitchParameter Force { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ this.ConfirmAction(
+ this.Force.IsPresent,
+ string.Format(CultureInfo.CurrentCulture, Resources.RemoveAzureAutomationRunbookWarning),
+ string.Format(CultureInfo.CurrentCulture, Resources.RemoveAzureAutomationRunbookDescription),
+ this.Name,
+ () =>
+ {
+ AutomationClient.DeleteRunbook(this.ResourceGroupName, this.AutomationAccountName, this.Name);
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationSchedule.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationSchedule.cs
new file mode 100644
index 000000000000..88e61fcdd3ee
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationSchedule.cs
@@ -0,0 +1,60 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Globalization;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Properties;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Removes an azure automation Schedule.
+ ///
+ [Cmdlet(VerbsCommon.Remove, "AzureAutomationSchedule", SupportsShouldProcess = true, DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
+ public class RemoveAzureAutomationSchedule : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the schedule name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The schedule name.")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the switch parameter not to confirm on removing the schedule.
+ ///
+ [Parameter(Mandatory = false, HelpMessage = "Forces the command to run without asking for user confirmation.")]
+ public SwitchParameter Force { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ this.ConfirmAction(
+ this.Force.IsPresent,
+ string.Format(CultureInfo.CurrentCulture, Resources.RemoveAzureAutomationScheduleWarning),
+ string.Format(CultureInfo.CurrentCulture, Resources.RemoveAzureAutomationScheduleDescription),
+ this.Name,
+ () =>
+ {
+ this.AutomationClient.DeleteSchedule(this.ResourceGroupName, this.AutomationAccountName, this.Name);
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationVariable.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationVariable.cs
new file mode 100644
index 000000000000..8bbc5d60bf40
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/RemoveAzureAutomationVariable.cs
@@ -0,0 +1,59 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Properties;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation variables for a given account.
+ ///
+ [Cmdlet(VerbsCommon.Remove, "AzureAutomationVariable")]
+ [OutputType(typeof(Variable))]
+ public class RemoveAzureAutomationVariable : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the variable name.
+ ///
+ [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The variable name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ [Parameter(Position = 3, HelpMessage = "Confirm the removal of the variable")]
+ public SwitchParameter Force { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ ConfirmAction(
+ Force.IsPresent,
+ string.Format(Resources.RemovingAzureAutomationResourceWarning, "Variable"),
+ string.Format(Resources.RemoveAzureAutomationResourceDescription, "Variable"),
+ Name,
+ () =>
+ {
+ this.AutomationClient.DeleteVariable(this.ResourceGroupName, this.AutomationAccountName, this.Name);
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/ResumeAzureAutomationJob.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/ResumeAzureAutomationJob.cs
new file mode 100644
index 000000000000..f26215265fa6
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/ResumeAzureAutomationJob.cs
@@ -0,0 +1,47 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets a Credential for automation.
+ ///
+ [Cmdlet(VerbsLifecycle.Resume, "AzureAutomationJob")]
+ public class ResumeAzureAutomationJob : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the job id.
+ ///
+ [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The job id.")]
+ [Alias("JobId")]
+ public Guid Id { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ this.AutomationClient.ResumeJob(this.ResourceGroupName, this.AutomationAccountName, this.Id);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationCertificate.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationCertificate.cs
new file mode 100644
index 000000000000..dd2406e78bfc
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationCertificate.cs
@@ -0,0 +1,80 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.WindowsAzure.Commands.Utilities.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Create a new Certificate for automation.
+ ///
+ [Cmdlet(VerbsCommon.Set, "AzureAutomationCertificate", DefaultParameterSetName = AutomationCmdletParameterSets.ByCertificateName)]
+ [OutputType(typeof(CertificateInfo))]
+ public class SetAzureAutomationCertificate : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the certificate name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The certificate name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the certificate description.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, Mandatory = false, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The certificate description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the certificate password.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, Mandatory = false, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The certificate password.")]
+ public SecureString Password { get; set; }
+
+ ///
+ /// Gets or sets the certificate path.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByCertificateName, Mandatory = false, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The certificate file path.")]
+ public string Path { get; set; }
+
+ ///
+ /// Gets or sets the certificate exportable Property.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The exportable property of the certificate.")]
+ public bool? Exportable { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+
+ var updateddCertificate = this.AutomationClient.UpdateCertificate(this.ResourceGroupName, this.AutomationAccountName, this.Name, this.ResolvePath(this.Path), this.Password, this.Description, this.Exportable);
+
+ this.WriteObject(updateddCertificate);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationConnection.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationConnection.cs
new file mode 100644
index 000000000000..9c0b5d03762e
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationConnection.cs
@@ -0,0 +1,66 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Create a new Connection for automation.
+ ///
+ [Cmdlet(VerbsCommon.Set, "AzureAutomationConnectionFieldValue", DefaultParameterSetName = AutomationCmdletParameterSets.ByConnectionName)]
+ [OutputType(typeof(Connection))]
+ public class SetAzureAutomationConnectionFieldValue : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the connection name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConnectionName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The connection name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the connection field name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConnectionName, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The connection field name.")]
+ public string ConnectionFieldName { get; set; }
+
+ ///
+ /// Gets or sets the connection field value.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByConnectionName, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The connection field value.")]
+ public object Value { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+
+ var updatedConnection = this.AutomationClient.UpdateConnectionFieldValue(this.ResourceGroupName, this.AutomationAccountName, this.Name, this.ConnectionFieldName, this.Value);
+
+ this.WriteObject(updatedConnection);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationCredential.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationCredential.cs
new file mode 100644
index 000000000000..779c27efaad6
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationCredential.cs
@@ -0,0 +1,72 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Sets a Credential for automation.
+ ///
+ [Cmdlet(VerbsCommon.Set, "AzureAutomationCredential", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
+ [OutputType(typeof(CredentialInfo))]
+ public class SetAzureAutomationCredential : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the credential name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The credential name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the credential description.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The credential description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the credential Value.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The credential value.")]
+ public PSCredential Value { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ string userName = null, password = null;
+
+ if(Value != null)
+ {
+ userName = Value.UserName;
+ password = Value.GetNetworkCredential().Password;
+ }
+
+ var updatedCredential = this.AutomationClient.UpdateCredential(this.ResourceGroupName, this.AutomationAccountName, Name, userName, password, Description);
+
+ this.WriteObject(updatedCredential);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationRunbook.cs
new file mode 100644
index 000000000000..393d929f10a2
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationRunbook.cs
@@ -0,0 +1,81 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Sets an azure automation runbook's configuration values.
+ ///
+ [Cmdlet(VerbsCommon.Set, "AzureAutomationRunbook", DefaultParameterSetName = AutomationCmdletParameterSets.ByRunbookName)]
+ [OutputType(typeof(Runbook))]
+ public class SetAzureAutomationRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the runbook name
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name.")]
+ [Alias("RunbookName")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the runbook description.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the runbook tags.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook tags.")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether progress logging should be turned on or off.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Indicate whether progress logging should be turned on or off.")]
+ public bool? LogProgress { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether verbose logging should be turned on or off.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Indicate whether verbose logging should be turned on or off.")]
+ public bool? LogVerbose { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ // ByRunbookName
+ var runbook = this.AutomationClient.UpdateRunbook(
+ this.ResourceGroupName,
+ this.AutomationAccountName,
+ this.Name,
+ this.Description,
+ this.Tags,
+ this.LogProgress,
+ this.LogVerbose);
+
+ this.WriteObject(runbook);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationSchedule.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationSchedule.cs
new file mode 100644
index 000000000000..acc3f678d848
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationSchedule.cs
@@ -0,0 +1,63 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Sets an azure automation schedule.
+ ///
+ [Cmdlet(VerbsCommon.Set, "AzureAutomationSchedule", DefaultParameterSetName = AutomationCmdletParameterSets.ByName)]
+ [OutputType(typeof(Schedule))]
+ public class SetAzureAutomationSchedule : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the schedule name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The schedule name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the indicator whether the schedule is enabled.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "Specifies whether the schedule is enabled. If a schedule is disabled, any runbooks using it will not run on the schedule until it is enabled.")]
+ public bool? IsEnabled { get; set; }
+
+ ///
+ /// Gets or sets the schedule description.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The schedule description.")]
+ public string Description { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ Schedule schedule = this.AutomationClient.UpdateSchedule(
+ this.ResourceGroupName, this.AutomationAccountName, this.Name, this.IsEnabled, this.Description);
+ this.WriteObject(schedule);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationVariable.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationVariable.cs
new file mode 100644
index 000000000000..d68c674b6c4b
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SetAzureAutomationVariable.cs
@@ -0,0 +1,87 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Newtonsoft.Json;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets azure automation variables for a given account.
+ ///
+ [Cmdlet(VerbsCommon.Set, "AzureAutomationVariable")]
+ [OutputType(typeof(Variable))]
+ public class SetAzureAutomationVariable : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the variable name.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.UpdateVariableValue, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The variable name.")]
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.UpdateVariableDescription, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The variable name.")]
+ [ValidateNotNullOrEmpty]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the variable encrypted Property.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.UpdateVariableValue, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The encrypted property of the variable.")]
+ [ValidateNotNull]
+ public bool Encrypted { get; set; }
+
+ ///
+ /// Gets or sets the variable description.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.UpdateVariableDescription, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The description of the variable.")]
+ public string Description { get; set; }
+
+ ///
+ /// Gets or sets the variable value.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.UpdateVariableValue, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The value of the variable.")]
+ public object Value { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ Variable variable = new Variable()
+ {
+ Name = this.Name,
+ Description = this.Description,
+ Encrypted = this.Encrypted,
+ Value = this.Value,
+ AutomationAccountName = this.AutomationAccountName,
+ ResourceGroupName = this.ResourceGroupName
+ };
+
+ Variable ret;
+ if (ParameterSetName == AutomationCmdletParameterSets.UpdateVariableValue)
+ {
+ ret = this.AutomationClient.UpdateVariable(variable, VariableUpdateFields.OnlyValue);
+ }
+ else
+ {
+ ret = this.AutomationClient.UpdateVariable(variable, VariableUpdateFields.OnlyDescription);
+ }
+ this.GenerateCmdletOutput(ret);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/StartAzureAutomationRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/StartAzureAutomationRunbook.cs
new file mode 100644
index 000000000000..ebab2f6cc140
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/StartAzureAutomationRunbook.cs
@@ -0,0 +1,66 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Job = Microsoft.Azure.Commands.Automation.Model.Job;
+
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Starts an Azure automation runbook.
+ ///
+ [Cmdlet(VerbsLifecycle.Start, "AzureAutomationRunbook", DefaultParameterSetName = AutomationCmdletParameterSets.ByRunbookName)]
+ [OutputType(typeof(Job))]
+ public class StartAzureAutomationRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the runbook name
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookName, Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook name.")]
+ [ValidateNotNullOrEmpty]
+ [Alias("RunbookName")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the runbook parameters.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "The runbook parameters.")]
+ public IDictionary Parameters { get; set; }
+
+ ///
+ /// Gets or sets the optional hybrid agent friendly name upon which the runbook should be executed.
+ ///
+ [Parameter(Mandatory = false, ValueFromPipelineByPropertyName = true, HelpMessage = "Optional name of the hybrid agent which should execute the runbook")]
+ [Alias("HybridWorker")]
+ public string RunOn { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ Job job = null;
+
+ job = this.AutomationClient.StartRunbook(this.ResourceGroupName, this.AutomationAccountName, this.Name, this.Parameters, this.RunOn);
+
+ this.WriteObject(job);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/StopAzureAutomationJob.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/StopAzureAutomationJob.cs
new file mode 100644
index 000000000000..bda261ee9b89
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/StopAzureAutomationJob.cs
@@ -0,0 +1,47 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets a Credential for automation.
+ ///
+ [Cmdlet(VerbsLifecycle.Stop, "AzureAutomationJob")]
+ public class StopAzureAutomationJob : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the job id.
+ ///
+ [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The job id.")]
+ [Alias("JobId")]
+ public Guid Id { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ this.AutomationClient.StopJob(this.ResourceGroupName, this.AutomationAccountName, this.Id);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SuspendAzureAutomationJob.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SuspendAzureAutomationJob.cs
new file mode 100644
index 000000000000..4936840aa44f
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/SuspendAzureAutomationJob.cs
@@ -0,0 +1,47 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections.Generic;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Gets a Credential for automation.
+ ///
+ [Cmdlet(VerbsLifecycle.Suspend, "AzureAutomationJob")]
+ public class SuspendAzureAutomationJob : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the job id.
+ ///
+ [Parameter(Position = 2, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The job id.")]
+ [Alias("JobId")]
+ public Guid Id { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ this.AutomationClient.SuspendJob(this.ResourceGroupName, this.AutomationAccountName, this.Id);
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Cmdlet/UnregisterAzureAutomationScheduledRunbook.cs b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/UnregisterAzureAutomationScheduledRunbook.cs
new file mode 100644
index 000000000000..25b1ca692800
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Cmdlet/UnregisterAzureAutomationScheduledRunbook.cs
@@ -0,0 +1,87 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Globalization;
+using System.Management.Automation;
+using System.Security.Permissions;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Model;
+using Microsoft.Azure.Commands.Automation.Properties;
+
+namespace Microsoft.Azure.Commands.Automation.Cmdlet
+{
+ ///
+ /// Unregisters an azure automation scheduled runbook.
+ ///
+ [Cmdlet(VerbsLifecycle.Unregister, "AzureAutomationScheduledRunbook", DefaultParameterSetName = AutomationCmdletParameterSets.ByJobScheduleId)]
+ public class UnregisterAzureAutomationScheduledRunbook : AzureAutomationBaseCmdlet
+ {
+ ///
+ /// Gets or sets the runbook Id
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByJobScheduleId, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The job schedule id.")]
+ public Guid? JobScheduleId { get; set; }
+
+ ///
+ /// Gets or sets the runbook name
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The runbook name.")]
+ [ValidateNotNullOrEmpty]
+ [Alias("Name")]
+ public string RunbookName { get; set; }
+
+ ///
+ /// Gets or sets the schedule that will be used to start the runbook.
+ ///
+ [Parameter(ParameterSetName = AutomationCmdletParameterSets.ByRunbookNameAndScheduleName, Mandatory = true, ValueFromPipelineByPropertyName = true,
+ HelpMessage = "The name of the schedule on which the runbook will be started.")]
+ [ValidateNotNullOrEmpty]
+ public string ScheduleName { get; set; }
+
+ ///
+ /// Gets or sets the switch parameter not to confirm on removing the runbook.
+ ///
+ [Parameter(Mandatory = false, HelpMessage = "Forces the command to run without asking for user confirmation.")]
+ public SwitchParameter Force { get; set; }
+
+ ///
+ /// Execute this cmdlet.
+ ///
+ [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+ protected override void AutomationExecuteCmdlet()
+ {
+ this.ConfirmAction(
+ this.Force.IsPresent,
+ string.Format(CultureInfo.CurrentCulture, Resources.RemoveAzureAutomationJobScheduleWarning),
+ string.Format(CultureInfo.CurrentCulture, Resources.RemoveAzureAutomationJobScheduleDescription),
+ this.JobScheduleId.HasValue ? this.JobScheduleId.Value.ToString() : this.RunbookName,
+ () =>
+ {
+ if (this.ParameterSetName == AutomationCmdletParameterSets.ByJobScheduleId)
+ {
+ this.AutomationClient.UnregisterScheduledRunbook(
+ this.ResourceGroupName, this.AutomationAccountName, this.JobScheduleId.Value);
+ }
+ else if (this.ParameterSetName == AutomationCmdletParameterSets.ByRunbookNameAndScheduleName)
+ {
+ this.AutomationClient.UnregisterScheduledRunbook(
+ this.ResourceGroupName, this.AutomationAccountName, this.RunbookName, this.ScheduleName);
+ }
+ });
+ }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Commands.ResourceManagement.Automation.csproj b/src/ResourceManager/Automation/Commands.Automation/Commands.ResourceManagement.Automation.csproj
index 5ba28e54f2fd..fc63c227b462 100644
--- a/src/ResourceManager/Automation/Commands.Automation/Commands.ResourceManagement.Automation.csproj
+++ b/src/ResourceManager/Automation/Commands.Automation/Commands.ResourceManagement.Automation.csproj
@@ -119,20 +119,52 @@
+
+
+
+
+
+
+
+
+
+
Code
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -141,12 +173,16 @@
+
+
+
+
@@ -161,21 +197,32 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ResourceManager/Automation/Commands.Automation/Common/AutomationClient.cs b/src/ResourceManager/Automation/Commands.Automation/Common/AutomationClient.cs
index c888728baf8e..fc11e4a165fd 100644
--- a/src/ResourceManager/Automation/Commands.Automation/Common/AutomationClient.cs
+++ b/src/ResourceManager/Automation/Commands.Automation/Common/AutomationClient.cs
@@ -21,17 +21,25 @@
using System.Net;
using System.Security;
using System.Security.Cryptography.X509Certificates;
+using Microsoft.Azure.Commands.Automation.Cmdlet;
using Microsoft.Azure.Commands.Automation.Model;
using Microsoft.Azure.Commands.Automation.Properties;
using Microsoft.Azure.Management.Automation;
using Microsoft.Azure.Management.Automation.Models;
-using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.Azure.Common.Authentication.Models;
using Newtonsoft.Json;
using AutomationAccount = Microsoft.Azure.Commands.Automation.Model.AutomationAccount;
using Module = Microsoft.Azure.Commands.Automation.Model.Module;
-
+using Runbook = Microsoft.Azure.Commands.Automation.Model.Runbook;
+using Schedule = Microsoft.Azure.Commands.Automation.Model.Schedule;
+using Job = Microsoft.Azure.Commands.Automation.Model.Job;
+using Variable = Microsoft.Azure.Commands.Automation.Model.Variable;
+using JobStream = Microsoft.Azure.Commands.Automation.Model.JobStream;
+using Credential = Microsoft.Azure.Commands.Automation.Model.CredentialInfo;
+using JobSchedule = Microsoft.Azure.Commands.Automation.Model.JobSchedule;
+using Certificate = Microsoft.Azure.Commands.Automation.Model.CertificateInfo;
+using Connection = Microsoft.Azure.Commands.Automation.Model.Connection;
namespace Microsoft.Azure.Commands.Automation.Common
{
@@ -51,7 +59,8 @@ public AutomationClient()
public AutomationClient(AzureProfile profile, AzureSubscription subscription)
: this(subscription,
- AzureSession.ClientFactory.CreateClient(profile, subscription, AzureEnvironment.Endpoint.ResourceManager))
+ AzureSession.ClientFactory.CreateClient(profile,
+ subscription, AzureEnvironment.Endpoint.ResourceManager))
{
}
@@ -64,11 +73,11 @@ public AutomationClient(AzureSubscription subscription,
this.automationManagementClient = automationManagementClient;
}
- void SetClientIdHeader(string clientRequestId)
+ private void SetClientIdHeader(string clientRequestId)
{
var client = ((AutomationManagementClient) this.automationManagementClient);
client.HttpClient.DefaultRequestHeaders.Remove(Constants.ClientRequestIdHeaderName);
- client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientRequestIdHeaderName, clientRequestId);
+ client.HttpClient.DefaultRequestHeaders.Add(Constants.ClientRequestIdHeaderName, clientRequestId);
}
public AzureSubscription Subscription { get; private set; }
@@ -97,21 +106,26 @@ public AutomationAccount GetAutomationAccount(string resourceGroupName, string a
Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
- var account = this.automationManagementClient.AutomationAccounts.Get(resourceGroupName, automationAccountName).AutomationAccount;
+ var account =
+ this.automationManagementClient.AutomationAccounts.Get(resourceGroupName, automationAccountName)
+ .AutomationAccount;
return new Model.AutomationAccount(resourceGroupName, account);
}
- public AutomationAccount CreateAutomationAccount(string resourceGroupName, string automationAccountName, string location, string plan, IDictionary tags)
+ public AutomationAccount CreateAutomationAccount(string resourceGroupName, string automationAccountName,
+ string location, string plan, IDictionary tags)
{
Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
Requires.Argument("Location", location).NotNull();
- Requires.Argument("AutomationAccountName", automationAccountName).ValidAutomationAccountName();
+ Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
IDictionary accountTags = null;
- if (tags != null) accountTags = tags.Cast().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString());
+ if (tags != null)
+ accountTags = tags.Cast()
+ .ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString());
- var accountCreateParameters = new AutomationAccountCreateOrUpdateParameters()
+ var accountCreateOrUpdateParameters = new AutomationAccountCreateOrUpdateParameters()
{
Location = location,
Name = automationAccountName,
@@ -127,13 +141,14 @@ public AutomationAccount CreateAutomationAccount(string resourceGroupName, strin
var account =
this.automationManagementClient.AutomationAccounts.CreateOrUpdate(resourceGroupName,
- accountCreateParameters).AutomationAccount;
+ accountCreateOrUpdateParameters).AutomationAccount;
return new AutomationAccount(resourceGroupName, account);
}
- public AutomationAccount UpdateAutomationAccount(string resourceGroupName, string automationAccountName, string plan, IDictionary tags)
+ public AutomationAccount UpdateAutomationAccount(string resourceGroupName, string automationAccountName,
+ string plan, IDictionary tags)
{
Requires.Argument("ResourceGroupName", resourceGroupName).NotNull();
Requires.Argument("AutomationAccountName", automationAccountName).NotNull();
@@ -148,7 +163,9 @@ public AutomationAccount UpdateAutomationAccount(string resourceGroupName, strin
}
else
{
- accountTags = automationAccount.Tags.Cast().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString()); ;
+ accountTags = automationAccount.Tags.Cast()
+ .ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString());
+ ;
}
var accountUpdateParameters = new AutomationAccountPatchParameters()
@@ -184,8 +201,9 @@ public void DeleteAutomationAccount(string resourceGroupName, string automationA
{
if (cloudException.Response.StatusCode == HttpStatusCode.NoContent)
{
- throw new ResourceNotFoundException(typeof(AutomationAccount),
- string.Format(CultureInfo.CurrentCulture, Resources.AutomationAccountNotFound, automationAccountName));
+ throw new ResourceNotFoundException(typeof (AutomationAccount),
+ string.Format(CultureInfo.CurrentCulture, Resources.AutomationAccountNotFound,
+ automationAccountName));
}
throw;
@@ -195,9 +213,12 @@ public void DeleteAutomationAccount(string resourceGroupName, string automationA
#endregion
#region Modules
- public Module CreateModule(string resourceGroupName, string automationAccountName, Uri contentLink, string moduleName)
+
+ public Module CreateModule(string resourceGroupName, string automationAccountName, Uri contentLink,
+ string moduleName)
{
- var createdModule = this.automationManagementClient.Modules.CreateOrUpdate(resourceGroupName, automationAccountName,
+ var createdModule = this.automationManagementClient.Modules.CreateOrUpdate(resourceGroupName,
+ automationAccountName,
new AutomationManagement.Models.ModuleCreateOrUpdateParameters()
{
Name = moduleName,
@@ -219,21 +240,24 @@ public Module GetModule(string resourceGroupName, string automationAccountName,
{
try
{
- var module = this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;
+ var module =
+ this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;
return new Module(resourceGroupName, automationAccountName, module);
}
catch (CloudException cloudException)
{
if (cloudException.Response.StatusCode == HttpStatusCode.NotFound)
{
- throw new ResourceNotFoundException(typeof(Module), string.Format(CultureInfo.CurrentCulture, Resources.ModuleNotFound, name));
+ throw new ResourceNotFoundException(typeof (Module),
+ string.Format(CultureInfo.CurrentCulture, Resources.ModuleNotFound, name));
}
throw;
}
}
- public IEnumerable ListModules(string resourceGroupName, string automationAccountName, ref string nextLink)
+ public IEnumerable ListModules(string resourceGroupName, string automationAccountName,
+ ref string nextLink)
{
ModuleListResponse response;
@@ -251,9 +275,11 @@ public IEnumerable ListModules(string resourceGroupName, string automati
return response.Modules.Select(c => new Module(resourceGroupName, automationAccountName, c));
}
- public Module UpdateModule(string resourceGroupName, string automationAccountName, string name, Uri contentLinkUri, string contentLinkVersion)
+ public Module UpdateModule(string resourceGroupName, string automationAccountName, string name,
+ Uri contentLinkUri, string contentLinkVersion)
{
- var moduleModel = this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;
+ var moduleModel =
+ this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;
if (contentLinkUri != null)
{
var modulePatchParameters = new AutomationManagement.Models.ModulePatchParameters();
@@ -269,9 +295,11 @@ public Module UpdateModule(string resourceGroupName, string automationAccountNam
modulePatchParameters.Tags = moduleModel.Tags;
- this.automationManagementClient.Modules.Patch(resourceGroupName, automationAccountName, modulePatchParameters);
+ this.automationManagementClient.Modules.Patch(resourceGroupName, automationAccountName,
+ modulePatchParameters);
}
- var updatedModule = this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;
+ var updatedModule =
+ this.automationManagementClient.Modules.Get(resourceGroupName, automationAccountName, name).Module;
return new Module(resourceGroupName, automationAccountName, updatedModule);
}
@@ -279,13 +307,15 @@ public void DeleteModule(string resourceGroupName, string automationAccountName,
{
try
{
- var module = this.automationManagementClient.Modules.Delete(resourceGroupName, automationAccountName, name);
+ var module = this.automationManagementClient.Modules.Delete(resourceGroupName, automationAccountName,
+ name);
}
catch (CloudException cloudException)
{
if (cloudException.Response.StatusCode == HttpStatusCode.NoContent)
{
- throw new ResourceNotFoundException(typeof(Module), string.Format(CultureInfo.CurrentCulture, Resources.ModuleNotFound, name));
+ throw new ResourceNotFoundException(typeof (Module),
+ string.Format(CultureInfo.CurrentCulture, Resources.ModuleNotFound, name));
}
throw;
@@ -293,6 +323,1413 @@ public void DeleteModule(string resourceGroupName, string automationAccountName,
}
#endregion
-
+
+ #region Schedule Operations
+
+ public Schedule CreateSchedule(string resourceGroupName, string automationAccountName, Schedule schedule)
+ {
+ var scheduleCreateOrUpdateParameters = new AutomationManagement.Models.ScheduleCreateOrUpdateParameters
+ {
+ Name = schedule.Name,
+ Properties = new AutomationManagement.Models.ScheduleCreateOrUpdateProperties
+ {
+ StartTime = schedule.StartTime,
+ ExpiryTime = schedule.ExpiryTime,
+ Description = schedule.Description,
+ Interval = schedule.Interval,
+ Frequency = schedule.Frequency.ToString()
+ }
+ };
+
+ var scheduleCreateResponse = this.automationManagementClient.Schedules.CreateOrUpdate(
+ resourceGroupName,
+ automationAccountName,
+ scheduleCreateOrUpdateParameters);
+
+ return this.GetSchedule(resourceGroupName, automationAccountName, schedule.Name);
+ }
+
+ public void DeleteSchedule(string resourceGroupName, string automationAccountName, string scheduleName)
+ {
+ try
+ {
+ this.automationManagementClient.Schedules.Delete(
+ resourceGroupName,
+ automationAccountName,
+ scheduleName);
+ }
+ catch (CloudException cloudException)
+ {
+ if (cloudException.Response.StatusCode == HttpStatusCode.NoContent)
+ {
+ throw new ResourceNotFoundException(typeof (Schedule),
+ string.Format(CultureInfo.CurrentCulture, Resources.ScheduleNotFound, scheduleName));
+ }
+
+ throw;
+ }
+ }
+
+ public Schedule GetSchedule(string resourceGroupName, string automationAccountName, string scheduleName)
+ {
+ AutomationManagement.Models.Schedule scheduleModel = this.GetScheduleModel(resourceGroupName, automationAccountName,
+ scheduleName);
+ return this.CreateScheduleFromScheduleModel(resourceGroupName, automationAccountName, scheduleModel);
+ }
+
+ public IEnumerable ListSchedules(string resourceGroupName, string automationAccountName, ref string nextLink)
+ {
+ ScheduleListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.Schedules.List(resourceGroupName, automationAccountName);
+ }
+ else
+ {
+ response = this.automationManagementClient.Schedules.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return response.Schedules.Select(c => new Schedule(resourceGroupName, automationAccountName, c));
+ }
+
+ public Schedule UpdateSchedule(string resourceGroupName, string automationAccountName, string scheduleName, bool? isEnabled,
+ string description)
+ {
+ AutomationManagement.Models.Schedule scheduleModel = this.GetScheduleModel(resourceGroupName, automationAccountName,
+ scheduleName);
+ isEnabled = (isEnabled.HasValue) ? isEnabled : scheduleModel.Properties.IsEnabled;
+ description = description ?? scheduleModel.Properties.Description;
+ return this.UpdateScheduleHelper(resourceGroupName, automationAccountName, scheduleName, isEnabled, description);
+ }
+
+ #endregion
+
+ #region Runbook Operations
+
+ public Runbook GetRunbook(string resourceGroupName, string automationAccountName, string runbookName)
+ {
+ var runbookModel = this.TryGetRunbookModel(resourceGroupName, automationAccountName, runbookName);
+ if (runbookModel == null)
+ {
+ throw new ResourceCommonException(typeof (Runbook),
+ string.Format(CultureInfo.CurrentCulture, Resources.RunbookNotFound, runbookName));
+ }
+
+ return new Runbook(resourceGroupName, automationAccountName, runbookModel);
+ }
+
+ public IEnumerable ListRunbooks(string resourceGroupName, string automationAccountName, ref string nextLink)
+ {
+ RunbookListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.Runbooks.List(resourceGroupName, automationAccountName);
+ }
+ else
+ {
+ response = this.automationManagementClient.Runbooks.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return response.Runbooks.Select(c => new Runbook(resourceGroupName, automationAccountName, c));
+ }
+
+ public Runbook CreateRunbookByName(string resourceGroupName, string automationAccountName, string runbookName, string description,
+ IDictionary tags, string type, bool? logProgress, bool? logVerbose, bool overwrite)
+ {
+ using (var request = new RequestSettings(this.automationManagementClient))
+ {
+ var runbookModel = this.TryGetRunbookModel(resourceGroupName, automationAccountName, runbookName);
+ if (runbookModel != null && overwrite == false)
+ {
+ throw new ResourceCommonException(typeof (Runbook),
+ string.Format(CultureInfo.CurrentCulture, Resources.RunbookAlreadyExists, runbookName));
+ }
+
+ IDictionary runbooksTags = null;
+ if (tags != null) runbooksTags = tags.Cast().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString());
+
+ var rdcprop = new RunbookCreateOrUpdateDraftProperties()
+ {
+ Description = description,
+ RunbookType = String.IsNullOrWhiteSpace(type) ? RunbookTypeEnum.Script : (0 == string.Compare(type, Constants.RunbookType.PowerShellWorkflow, StringComparison.OrdinalIgnoreCase)) ? RunbookTypeEnum.Script : type,
+ LogProgress = logProgress.HasValue && logProgress.Value,
+ LogVerbose = logVerbose.HasValue && logVerbose.Value,
+ Draft = new RunbookDraft(),
+ };
+
+ var rdcparam = new RunbookCreateOrUpdateDraftParameters()
+ {
+ Name = runbookName,
+ Properties = rdcprop,
+ Tags = runbooksTags,
+ Location = GetAutomationAccount(resourceGroupName, automationAccountName).Location
+ };
+
+ this.automationManagementClient.Runbooks.CreateOrUpdateWithDraft(resourceGroupName, automationAccountName, rdcparam);
+
+ return this.GetRunbook(resourceGroupName, automationAccountName, runbookName);
+ }
+ }
+
+ public Runbook ImportRunbook(string resourceGroupName, string automationAccountName, string runbookPath, string description, IDictionary tags, string type, bool? logProgress, bool? logVerbose, bool published, bool overwrite)
+ {
+
+ var fileExtension = Path.GetExtension(runbookPath);
+
+ if (0 !=
+ string.Compare(fileExtension, Constants.SupportedFileExtensions.PowerShellScript,
+ StringComparison.OrdinalIgnoreCase) &&
+ 0 !=
+ string.Compare(fileExtension, Constants.SupportedFileExtensions.Graph,
+ StringComparison.OrdinalIgnoreCase))
+ {
+ throw new ResourceCommonException(typeof(Runbook),
+ string.Format(CultureInfo.CurrentCulture, Resources.InvalidImportFile, runbookPath));
+ }
+
+ // if graph runbook make sure type is not null and has right value
+ if (0 == string.Compare(fileExtension, Constants.SupportedFileExtensions.Graph, StringComparison.OrdinalIgnoreCase)
+ && string.IsNullOrWhiteSpace(type)
+ && (0 != string.Compare(type, Constants.RunbookType.Graph,StringComparison.OrdinalIgnoreCase)))
+ {
+ throw new ResourceCommonException(typeof(Runbook),
+ string.Format(CultureInfo.CurrentCulture, Resources.InvalidRunbookTypeForExtension, fileExtension));
+ }
+
+
+ var runbookName = Path.GetFileNameWithoutExtension(runbookPath);
+
+ using (var request = new RequestSettings(this.automationManagementClient))
+ {
+ var runbook = this.CreateRunbookByName(resourceGroupName, automationAccountName, runbookName, description, tags, type, logProgress, logVerbose, overwrite);
+
+ var rduprop = new RunbookDraftUpdateParameters()
+ {
+ Name = runbookName,
+ Stream = File.ReadAllText(runbookPath)
+ };
+
+ this.automationManagementClient.RunbookDraft.Update(resourceGroupName, automationAccountName, rduprop);
+
+ if (published)
+ {
+ runbook = this.PublishRunbook(resourceGroupName, automationAccountName, runbookName);
+ }
+
+ return runbook;
+ }
+ }
+
+ public void DeleteRunbook(string resourceGroupName, string automationAccountName, string runbookName)
+ {
+ try
+ {
+ using (var request = new RequestSettings(this.automationManagementClient))
+ {
+ this.automationManagementClient.Runbooks.Delete(resourceGroupName, automationAccountName, runbookName);
+ }
+ }
+ catch (CloudException cloudException)
+ {
+ if (cloudException.Response.StatusCode == HttpStatusCode.NoContent)
+ {
+ throw new ResourceNotFoundException(typeof (Connection),
+ string.Format(CultureInfo.CurrentCulture, Resources.RunbookNotFound, runbookName));
+ }
+
+ throw;
+ }
+
+ }
+
+ public Runbook UpdateRunbook(string resourceGroupName, string automationAccountName, string runbookName, string description,
+ IDictionary tags, bool? logProgress, bool? logVerbose)
+ {
+ using (var request = new RequestSettings(this.automationManagementClient))
+ {
+ var runbookModel = this.TryGetRunbookModel(resourceGroupName, automationAccountName, runbookName);
+ if (runbookModel == null)
+ {
+ throw new ResourceCommonException(typeof (Runbook),
+ string.Format(CultureInfo.CurrentCulture, Resources.RunbookNotFound, runbookName));
+ }
+
+ var runbookUpdateParameters = new RunbookPatchParameters();
+ runbookUpdateParameters.Name = runbookName;
+ runbookUpdateParameters.Tags = null;
+
+ IDictionary runbooksTags = null;
+ if (tags != null) runbooksTags = tags.Cast().ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString());
+
+ runbookUpdateParameters.Properties = new RunbookPatchProperties();
+ runbookUpdateParameters.Properties.Description = description ?? runbookModel.Properties.Description;
+ runbookUpdateParameters.Properties.LogProgress = (logProgress.HasValue)
+ ? logProgress.Value
+ : runbookModel.Properties.LogProgress;
+ runbookUpdateParameters.Properties.LogVerbose = (logVerbose.HasValue)
+ ? logVerbose.Value
+ : runbookModel.Properties.LogVerbose;
+ runbookUpdateParameters.Tags = runbooksTags ?? runbookModel.Tags;
+
+ var runbook =
+ this.automationManagementClient.Runbooks.Patch(resourceGroupName, automationAccountName, runbookUpdateParameters)
+ .Runbook;
+
+ return new Runbook(resourceGroupName, automationAccountName, runbook);
+ }
+ }
+
+ public DirectoryInfo ExportRunbook(string resourceGroupName, string automationAccountName,
+ string runbookName, bool? isDraft, string outputFolder, bool overwrite)
+ {
+ DirectoryInfo ret = null;
+ using (var request = new RequestSettings(this.automationManagementClient))
+ {
+ var runbook = this.TryGetRunbookModel(resourceGroupName, automationAccountName, runbookName);
+ if (runbook == null)
+ {
+ throw new ResourceNotFoundException(typeof (Runbook),
+ string.Format(CultureInfo.CurrentCulture, Resources.RunbookNotFound, runbookName));
+ }
+
+ var draftContent = String.Empty;
+ var publishedContent = String.Empty;
+
+ if (0 !=
+ String.Compare(runbook.Properties.State, RunbookState.Published, CultureInfo.InvariantCulture,
+ CompareOptions.IgnoreCase) && (!isDraft.HasValue || isDraft.Value))
+ {
+ draftContent =
+ this.automationManagementClient.RunbookDraft.Content(resourceGroupName, automationAccountName, runbookName).Stream;
+ }
+ if (0 !=
+ String.Compare(runbook.Properties.State, RunbookState.New, CultureInfo.InvariantCulture,
+ CompareOptions.IgnoreCase) && (!isDraft.HasValue || !isDraft.Value))
+ {
+ publishedContent =
+ this.automationManagementClient.Runbooks.Content(resourceGroupName, automationAccountName, runbookName).Stream;
+ }
+
+ // if no slot specified return both draft and publish content
+ if (false == isDraft.HasValue)
+ {
+ if (false == String.IsNullOrEmpty(publishedContent))
+ {
+ ret = WriteRunbookToFile(outputFolder, runbook.Name, publishedContent, runbook.Properties.RunbookType,
+ overwrite);
+ }
+ else if (false == String.IsNullOrEmpty(draftContent))
+ {
+ ret = WriteRunbookToFile(outputFolder, runbook.Name, draftContent, runbook.Properties.RunbookType,
+ overwrite);
+ }
+ }
+ else
+ {
+ if (true == isDraft.Value)
+ {
+
+ if (String.IsNullOrEmpty(draftContent))
+ throw new ResourceCommonException(typeof (Runbook),
+ string.Format(CultureInfo.CurrentCulture, Resources.RunbookHasNoDraftVersion,
+ runbookName));
+ if (false == String.IsNullOrEmpty(draftContent))
+ ret = WriteRunbookToFile(outputFolder, runbook.Name, draftContent, runbook.Properties.RunbookType,
+ overwrite);
+ }
+ else
+ {
+ if (String.IsNullOrEmpty(publishedContent))
+ throw new ResourceCommonException(typeof (Runbook),
+ string.Format(CultureInfo.CurrentCulture, Resources.RunbookHasNoPublishedVersion,
+ runbookName));
+
+ if (false == String.IsNullOrEmpty(publishedContent))
+ ret = WriteRunbookToFile(outputFolder, runbook.Name, publishedContent, runbook.Properties.RunbookType,
+ overwrite);
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ public Runbook PublishRunbook(string resourceGroupName, string automationAccountName, string runbookName)
+ {
+ using (var request = new RequestSettings(this.automationManagementClient))
+ {
+ this.automationManagementClient.RunbookDraft.Publish(
+ resourceGroupName,
+ automationAccountName,
+ new RunbookDraftPublishParameters
+ {
+ Name = runbookName,
+ PublishedBy = Constants.ClientIdentity
+ });
+
+ return this.GetRunbook(resourceGroupName, automationAccountName, runbookName);
+ }
+
+ }
+
+ public Job StartRunbook(string resourceGroupName, string automationAccountName, string runbookName, IDictionary parameters, string runOn)
+ {
+ IDictionary processedParameters = this.ProcessRunbookParameters(resourceGroupName, automationAccountName,
+ runbookName, parameters);
+ var job = this.automationManagementClient.Jobs.Create(
+ resourceGroupName,
+ automationAccountName,
+ new JobCreateParameters
+ {
+ Properties = new JobCreateProperties
+ {
+ Runbook = new RunbookAssociationProperty
+ {
+ Name = runbookName
+ },
+ RunOn = String.IsNullOrWhiteSpace(runOn) ? null : runOn,
+ Parameters = processedParameters ?? null
+ }
+ }).Job;
+
+ return new Job(resourceGroupName, automationAccountName, job);
+ }
+
+ #endregion
+
+ #region Variables
+
+ public Variable CreateVariable(Variable variable)
+ {
+ bool variableExists = true;
+
+ try
+ {
+ this.GetVariable(variable.ResourceGroupName, variable.AutomationAccountName, variable.Name);
+ }
+ catch (ResourceNotFoundException)
+ {
+ variableExists = false;
+ }
+
+ if (variableExists)
+ {
+ throw new AzureAutomationOperationException(string.Format(CultureInfo.CurrentCulture,
+ Resources.VariableAlreadyExists, variable.Name));
+ }
+
+ var createParams = new AutomationManagement.Models.VariableCreateOrUpdateParameters()
+ {
+ Name = variable.Name,
+ Properties = new AutomationManagement.Models.VariableCreateOrUpdateProperties()
+ {
+ Value = PowerShellJsonConverter.Serialize(variable.Value),
+ Description = variable.Description,
+ IsEncrypted = variable.Encrypted
+ }
+ };
+
+ var sdkCreatedVariable =
+ this.automationManagementClient.Variables.CreateOrUpdate(variable.ResourceGroupName, variable.AutomationAccountName, createParams).Variable;
+
+ return new Variable(sdkCreatedVariable, variable.AutomationAccountName, variable.ResourceGroupName);
+ }
+
+ public void DeleteVariable(string resourceGroupName, string automationAccountName, string variableName)
+ {
+ try
+ {
+ this.automationManagementClient.Variables.Delete(resourceGroupName, automationAccountName, variableName);
+ }
+ catch (CloudException cloudException)
+ {
+ if (cloudException.Response.StatusCode == HttpStatusCode.NoContent)
+ {
+ throw new ResourceNotFoundException(typeof (Variable),
+ string.Format(CultureInfo.CurrentCulture, Resources.VariableNotFound, variableName));
+ }
+
+ throw;
+ }
+ }
+
+ public Variable UpdateVariable(Variable variable, VariableUpdateFields updateFields)
+ {
+ var existingVariable = this.GetVariable(variable.ResourceGroupName, variable.AutomationAccountName, variable.Name);
+
+ if (existingVariable.Encrypted != variable.Encrypted && updateFields == VariableUpdateFields.OnlyValue)
+ {
+ throw new ResourceNotFoundException(typeof (Variable),
+ string.Format(CultureInfo.CurrentCulture, Resources.VariableEncryptionCannotBeChanged, variable.Name,
+ existingVariable.Encrypted));
+ }
+
+ var updateParams = new AutomationManagement.Models.VariablePatchParameters()
+ {
+ Name = variable.Name,
+ };
+
+ if (updateFields == VariableUpdateFields.OnlyDescription)
+ {
+ updateParams.Properties = new AutomationManagement.Models.VariablePatchProperties()
+ {
+ Description = variable.Description
+ };
+ }
+ else
+ {
+ updateParams.Properties = new AutomationManagement.Models.VariablePatchProperties()
+ {
+ Value = PowerShellJsonConverter.Serialize(variable.Value)
+ };
+ }
+
+ this.automationManagementClient.Variables.Patch(variable.ResourceGroupName, variable.AutomationAccountName, updateParams);
+
+ return this.GetVariable(variable.ResourceGroupName, variable.AutomationAccountName, variable.Name);
+ }
+
+ public Variable GetVariable(string resourceGroupName, string automationAccountName, string name)
+ {
+ try
+ {
+ var sdkVarible = this.automationManagementClient.Variables.Get(resourceGroupName, automationAccountName, name).Variable;
+
+ if (sdkVarible != null)
+ {
+ return new Variable(sdkVarible, automationAccountName, resourceGroupName);
+ }
+
+ throw new ResourceNotFoundException(typeof (Variable),
+ string.Format(CultureInfo.CurrentCulture, Resources.VariableNotFound, name));
+ }
+ catch (CloudException)
+ {
+ throw new ResourceNotFoundException(typeof (Variable),
+ string.Format(CultureInfo.CurrentCulture, Resources.VariableNotFound, name));
+ }
+ }
+
+ public IEnumerable ListVariables(string resourceGroupName, string automationAccountName, ref string nextLink)
+ {
+ VariableListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.Variables.List(
+ resourceGroupName,
+ automationAccountName);
+ }
+ else
+ {
+ response = this.automationManagementClient.Variables.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return response.Variables.Select(c => new Variable(c, automationAccountName, resourceGroupName));
+ }
+
+ #endregion
+
+ #region Credentials
+
+ public CredentialInfo CreateCredential(string resourceGroupName, string automationAccountName, string name, string userName,
+ string password,
+ string description)
+ {
+ var credentialCreateParams = new AutomationManagement.Models.CredentialCreateOrUpdateParameters();
+ credentialCreateParams.Name = name;
+ credentialCreateParams.Properties = new AutomationManagement.Models.CredentialCreateOrUpdateProperties();
+ if (description != null) credentialCreateParams.Properties.Description = description;
+
+ Requires.Argument("userName", userName).NotNull();
+ Requires.Argument("password", password).NotNull();
+
+ credentialCreateParams.Properties.UserName = userName;
+ credentialCreateParams.Properties.Password = password;
+
+ var createdCredential = this.automationManagementClient.PsCredentials.CreateOrUpdate(resourceGroupName, automationAccountName,
+ credentialCreateParams);
+
+ if (createdCredential == null || createdCredential.StatusCode != HttpStatusCode.Created)
+ {
+ new AzureAutomationOperationException(string.Format(Resources.AutomationOperationFailed, "Create",
+ "credential", name, automationAccountName));
+ }
+ return new CredentialInfo(resourceGroupName, automationAccountName, createdCredential.Credential);
+ }
+
+ public CredentialInfo UpdateCredential(string resourceGroupName, string automationAccountName, string name, string userName,
+ string password,
+ string description)
+ {
+ var exisitngCredential = this.GetCredential(resourceGroupName, automationAccountName, name);
+ var credentialUpdateParams = new CredentialPatchParameters();
+ credentialUpdateParams.Name = name;
+ credentialUpdateParams.Properties = new CredentialPatchProperties();
+ credentialUpdateParams.Properties.Description = description ?? exisitngCredential.Description;
+
+ credentialUpdateParams.Properties.UserName = userName;
+ credentialUpdateParams.Properties.Password = password;
+
+ var credential = this.automationManagementClient.PsCredentials.Patch(resourceGroupName, automationAccountName,
+ credentialUpdateParams);
+
+ if (credential == null || credential.StatusCode != HttpStatusCode.OK)
+ {
+ new AzureAutomationOperationException(string.Format(Resources.AutomationOperationFailed, "Update",
+ "credential", name, automationAccountName));
+ }
+
+ var updatedCredential = this.GetCredential(resourceGroupName, automationAccountName, name);
+
+ return updatedCredential;
+ }
+
+ public CredentialInfo GetCredential(string resourceGroupName, string automationAccountName, string name)
+ {
+ var credential = this.automationManagementClient.PsCredentials.Get(resourceGroupName, automationAccountName, name).Credential;
+ if (credential == null)
+ {
+ throw new ResourceNotFoundException(typeof (Credential),
+ string.Format(CultureInfo.CurrentCulture, Resources.CredentialNotFound, name));
+ }
+
+ return new CredentialInfo(resourceGroupName, automationAccountName, credential);
+ }
+
+ public IEnumerable ListCredentials(string resourceGroupName, string automationAccountName, ref string nextLink)
+ {
+ CredentialListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.PsCredentials.List(
+ resourceGroupName,
+ automationAccountName);
+ }
+ else
+ {
+ response = this.automationManagementClient.PsCredentials.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return response.Credentials.Select(c => new Credential(resourceGroupName, automationAccountName, c));
+ }
+
+ public void DeleteCredential(string resourceGroupName, string automationAccountName, string name)
+ {
+ try
+ {
+ var credential = this.automationManagementClient.PsCredentials.Delete(resourceGroupName, automationAccountName, name);
+ }
+ catch (CloudException cloudException)
+ {
+ if (cloudException.Response.StatusCode == HttpStatusCode.NotFound)
+ {
+ throw new ResourceNotFoundException(typeof (Credential),
+ string.Format(CultureInfo.CurrentCulture, Resources.CredentialNotFound, name));
+ }
+
+ throw;
+ }
+ }
+
+ #endregion
+
+ #region Jobs
+
+ public IEnumerable GetJobStream(string resourceGroupName, string automationAccountName, Guid jobId, DateTimeOffset? time,
+ string streamType, ref string nextLink)
+ {
+ var listParams = new AutomationManagement.Models.JobStreamListParameters();
+
+ if (time.HasValue)
+ {
+ listParams.Time = this.FormatDateTime(time.Value);
+ }
+
+ if (streamType != null)
+ {
+ listParams.StreamType = streamType;
+ }
+
+ JobStreamListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.JobStreams.List(resourceGroupName, automationAccountName, jobId, listParams);
+ }
+ else
+ {
+ response = this.automationManagementClient.JobStreams.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return
+ response.JobStreams.Select(
+ stream => this.CreateJobStreamFromJobStreamModel(stream, resourceGroupName, automationAccountName, jobId));
+ }
+
+ public Job GetJob(string resourceGroupName, string automationAccountName, Guid Id)
+ {
+ var job = this.automationManagementClient.Jobs.Get(resourceGroupName, automationAccountName, Id).Job;
+ if (job == null)
+ {
+ throw new ResourceNotFoundException(typeof (Job),
+ string.Format(CultureInfo.CurrentCulture, Resources.JobNotFound, Id));
+ }
+
+ return new Job(resourceGroupName, automationAccountName, job);
+ }
+
+ public IEnumerable ListJobsByRunbookName(string resourceGroupName, string automationAccountName, string runbookName,
+ DateTimeOffset? startTime, DateTimeOffset? endTime, string jobStatus, ref string nextLink)
+ {
+ JobListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.Jobs.List(
+ resourceGroupName,
+ automationAccountName,
+ new JobListParameters
+ {
+ StartTime = (startTime.HasValue) ? FormatDateTime(startTime.Value) : null,
+ EndTime = (endTime.HasValue) ? FormatDateTime(endTime.Value) : null,
+ RunbookName = runbookName,
+ Status = jobStatus,
+ });
+ }
+ else
+ {
+ response = this.automationManagementClient.Jobs.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return response.Jobs.Select(c => new Job(resourceGroupName, automationAccountName, c));
+ }
+
+ public IEnumerable ListJobs(string resourceGroupName, string automationAccountName, DateTimeOffset? startTime,
+ DateTimeOffset? endTime, string jobStatus, ref string nextLink)
+ {
+ JobListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.Jobs.List(
+ resourceGroupName,
+ automationAccountName,
+ new JobListParameters
+ {
+ StartTime = (startTime.HasValue) ? FormatDateTime(startTime.Value) : null,
+ EndTime = (endTime.HasValue) ? FormatDateTime(endTime.Value) : null,
+ Status = jobStatus,
+ });
+ }
+ else
+ {
+ response = this.automationManagementClient.Jobs.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return response.Jobs.Select(c => new Job(resourceGroupName, automationAccountName, c));
+ }
+
+ public void ResumeJob(string resourceGroupName, string automationAccountName, Guid id)
+ {
+ this.automationManagementClient.Jobs.Resume(resourceGroupName, automationAccountName, id);
+ }
+
+ public void StopJob(string resourceGroupName, string automationAccountName, Guid id)
+ {
+ this.automationManagementClient.Jobs.Stop(resourceGroupName, automationAccountName, id);
+ }
+
+ public void SuspendJob(string resourceGroupName, string automationAccountName, Guid id)
+ {
+ this.automationManagementClient.Jobs.Suspend(resourceGroupName, automationAccountName, id);
+ }
+
+ #endregion
+
+ #region Certificate Operations
+
+ public CertificateInfo CreateCertificate(string resourceGroupName, string automationAccountName, string name, string path,
+ SecureString password,
+ string description, bool exportable)
+ {
+ var certificateModel = this.TryGetCertificateModel(resourceGroupName, automationAccountName, name);
+ if (certificateModel != null)
+ {
+ throw new ResourceCommonException(typeof (CertificateInfo),
+ string.Format(CultureInfo.CurrentCulture, Resources.CertificateAlreadyExists, name));
+ }
+
+ return CreateCertificateInternal(resourceGroupName, automationAccountName, name, path, password, description, exportable);
+ }
+
+
+ public CertificateInfo UpdateCertificate(string resourceGroupName, string automationAccountName, string name, string path,
+ SecureString password,
+ string description, bool? exportable)
+ {
+ if (String.IsNullOrWhiteSpace(path) && (password != null || exportable.HasValue))
+ {
+ throw new ResourceCommonException(typeof (CertificateInfo),
+ string.Format(CultureInfo.CurrentCulture, Resources.SetCertificateInvalidArgs, name));
+ }
+
+ var certificateModel = this.TryGetCertificateModel(resourceGroupName, automationAccountName, name);
+ if (certificateModel == null)
+ {
+ throw new ResourceCommonException(typeof (CertificateInfo),
+ string.Format(CultureInfo.CurrentCulture, Resources.CertificateNotFound, name));
+ }
+
+ var createOrUpdateDescription = description ?? certificateModel.Properties.Description;
+ var createOrUpdateIsExportable = (exportable.HasValue)
+ ? exportable.Value
+ : certificateModel.Properties.IsExportable;
+
+ if (path != null)
+ {
+ return this.CreateCertificateInternal(resourceGroupName, automationAccountName, name, path, password,
+ createOrUpdateDescription,
+ createOrUpdateIsExportable);
+ }
+
+ var cuparam = new CertificatePatchParameters()
+ {
+ Name = name,
+ Properties = new CertificatePatchProperties()
+ {
+ Description = createOrUpdateDescription
+ }
+ };
+
+ this.automationManagementClient.Certificates.Patch(resourceGroupName, automationAccountName, cuparam);
+
+ return new CertificateInfo(resourceGroupName, automationAccountName,
+ this.automationManagementClient.Certificates.Get(resourceGroupName, automationAccountName, name).Certificate);
+ }
+
+ public CertificateInfo GetCertificate(string resourceGroupName, string automationAccountName, string name)
+ {
+ var certificateModel = this.TryGetCertificateModel(resourceGroupName, automationAccountName, name);
+ if (certificateModel == null)
+ {
+ throw new ResourceCommonException(typeof (CertificateInfo),
+ string.Format(CultureInfo.CurrentCulture, Resources.CertificateNotFound, name));
+ }
+
+ return new Certificate(resourceGroupName, automationAccountName, certificateModel);
+ }
+
+ public IEnumerable ListCertificates(string resourceGroupName, string automationAccountName, ref string nextLink)
+ {
+ CertificateListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.Certificates.List(resourceGroupName, automationAccountName);
+ }
+ else
+ {
+ response = this.automationManagementClient.Certificates.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return response.Certificates.Select(c => new CertificateInfo(resourceGroupName, automationAccountName, c));
+ }
+
+ public void DeleteCertificate(string resourceGroupName, string automationAccountName, string name)
+ {
+ try
+ {
+ this.automationManagementClient.Certificates.Delete(resourceGroupName, automationAccountName, name);
+ }
+ catch (CloudException cloudException)
+ {
+ if (cloudException.Response.StatusCode == HttpStatusCode.NoContent)
+ {
+ throw new ResourceNotFoundException(typeof (Schedule),
+ string.Format(CultureInfo.CurrentCulture, Resources.CertificateNotFound, name));
+ }
+
+ throw;
+ }
+ }
+
+ #endregion
+
+ #region Connection Operations
+
+ public Connection CreateConnection(string resourceGroupName, string automationAccountName, string name, string connectionTypeName,
+ IDictionary connectionFieldValues,
+ string description)
+ {
+ var connectionModel = this.TryGetConnectionModel(resourceGroupName, automationAccountName, name);
+ if (connectionModel != null)
+ {
+ throw new ResourceCommonException(typeof (Connection),
+ string.Format(CultureInfo.CurrentCulture, Resources.ConnectionAlreadyExists, name));
+ }
+
+ var ccprop = new ConnectionCreateOrUpdateProperties()
+ {
+ Description = description,
+ ConnectionType = new ConnectionTypeAssociationProperty() {Name = connectionTypeName},
+ FieldDefinitionValues =
+ connectionFieldValues.Cast()
+ .ToDictionary(kvp => kvp.Key.ToString(), kvp => kvp.Value.ToString())
+ };
+
+ var ccparam = new ConnectionCreateOrUpdateParameters() {Name = name, Properties = ccprop};
+
+ var connection =
+ this.automationManagementClient.Connections.CreateOrUpdate(resourceGroupName, automationAccountName, ccparam).Connection;
+
+ return new Connection(resourceGroupName, automationAccountName, connection);
+ }
+
+ public Connection UpdateConnectionFieldValue(string resourceGroupName, string automationAccountName, string name,
+ string connectionFieldName, object value)
+ {
+ var connectionModel = this.TryGetConnectionModel(resourceGroupName, automationAccountName, name);
+ if (connectionModel == null)
+ {
+ throw new ResourceCommonException(typeof (Connection),
+ string.Format(CultureInfo.CurrentCulture, Resources.ConnectionNotFound, name));
+ }
+
+ if (connectionModel.Properties.FieldDefinitionValues.ContainsKey(connectionFieldName))
+ {
+ connectionModel.Properties.FieldDefinitionValues[connectionFieldName] =
+ PowerShellJsonConverter.Serialize(value);
+ }
+ else
+ {
+ throw new ResourceCommonException(typeof (Connection),
+ string.Format(CultureInfo.CurrentCulture, Resources.ConnectionFieldNameNotFound, name));
+ }
+
+ var cuparam = new ConnectionPatchParameters()
+ {
+ Name = name,
+ Properties = new ConnectionPatchProperties()
+ {
+ Description = connectionModel.Properties.Description,
+ FieldDefinitionValues = connectionModel.Properties.FieldDefinitionValues
+ }
+ };
+
+ this.automationManagementClient.Connections.Patch(resourceGroupName, automationAccountName, cuparam);
+
+ return new Connection(resourceGroupName, automationAccountName,
+ this.automationManagementClient.Connections.Get(resourceGroupName, automationAccountName, name).Connection);
+ }
+
+ public Connection GetConnection(string resourceGroupName, string automationAccountName, string name)
+ {
+ var connectionModel = this.TryGetConnectionModel(resourceGroupName, automationAccountName, name);
+ if (connectionModel == null)
+ {
+ throw new ResourceCommonException(typeof (Connection),
+ string.Format(CultureInfo.CurrentCulture, Resources.ConnectionNotFound, name));
+ }
+
+ return new Connection(resourceGroupName, automationAccountName, connectionModel);
+ }
+
+ public IEnumerable ListConnectionsByType(string resourceGroupName, string automationAccountName, string typeName)
+ {
+ var connections = new List();
+ string nextLink = string.Empty;
+
+ do
+ {
+ connections.AddRange(this.ListConnections(resourceGroupName, automationAccountName, ref nextLink));
+
+ } while (!string.IsNullOrEmpty(nextLink));
+
+ return
+ connections.Where(
+ c => c.ConnectionTypeName.Equals(typeName, StringComparison.InvariantCultureIgnoreCase));
+ }
+
+ public IEnumerable ListConnections(string resourceGroupName, string automationAccountName, ref string nextLink)
+ {
+ ConnectionListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.Connections.List(
+ resourceGroupName,
+ automationAccountName);
+ }
+ else
+ {
+ response = this.automationManagementClient.Connections.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return response.Connection.Select(c => new Connection(resourceGroupName, automationAccountName, c));
+ }
+
+ public void DeleteConnection(string resourceGroupName, string automationAccountName, string name)
+ {
+ try
+ {
+ this.automationManagementClient.Connections.Delete(resourceGroupName, automationAccountName, name);
+ }
+ catch (CloudException cloudException)
+ {
+ if (cloudException.Response.StatusCode == HttpStatusCode.NoContent)
+ {
+ throw new ResourceNotFoundException(typeof (Connection),
+ string.Format(CultureInfo.CurrentCulture, Resources.ConnectionNotFound, name));
+ }
+
+ throw;
+ }
+ }
+
+ #endregion
+
+ #region JobSchedules
+
+ public JobSchedule GetJobSchedule(string resourceGroupName, string automationAccountName, Guid jobScheduleId)
+ {
+ AutomationManagement.Models.JobSchedule jobScheduleModel = null;
+
+ try
+ {
+ jobScheduleModel = this.automationManagementClient.JobSchedules.Get(
+ resourceGroupName,
+ automationAccountName,
+ jobScheduleId)
+ .JobSchedule;
+ }
+ catch (CloudException cloudException)
+ {
+ if (cloudException.Response.StatusCode == HttpStatusCode.NotFound)
+ {
+ throw new ResourceNotFoundException(typeof (JobSchedule),
+ string.Format(CultureInfo.CurrentCulture, Resources.JobScheduleWithIdNotFound, jobScheduleId));
+ }
+
+ throw;
+ }
+
+ return this.CreateJobScheduleFromJobScheduleModel(resourceGroupName, automationAccountName, jobScheduleModel);
+ }
+
+ public JobSchedule GetJobSchedule(string resourceGroupName, string automationAccountName, string runbookName, string scheduleName)
+ {
+ const bool jobScheduleFound = false;
+ var nextLink = string.Empty;
+
+ do
+ {
+ var schedules = this.ListJobSchedules(resourceGroupName, automationAccountName, ref nextLink);
+ var jobSchedule =
+ schedules.FirstOrDefault(
+ js => String.Equals(js.RunbookName, runbookName, StringComparison.OrdinalIgnoreCase) &&
+ String.Equals(js.ScheduleName, scheduleName, StringComparison.OrdinalIgnoreCase));
+
+ if (jobSchedule != null)
+ {
+ this.GetJobSchedule(resourceGroupName, automationAccountName, new Guid(jobSchedule.JobScheduleId));
+ return jobSchedule;
+ }
+
+ } while (!string.IsNullOrEmpty(nextLink));
+
+ if (!jobScheduleFound)
+ {
+ throw new ResourceNotFoundException(typeof (Schedule),
+ string.Format(CultureInfo.CurrentCulture, Resources.JobScheduleNotFound, runbookName, scheduleName));
+ }
+ }
+
+ public IEnumerable ListJobSchedules(string resourceGroupName, string automationAccountName, ref string nextLink)
+ {
+ JobScheduleListResponse response;
+
+ if (string.IsNullOrEmpty(nextLink))
+ {
+ response = this.automationManagementClient.JobSchedules.List(resourceGroupName, automationAccountName);
+ }
+ else
+ {
+ response = this.automationManagementClient.JobSchedules.ListNext(nextLink);
+ }
+
+ nextLink = response.NextLink;
+ return response.JobSchedules.Select(c => new JobSchedule(resourceGroupName, automationAccountName, c));
+ }
+
+ public IEnumerable ListJobSchedulesByRunbookName(string resourceGroupName, string automationAccountName, string runbookName)
+ {
+ var jobSchedulesOfRunbook = new List();
+ var nextLink = string.Empty;
+
+ do
+ {
+ var schedules = this.ListJobSchedules(resourceGroupName, automationAccountName, ref nextLink);
+ jobSchedulesOfRunbook.AddRange(
+ schedules.Where(js => String.Equals(js.RunbookName, runbookName, StringComparison.OrdinalIgnoreCase)));
+
+ } while (!string.IsNullOrEmpty(nextLink));
+
+ return jobSchedulesOfRunbook;
+ }
+
+ public IEnumerable ListJobSchedulesByScheduleName(string resourceGroupName, string automationAccountName, string scheduleName)
+ {
+ var jobSchedulesOfSchedules = new List();
+ var nextLink = string.Empty;
+
+ do
+ {
+ var schedules = this.ListJobSchedules(resourceGroupName, automationAccountName, ref nextLink);
+ jobSchedulesOfSchedules.AddRange(
+ schedules.Where(
+ js => String.Equals(js.ScheduleName, scheduleName, StringComparison.OrdinalIgnoreCase)));
+
+ } while (!string.IsNullOrEmpty(nextLink));
+
+ return jobSchedulesOfSchedules;
+ }
+
+ public JobSchedule RegisterScheduledRunbook(string resourceGroupName, string automationAccountName, string runbookName,
+ string scheduleName, IDictionary parameters)
+ {
+ var processedParameters = this.ProcessRunbookParameters(resourceGroupName, automationAccountName, runbookName, parameters);
+ var sdkJobSchedule = this.automationManagementClient.JobSchedules.Create(
+ resourceGroupName,
+ automationAccountName,
+ new JobScheduleCreateParameters
+ {
+ Properties = new JobScheduleCreateProperties
+ {
+ Schedule = new ScheduleAssociationProperty {Name = scheduleName},
+ Runbook = new RunbookAssociationProperty {Name = runbookName},
+ Parameters = processedParameters
+ }
+ }).JobSchedule;
+
+ return new JobSchedule(resourceGroupName, automationAccountName, sdkJobSchedule);
+ }
+
+ public void UnregisterScheduledRunbook(string resourceGroupName, string automationAccountName, Guid jobScheduleId)
+ {
+ try
+ {
+ this.automationManagementClient.JobSchedules.Delete(
+ resourceGroupName,
+ automationAccountName,
+ jobScheduleId);
+ }
+ catch (CloudException cloudException)
+ {
+ if (cloudException.Response.StatusCode == HttpStatusCode.NotFound)
+ {
+ throw new ResourceNotFoundException(typeof (Schedule),
+ string.Format(CultureInfo.CurrentCulture, Resources.JobScheduleWithIdNotFound, jobScheduleId));
+ }
+
+ throw;
+ }
+ }
+
+ public void UnregisterScheduledRunbook(string resourceGroupName, string automationAccountName, string runbookName, string scheduleName)
+ {
+ const bool jobScheduleFound = false;
+ var nextLink = string.Empty;
+
+ do
+ {
+ var schedules = this.ListJobSchedules(resourceGroupName, automationAccountName, ref nextLink);
+ var jobSchedule =
+ schedules.FirstOrDefault(
+ js => String.Equals(js.RunbookName, runbookName, StringComparison.OrdinalIgnoreCase) &&
+ String.Equals(js.ScheduleName, scheduleName, StringComparison.OrdinalIgnoreCase));
+
+ if (jobSchedule != null)
+ {
+ this.UnregisterScheduledRunbook(resourceGroupName, automationAccountName, new Guid(jobSchedule.JobScheduleId));
+ return;
+ }
+
+ } while (!string.IsNullOrEmpty(nextLink));
+
+ if (!jobScheduleFound)
+ {
+ throw new ResourceNotFoundException(typeof (Schedule),
+ string.Format(CultureInfo.CurrentCulture, Resources.JobScheduleNotFound, runbookName, scheduleName));
+ }
+ }
+
+ #endregion
+
+
+ #region Private Methods
+
+ private Schedule CreateScheduleFromScheduleModel(string resourceGroupName, string automationAccountName,
+ AutomationManagement.Models.Schedule schedule)
+ {
+ Requires.Argument("schedule", schedule).NotNull();
+
+ return new Schedule(resourceGroupName, automationAccountName, schedule);
+ }
+
+ private JobSchedule CreateJobScheduleFromJobScheduleModel(string resourceGroupName, string automationAccountName,
+ AutomationManagement.Models.JobSchedule jobSchedule)
+ {
+ Requires.Argument("jobSchedule", jobSchedule).NotNull();
+
+ return new JobSchedule(resourceGroupName, automationAccountName, jobSchedule);
+ }
+
+ private Azure.Management.Automation.Models.Runbook TryGetRunbookModel(string resourceGroupName, string automationAccountName,
+ string runbookName)
+ {
+ Azure.Management.Automation.Models.Runbook runbook = null;
+ try
+ {
+ runbook = this.automationManagementClient.Runbooks.Get(resourceGroupName, automationAccountName, runbookName).Runbook;
+ }
+ catch (CloudException e)
+ {
+ if (e.Response.StatusCode == HttpStatusCode.NotFound)
+ {
+ runbook = null;
+ }
+ else
+ {
+ throw;
+ }
+ }
+ return runbook;
+ }
+
+ private Azure.Management.Automation.Models.Certificate TryGetCertificateModel(string resourceGroupName, string automationAccountName,
+ string certificateName)
+ {
+ Azure.Management.Automation.Models.Certificate certificate = null;
+ try
+ {
+ certificate =
+ this.automationManagementClient.Certificates.Get(resourceGroupName, automationAccountName, certificateName).Certificate;
+ }
+ catch (CloudException e)
+ {
+ if (e.Response.StatusCode == HttpStatusCode.NotFound)
+ {
+ certificate = null;
+ }
+ else
+ {
+ throw;
+ }
+ }
+ return certificate;
+ }
+
+ private IEnumerable> ListRunbookParameters(string resourceGroupName, string automationAccountName,
+ string runbookName)
+ {
+ Runbook runbook = this.GetRunbook(resourceGroupName, automationAccountName, runbookName);
+ if (0 == String.Compare(runbook.State, RunbookState.New, CultureInfo.InvariantCulture,
+ CompareOptions.IgnoreCase))
+ {
+ throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture,
+ Resources.RunbookHasNoPublishedVersion, runbookName));
+ }
+ return runbook.Parameters.Cast()
+ .ToDictionary(k => k.Key.ToString(), k => (RunbookParameter) k.Value);
+ }
+
+ private IDictionary ProcessRunbookParameters(string resourceGroupName, string automationAccountName, string runbookName,
+ IDictionary parameters)
+ {
+ parameters = parameters ?? new Dictionary();
+ IEnumerable> runbookParameters =
+ this.ListRunbookParameters(resourceGroupName, automationAccountName, runbookName);
+ var filteredParameters = new Dictionary();
+
+ foreach (var runbookParameter in runbookParameters)
+ {
+ if (parameters.Contains(runbookParameter.Key))
+ {
+ object paramValue = parameters[runbookParameter.Key];
+ try
+ {
+ filteredParameters.Add(runbookParameter.Key, PowerShellJsonConverter.Serialize(paramValue));
+ }
+ catch (JsonSerializationException)
+ {
+ throw new ArgumentException(
+ string.Format(
+ CultureInfo.CurrentCulture, Resources.RunbookParameterCannotBeSerializedToJson,
+ runbookParameter.Key));
+ }
+ }
+ else if (runbookParameter.Value.IsMandatory)
+ {
+ throw new ArgumentException(
+ string.Format(
+ CultureInfo.CurrentCulture, Resources.RunbookParameterValueRequired, runbookParameter.Key));
+ }
+ }
+
+ if (filteredParameters.Count != parameters.Count)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Resources.InvalidRunbookParameters));
+ }
+
+ var hasJobStartedBy =
+ filteredParameters.Any(filteredParameter => filteredParameter.Key == Constants.JobStartedByParameterName);
+
+ if (!hasJobStartedBy)
+ {
+ filteredParameters.Add(Constants.JobStartedByParameterName,
+ PowerShellJsonConverter.Serialize(Constants.ClientIdentity));
+ }
+
+ return filteredParameters;
+ }
+
+ private AutomationManagement.Models.Schedule GetScheduleModel(string resourceGroupName, string automationAccountName, string scheduleName)
+ {
+ AutomationManagement.Models.Schedule scheduleModel;
+ try
+ {
+ scheduleModel = this.automationManagementClient.Schedules.Get(
+ resourceGroupName,
+ automationAccountName,
+ scheduleName)
+ .Schedule;
+ }
+ catch (CloudException cloudException)
+ {
+ if (cloudException.Response.StatusCode == HttpStatusCode.NotFound)
+ {
+ throw new ResourceNotFoundException(typeof (Schedule),
+ string.Format(CultureInfo.CurrentCulture, Resources.ScheduleNotFound, scheduleName));
+ }
+
+ throw;
+ }
+
+ return scheduleModel;
+ }
+
+
+ private Schedule UpdateScheduleHelper(string resourceGroupName, string automationAccountName,
+ string scheduleName, bool? isEnabled, string description)
+ {
+ var scheduleUpdateParameters = new AutomationManagement.Models.SchedulePatchParameters
+ {
+ Name = scheduleName,
+ Properties = new AutomationManagement.Models.SchedulePatchProperties
+ {
+ Description = description,
+ IsEnabled = isEnabled
+ }
+ };
+
+ this.automationManagementClient.Schedules.Patch(
+ resourceGroupName,
+ automationAccountName,
+ scheduleUpdateParameters);
+
+ return this.GetSchedule(resourceGroupName, automationAccountName, scheduleName);
+ }
+
+ private Certificate CreateCertificateInternal(string resourceGroupName, string automationAccountName, string name, string path,
+ SecureString password, string description, bool exportable)
+ {
+ var cert = (password == null)
+ ? new X509Certificate2(path, String.Empty,
+ X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet |
+ X509KeyStorageFlags.MachineKeySet)
+ : new X509Certificate2(path, password,
+ X509KeyStorageFlags.Exportable | X509KeyStorageFlags.PersistKeySet |
+ X509KeyStorageFlags.MachineKeySet);
+
+ var ccprop = new CertificateCreateOrUpdateProperties()
+ {
+ Description = description,
+ Base64Value = Convert.ToBase64String(cert.Export(X509ContentType.Pkcs12)),
+ Thumbprint = cert.Thumbprint,
+ IsExportable = exportable
+ };
+
+ var ccparam = new CertificateCreateOrUpdateParameters() {Name = name, Properties = ccprop};
+
+ var certificate =
+ this.automationManagementClient.Certificates.CreateOrUpdate(resourceGroupName, automationAccountName, ccparam).Certificate;
+
+ return new Certificate(resourceGroupName, automationAccountName, certificate);
+ }
+
+ private Azure.Management.Automation.Models.Connection TryGetConnectionModel(string resourceGroupName, string automationAccountName,
+ string connectionName)
+ {
+ Azure.Management.Automation.Models.Connection connection = null;
+ try
+ {
+ connection =
+ this.automationManagementClient.Connections.Get(resourceGroupName, automationAccountName, connectionName).Connection;
+ }
+ catch (CloudException e)
+ {
+ if (e.Response.StatusCode == HttpStatusCode.NotFound)
+ {
+ connection = null;
+ }
+ else
+ {
+ throw;
+ }
+ }
+ return connection;
+ }
+
+ private DirectoryInfo WriteRunbookToFile(string outputFolder, string runbookName, string content, string runbookType, bool overwriteExistingFile)
+ {
+ string outputFolderFullPath = this.GetCurrentDirectory();
+
+ if (!string.IsNullOrEmpty(outputFolder))
+ {
+ outputFolderFullPath = this.ValidateAndGetFullPath(outputFolder);
+ }
+
+ var fileExtension = (0 == string.Compare(runbookType, Constants.RunbookType.Graph, StringComparison.OrdinalIgnoreCase)) ? Constants.SupportedFileExtensions.Graph : Constants.SupportedFileExtensions.PowerShellScript;
+
+ var outputFilePath = outputFolderFullPath + "\\" + runbookName + fileExtension;
+
+ // file exists and overwrite Not specified
+ if (File.Exists(outputFilePath) && !overwriteExistingFile)
+ {
+ throw new ArgumentException(
+ string.Format(CultureInfo.CurrentCulture, Resources.RunbookFileAlreadyExists, outputFilePath));
+ }
+
+ // Write to the file
+ this.WriteFile(outputFilePath, content);
+
+ return new DirectoryInfo(runbookName + fileExtension);
+ }
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/src/ResourceManager/Automation/Commands.Automation/Common/Constants.cs b/src/ResourceManager/Automation/Commands.Automation/Common/Constants.cs
index ef606c24fe19..50f337200441 100644
--- a/src/ResourceManager/Automation/Commands.Automation/Common/Constants.cs
+++ b/src/ResourceManager/Automation/Commands.Automation/Common/Constants.cs
@@ -34,6 +34,8 @@ public class Constants
public const string JobStartedByParameterName = "MicrosoftApplicationManagementStartedBy";
+ public const string JobRunOnParameterName = "MicrosoftApplicationManagementRunOn";
+
public const string ClientRequestIdHeaderName = "x-ms-client-request-id";
// default schedule expiry time for daily schedule, consistent with UX
@@ -64,5 +66,22 @@ public class AutomationAccountState
public const string ModulesUrl = @"https://eus2oaasibizamarketprod1.blob.core.windows.net/automationdscpreview/RegistrationMetaConfig.zip";
public const string ConfigurationFunction = @"RegistrationMetaConfig.ps1\RegistrationMetaConfig";
+
+
+ public static class RunbookType
+ {
+ public const string PowerShell = "PowerShell";
+
+ public const string PowerShellWorkflow = "PowerShellWorkflow";
+
+ public const string Graph = "Graph";
+ }
+
+ public static class SupportedFileExtensions
+ {
+ public const string PowerShellScript = ".ps1";
+
+ public const string Graph = ".graphrunbook";
+ }
}
}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Common/IAutomationClient.cs b/src/ResourceManager/Automation/Commands.Automation/Common/IAutomationClient.cs
index 910b3f1e394e..e60b1cd216e2 100644
--- a/src/ResourceManager/Automation/Commands.Automation/Common/IAutomationClient.cs
+++ b/src/ResourceManager/Automation/Commands.Automation/Common/IAutomationClient.cs
@@ -149,6 +149,140 @@ Model.Webhook CreateWebhook(
void DeleteWebhook(string resourceGroupName, string automationAccountName, string name);
+ #endregion
+
+ #region Variables
+
+ Variable GetVariable(string resourceGroupName, string automationAccountName, string variableName);
+
+ IEnumerable ListVariables(string resourceGroupName, string automationAccountName, ref string nextLink);
+
+ Variable CreateVariable(Variable variable);
+
+ void DeleteVariable(string resourceGroupName, string automationAccountName, string variableName);
+
+ Variable UpdateVariable(Variable variable, VariableUpdateFields updateFields);
+
+ #endregion
+
+ #region Schedules
+
+ Schedule CreateSchedule(string resourceGroupName, string automationAccountName, Schedule schedule);
+
+ void DeleteSchedule(string resourceGroupName, string automationAccountName, string scheduleName);
+
+ Schedule GetSchedule(string resourceGroupName, string automationAccountName, string scheduleName);
+
+ IEnumerable ListSchedules(string resourceGroupName, string automationAccountName, ref string nextLink);
+
+ Schedule UpdateSchedule(string resourceGroupName, string automationAccountName, string scheduleName, bool? isEnabled, string description);
+
+ #endregion
+
+ #region Runbooks
+
+ Runbook GetRunbook(string resourceGroupName, string automationAccountName, string runbookName);
+
+ IEnumerable ListRunbooks(string resourceGroupName, string automationAccountName, ref string nextLink);
+
+ Runbook CreateRunbookByName(string resourceGroupName, string automationAccountName, string runbookName, string description, IDictionary tags, string type, bool? logProgress, bool? logVerbose, bool overwrite);
+
+ Runbook ImportRunbook(string resourceGroupName, string automationAccountName, string runbookPath, string description, IDictionary tags, string type, bool? logProgress, bool? logVerbose, bool published, bool overwrite);
+
+ void DeleteRunbook(string resourceGroupName, string automationAccountName, string runbookName);
+
+ Runbook PublishRunbook(string resourceGroupName, string automationAccountName, string runbookName);
+
+ Runbook UpdateRunbook(string resourceGroupName, string automationAccountName, string runbookName, string description, IDictionary tags, bool? logProgress, bool? logVerbose);
+
+ DirectoryInfo ExportRunbook(string resourceGroupName, string automationAccountName, string runbookName, bool? isDraft, string sourcePath, bool overwrite);
+
+ Job StartRunbook(string resourceGroupName, string automationAccountName, string runbookName, IDictionary parameters, string runOn);
+
+ #endregion
+
+ #region Credentials
+
+ CredentialInfo CreateCredential(string resourceGroupName, string automationAccountName, string name, string userName, string password, string description);
+
+ CredentialInfo UpdateCredential(string resourceGroupName, string automationAccountName, string name, string userName, string password, string description);
+
+ CredentialInfo GetCredential(string resourceGroupName, string automationAccountName, string name);
+
+ IEnumerable ListCredentials(string resourceGroupName, string automationAccountName, ref string nextLink);
+
+ void DeleteCredential(string resourceGroupName, string automationAccountName, string name);
+
+ #endregion
+
+ #region Jobs
+
+ Job GetJob(string resourceGroupName, string automationAccountName, Guid id);
+
+ IEnumerable ListJobsByRunbookName(string resourceGroupName, string automationAccountName, string runbookName, DateTimeOffset? startTime, DateTimeOffset? endTime, string jobStatus, ref string nextLink);
+
+ IEnumerable ListJobs(string resourceGroupName, string automationAccountName, DateTimeOffset? startTime, DateTimeOffset? endTime, string jobStatus, ref string nextLink);
+
+ void ResumeJob(string resourceGroupName, string automationAccountName, Guid id);
+
+ void StopJob(string resourceGroupName, string automationAccountName, Guid id);
+
+ void SuspendJob(string resourceGroupName, string automationAccountName, Guid id);
+
+ IEnumerable GetJobStream(string resourceGroupName, string automationAccountName, Guid jobId,
+ DateTimeOffset? time, string streamType, ref string nextLink);
+
+ #endregion
+
+ #region Certificates
+
+ CertificateInfo CreateCertificate(string resourceGroupName, string automationAccountName, string name, string path, SecureString password, string description, bool exportable);
+
+ CertificateInfo UpdateCertificate(string resourceGroupName, string automationAccountName, string name, string path, SecureString password, string description, bool? exportable);
+
+ CertificateInfo GetCertificate(string resourceGroupName, string automationAccountName, string name);
+
+ IEnumerable ListCertificates(string resourceGroupName, string automationAccountName, ref string nextLink);
+
+ void DeleteCertificate(string resourceGroupName, string automationAccountName, string name);
+
+ #endregion
+
+ #region Connection
+
+ Connection CreateConnection(string resourceGroupName, string automationAccountName, string name, string connectionTypeName, IDictionary connectionFieldValues, string description);
+
+ Connection UpdateConnectionFieldValue(string resourceGroupName, string automationAccountName, string name, string connectionFieldName, object value);
+
+ Connection GetConnection(string resourceGroupName, string automationAccountName, string name);
+
+ IEnumerable ListConnectionsByType(string resourceGroupName, string automationAccountName, string name);
+
+ IEnumerable ListConnections(string resourceGroupName, string automationAccountName, ref string nextLink);
+
+ void DeleteConnection(string resourceGroupName, string automationAccountName, string name);
+
+ #endregion
+
+ #region JobSchedules
+
+ JobSchedule GetJobSchedule(string resourceGroupName, string automationAccountName, Guid jobScheduleId);
+
+ JobSchedule GetJobSchedule(string resourceGroupName, string automationAccountName, string runbookName, string scheduleName);
+
+ IEnumerable ListJobSchedules(string resourceGroupName, string automationAccountName, ref string nextLink);
+
+ IEnumerable ListJobSchedulesByRunbookName(string resourceGroupName, string automationAccountName, string runbookName);
+
+ IEnumerable ListJobSchedulesByScheduleName(string resourceGroupName, string automationAccountName, string scheduleName);
+
+ JobSchedule RegisterScheduledRunbook(string resourceGroupName, string automationAccountName, string runbookName, string scheduleName, IDictionary parameters);
+
+ void UnregisterScheduledRunbook(string resourceGroupName, string automationAccountName, Guid jobScheduleId);
+
+ void UnregisterScheduledRunbook(string resourceGroupName, string automationAccountName, string runbookName, string scheduleName);
+
+
#endregion
}
}
\ No newline at end of file
diff --git a/src/ResourceManager/Automation/Commands.Automation/Common/StreamType.cs b/src/ResourceManager/Automation/Commands.Automation/Common/StreamType.cs
new file mode 100644
index 000000000000..004861988c6c
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Common/StreamType.cs
@@ -0,0 +1,58 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+
+namespace Microsoft.Azure.Commands.Automation.Common
+{
+ ///
+ /// StreamType enum represents the 6 types of Powershell Streams supported.
+ ///
+ public enum StreamType
+ {
+ ///
+ /// Indicates Generic stream. Used for querying all the streams regardless of the type.
+ ///
+ Any,
+
+ ///
+ /// Indicates Progress Record streams
+ ///
+ Progress,
+
+ ///
+ /// Indicates Output Record streams
+ ///
+ Output,
+
+ ///
+ /// Indicates Warning Record streams
+ ///
+ Warning,
+
+ ///
+ /// Indicates Error Record streams
+ ///
+ Error,
+
+ ///
+ /// Indicates Debug Record streams
+ ///
+ Debug,
+
+ ///
+ /// Indicates Verbose Record streams
+ ///
+ Verbose
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Microsoft.Azure.Commands.ResourceManager.Automation.dll-help.xml b/src/ResourceManager/Automation/Commands.Automation/Microsoft.Azure.Commands.ResourceManager.Automation.dll-help.xml
index a914885a0449..980cf210fef1 100644
--- a/src/ResourceManager/Automation/Commands.Automation/Microsoft.Azure.Commands.ResourceManager.Automation.dll-help.xml
+++ b/src/ResourceManager/Automation/Commands.Automation/Microsoft.Azure.Commands.ResourceManager.Automation.dll-help.xml
@@ -1,3996 +1,104 @@
-
-
-
-
- Get-AzureAutomationAccount
-
- Gets Azure Automation accounts.
-
-
-
-
- Get
- AzureAutomationAccount
-
-
-
-
- The Get-AzureAutomationAccount cmdlet gets the Microsoft Azure Automation accounts for your subscription. An Automation account is a container for Automation resources that is isolated from the resources of other Automation accounts. Automation resources include runbooks, jobs, and assets.
-
-
-
- Get-AzureAutomationAccount
-
- Name
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
- Location
-
- Specifies an Azure location associated with Automation accounts.
-
- String
-
-
-
-
-
- Name
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Location
-
- Specifies an Azure location associated with Automation accounts.
-
- String
-
- String
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Get an Automation account --------------------------
-
-
-
- PS C:\>Get-AzureAutomationAccount -Name "Contoso17"
-
- This command gets the Automation account named Contoso17.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397902
-
-
-
-
-
-
- Get-AzureAutomationJob
-
- Gets one or more Azure Automation runbook jobs.
-
-
-
-
- Get
- AzureAutomationJob
-
-
-
-
- The Get-AzureAutomationJob cmdlet gets one or more runbook jobs in Microsoft Azure Automation.
-
-
-
- Get-AzureAutomationJob
-
- StartTime
-
- Specifies the start time of a job as a DateTime object. This cmdlet gets jobs that have a start time at or after the value that this parameter specifies. To obtain a DateTime object, use the Get-Date cmdlet.
-
- Nullable`1[DateTime]
-
-
- EndTime
-
- Specifies the end time for a job as a DateTime object. This cmdlet gets jobs that have an end time at or before the value that this parameter specifies. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.
-
- Nullable`1[DateTime]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationJob
-
- Id
-
- Specifies the ID of a job.
-
- Nullable`1[Guid]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationJob
-
- RunbookId
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- StartTime
-
- Specifies the start time of a job as a DateTime object. This cmdlet gets jobs that have a start time at or after the value that this parameter specifies. To obtain a DateTime object, use the Get-Date cmdlet.
-
- Nullable`1[DateTime]
-
-
- EndTime
-
- Specifies the end time for a job as a DateTime object. This cmdlet gets jobs that have an end time at or before the value that this parameter specifies. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.
-
- Nullable`1[DateTime]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationJob
-
- RunbookName
-
- Specifies the name of a runbook.
-
- String
-
-
- StartTime
-
- Specifies the start time of a job as a DateTime object. This cmdlet gets jobs that have a start time at or after the value that this parameter specifies. To obtain a DateTime object, use the Get-Date cmdlet.
-
- Nullable`1[DateTime]
-
-
- EndTime
-
- Specifies the end time for a job as a DateTime object. This cmdlet gets jobs that have an end time at or before the value that this parameter specifies. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.
-
- Nullable`1[DateTime]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- StartTime
-
- Specifies the start time of a job as a DateTime object. This cmdlet gets jobs that have a start time at or after the value that this parameter specifies. To obtain a DateTime object, use the Get-Date cmdlet.
-
- Nullable`1[DateTime]
-
- Nullable`1[DateTime]
-
-
- none
-
-
- EndTime
-
- Specifies the end time for a job as a DateTime object. This cmdlet gets jobs that have an end time at or before the value that this parameter specifies. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.
-
- Nullable`1[DateTime]
-
- Nullable`1[DateTime]
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a job.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
- RunbookId
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
- RunbookName
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Get a runbook job --------------------------
-
-
-
- PS C:\>Get-AzureAutomationJob -AutomationAccountName "Contoso17" -Id 2989b069-24fe-40b9-b3bd-cb7e5eac4b647
-
- This command gets the job that has the specified GUID.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397903
-
-
- Resume-AzureAutomationJob
-
-
-
- Stop-AzureAutomationJob
-
-
-
- Suspend-AzureAutomationJob
-
-
-
-
-
-
-
- Get-AzureAutomationJobOutput
-
- Gets the output of an Azure Automation job.
-
-
-
-
- Get
- AzureAutomationJobOutput
-
-
-
-
- The Get-AzureAutomationJobOutput cmdlet gets the output of a Microsoft Azure Automation job.
-
-
-
- Get-AzureAutomationJobOutput
-
- Id
-
- Specifies the ID of a job.
-
- Guid
-
-
- StartTime
-
- Specifies a start time as a DateTime object. The cmdlet retrieves output created after this time. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.
-
- DateTime
-
-
- Stream
-
- Specifies the type of output. Valid values are:
+
+
+
+ Windows PowerShell® is a task-based command-line shell and scripting language designed especially for system administration. This reference topic for the information technology (IT) professional provides assistance in utilizing the Windows PowerShell cmdlets to script and automate tasks.Azure Automation cmdletsThe following table contains links to the help topics for the Azure Automation cmdlets.CmdletDescriptionExport-AzureAutomationDscConfigurationExports a DSC configuration from Automation to a local file.Export-AzureAutomationDscNodeReportContentExports the raw content of a DSC report sent from a DSC node to Automation.Get-AzureAutomationAccountGets Automation accounts in a resource group.Get-AzureAutomationDscCompilationJobGets DSC compilation jobs in Automation.Get-AzureAutomationDscCompilationJobOutputGets the logging streams of an Automation DSC compilation job.Get-AzureAutomationDscConfigurationGets DSC configurations from Automation.Get-AzureAutomationDscNodeGets DSC nodes from Automation.Get-AzureAutomationDscNodeConfigurationGets metadata for DSC node configurations in Automation.Get-AzureAutomationDscNodeReportGets reports sent from a DSC node to Automation.Get-AzureAutomationDscOnboardingMetaconfigCreates meta-configuration .mof files.Get-AzureAutomationModuleGets metadata for modules from Automation.Get-AzureAutomationRegistrationInfoGets registration information for onboarding a DSC node or hybrid worker to Automation.Import-AzureAutomationDscConfigurationImports a DSC configuration into Automation.New-AzureAutomationAccountCreates an Automation account.New-AzureAutomationKeyRegenerates registration keys for an Automation account.New-AzureAutomationModuleImports a module into Automation.Register-AzureAutomationDscNodeRegisters an Azure virtual machine as a DSC node for an Automation account.Remove-AzureAutomationAccountRemoves an Automation account.Remove-AzureAutomationModuleRemoves a module from Automation.Set-AzureAutomationAccountModifies an Automation account.Set-AzureAutomationDscNodeModifies the node configuration that a DSC node is mapped to.Set-AzureAutomationModuleUpdates a module in Automation.Start-AzureAutomationDscCompilationJobCompiles a DSC configuration in Automation.Unregister-AzureAutomationDscNodeRemoves a DSC node from management by an Automation account.To list all the cmdlets that are available, type Get-Command –Module AzureResourceManager -Name *automation.For more information about, or for the syntax of, any of the cmdlets, use the Get-Help <cmdlet name> cmdlet, where <cmdlet name> is the name of the cmdlet that you want to research. For more detailed information, you can run any of the following cmdlets: ? Get-Help <cmdlet name> -Detailed ? Get-Help <cmdlet name> -Examples ? Get-Help <cmdlet name> -Full Export-AzureAutomationDscConfigurationExports a DSC configuration from Automation to a local file. ExportAzureAutomationDscConfigurationThe Export-AzureAutomationDscConfiguration cmdlet exports a PowerShell Desired State Configuration (DSC) configuration from Azure Automation to a local file. The exported file has a .ps1 file name extension.Export-AzureAutomationDscConfigurationResourceGroupNameSpecifies the name of a resource group for which this cmdlet exports a DSC configuration.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC that this cmdlet exports.StringForceIndicates that this cmdlet can replace an existing local file with a new file that has the same name.OutputFolderSpecifies the output folder where this cmdlet exports the DSC configuration.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileSlotSpecifies which version of the DSC configuration that this cmdlet exports. Valid values are:
- -- Any
- -- Debug
- -- Error
- -- Output
- -- Progress
- -- Verbose
- -- Warning
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Id
-
- Specifies the ID of a job.
-
- Guid
-
- Guid
-
-
- none
-
-
- StartTime
-
- Specifies a start time as a DateTime object. The cmdlet retrieves output created after this time. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.
-
- DateTime
-
- DateTime
-
-
- none
-
-
- Stream
-
- Specifies the type of output. Valid values are:
+-- Draft
+-- Published
- -- Any
- -- Debug
- -- Error
- -- Output
- -- Progress
- -- Verbose
- -- Warning
-
- String
-
- String
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Get the output of an Azure Automation job --------------------------
-
-
-
- PS C:\>Get-AzureAutomationJobOutput -AutomationAccountName "Contoso17" -Id 2989b069-24fe-40b9-b3bd-cb7e5eac4b64 -Stream "Any"
-
- This command gets all of the output of the job that has the specified ID.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397904
-
-
- Get-AzureAutomationJob
-
-
-
- Resume-AzureAutomationJob
-
-
-
- Stop-AzureAutomationJob
-
-
-
- Suspend-AzureAutomationJob
-
-
-
-
-
-
-
- Get-AzureAutomationRunbook
-
- Gets a runbook.
-
-
-
-
- Get
- AzureAutomationRunbook
-
-
-
-
- The Get-AzureAutomationRunbook cmdlet gets one or more Microsoft Azure Automation runbooks. By default, all runbooks are returned. To get a specific runbook, specify its name or ID. To get all runbooks linked to a specific schedule, specify the schedule name.
-
-
-
- Get-AzureAutomationRunbook
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationRunbook
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationRunbook
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationRunbook
-
- ScheduleName
-
- Specifies the name of a schedule.
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
- ScheduleName
-
- Specifies the name of a schedule.
-
- String
-
- String
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Get all runbooks --------------------------
-
-
-
- PS C:\>Get-AzureAutomationRunbook -AutomationAccountName "Contoso17"
-
- This command gets all runbooks in the Azure Automation account named Contoso17.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397905
-
-
- New-AzureAutomationRunbook
-
-
-
- Publish-AzureAutomationRunbook
-
-
-
- Remove-AzureAutomationRunbook
-
-
-
- Set-AzureAutomationRunbook
-
-
-
- Start-AzureAutomationRunbook
-
-
-
-
-
-
-
- Get-AzureAutomationRunbookDefinition
-
- Gets a runbook definition.
-
-
-
-
- Get
- AzureAutomationRunbookDefinition
-
-
-
-
- The Get-AzureAutomationRunbookDefinition cmdlet gets the draft definition, the published definition, or both definitions of an Azure Automation runbook. By default, both runbook definitions are returned.
-
-
-
- Get-AzureAutomationRunbookDefinition
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
-
- Slot
-
- Specifies a runbook definition type. Valid values are:
+The default value is Published. PublishedDraftNameSpecifies the name of the DSC configuration that this cmdlet exports.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC that this cmdlet exports.StringStringnoneForceIndicates that this cmdlet can replace an existing local file with a new file that has the same name.SwitchParameterSwitchParameternoneNameSpecifies the name of the DSC configuration that this cmdlet exports.StringStringnoneOutputFolderSpecifies the output folder where this cmdlet exports the DSC configuration.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group for which this cmdlet exports a DSC configuration.StringStringnoneSlotSpecifies which version of the DSC configuration that this cmdlet exports. Valid values are:
- -- Published
- -- Draft
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationRunbookDefinition
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- Slot
-
- Specifies a runbook definition type. Valid values are:
+-- Draft
+-- Published
- -- Published
- -- Draft
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationRunbookDefinition
-
- VersionId
-
- Specifies the ID of a runbook version.
-
- Nullable`1[Guid]
-
-
- Slot
-
- Specifies a runbook definition type. Valid values are:
+The default value is Published. StringStringnone 1: Get-AzureAutomationDscConfigurationImport-AzureAutomationDscConfigurationExport-AzureAutomationDscNodeReportContentExports the raw content of a DSC report sent from a DSC node to Automation.ExportAzureAutomationDscNodeReportContentThe Export-AzureAutomationDscNodeReportContent cmdlet exports the raw contents of a PowerShell Desired State Configuration (DSC) report. A DSC node sends a DSC report to Azure Automation.Export-AzureAutomationDscNodeReportContentResourceGroupNameSpecifies the name of a resource group. This cmdlet exports the contents of a report for the DSC node that belongs to the resource group that this cmdlet specifies. StringAutomationAccountNameSpecifies the name of an Automation account. This cmdlet exports report content for a DSC node that belongs to the Automation account that this parameter specifies. StringForceIndicates that this cmdlet can replace an existing local file with a new file that has the same name.OutputFolderSpecifies the output folder where this cmdlet exports report contents. StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileNodeIdSpecifies the unique ID of the DSC node for which this cmdlet exports report contents.GuidReportIdSpecifies the unique ID of the DSC node report that this cmdlet exports. GuidAutomationAccountNameSpecifies the name of an Automation account. This cmdlet exports report content for a DSC node that belongs to the Automation account that this parameter specifies. StringStringnoneForceIndicates that this cmdlet can replace an existing local file with a new file that has the same name.SwitchParameterSwitchParameternoneNodeIdSpecifies the unique ID of the DSC node for which this cmdlet exports report contents.GuidGuidnoneOutputFolderSpecifies the output folder where this cmdlet exports report contents. StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneReportIdSpecifies the unique ID of the DSC node report that this cmdlet exports. GuidGuidnoneResourceGroupNameSpecifies the name of a resource group. This cmdlet exports the contents of a report for the DSC node that belongs to the resource group that this cmdlet specifies. StringStringnone 1: Get-AzureAutomationDscNodeReportGet-AzureAutomationAccountGets Automation accounts in a resource group.GetAzureAutomationAccountThe Get-AzureAutomationAccount cmdlet gets Azure Automation accounts in a resource group. For more information about Automation accounts, type Get-Help New-AzureAutomationAccount.Get-AzureAutomationAccountResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets Automation accounts.StringNameSpecifies the name of the Automation account that this cmdlet gets.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileGet-AzureAutomationAccountResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets Automation accounts.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileNameSpecifies the name of the Automation account that this cmdlet gets.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets Automation accounts.StringStringnone 1: New-AzureAutomationAccountRemove-AzureAutomationAccountSet-AzureAutomationAccountGet-AzureAutomationDscCompilationJobOutputGets the logging streams of an Automation DSC compilation job.GetAzureAutomationDscCompilationJobOutputThe Get-AzureAutomationDscCompilationJobOutput cmdlet gets the stream records of a PowerShell Desired State Configuration (DSC) compilation job in Azure Automation.Get-AzureAutomationDscCompilationJobOutputResourceGroupNameSpecifies the name of the resource group that contains the DSC compilation job for which this cmdlet gets stream records.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC compilation job.StringIdSpecifies the unique ID of the DSC compilation job for which this cmdlet gets output. GuidProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileStartTimeSpecifies a start time. This cmdlet gets stream records that the DSC compilation job outputs after this time. DateTimeOffsetStreamSpecifies the type of stream for the output that this cmdlet gets. Valid values are:
- -- Published
- -- Draft
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
- Slot
-
- Specifies a runbook definition type. Valid values are:
+-- Any
+-- Warning
+-- Error
+-- VerboseAnyWarningErrorVerboseAutomationAccountNameSpecifies the name of the Automation account that contains the DSC compilation job.StringStringnoneIdSpecifies the unique ID of the DSC compilation job for which this cmdlet gets output. GuidGuidnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of the resource group that contains the DSC compilation job for which this cmdlet gets stream records.StringStringnoneStartTimeSpecifies a start time. This cmdlet gets stream records that the DSC compilation job outputs after this time. DateTimeOffsetDateTimeOffsetnoneStreamSpecifies the type of stream for the output that this cmdlet gets. Valid values are:
- -- Published
- -- Draft
-
- String
-
- String
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
- VersionId
-
- Specifies the ID of a runbook version.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Get a runbook definition --------------------------
-
-
-
- PS C:\>Get-AzureAutomationRunbookDefinition -AutomationAccountName "Contoso17" -Name "RunbookDef01" -Slot "Published"
-
- This command gets the published runbook definition of the runbook named RunbookDef01 in the Azure Automation account named Contoso17.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397906
-
-
- Set-AzureAutomationRunbookDefinition
-
-
-
-
-
-
-
- Get-AzureAutomationSchedule
-
- Gets an Azure Automation schedule.
-
-
-
-
- Get
- AzureAutomationSchedule
-
-
-
-
- The Get-AzureAutomationSchedule cmdlet gets a Microsoft Azure Automation schedule.
-
-
-
- Get-AzureAutomationSchedule
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationSchedule
-
- Id
-
- Specifies the ID of a schedule.
-
- Nullable`1[Guid]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Get-AzureAutomationSchedule
-
- Name
-
- Specifies the name of a schedule.
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a schedule.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
- Name
-
- Specifies the name of a schedule.
-
- String
-
- String
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Get a schedule --------------------------
-
-
-
- PS C:\>Get-AzureAutomationSchedule -AutomationAccountName "Contoso17" -Name "DailySchedule08"
-
- This command gets the schedule named DailySchedule08.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId= 397907
-
-
- New-AzureAutomationSchedule
-
-
-
- Remove-AzureAutomationSchedule
-
-
-
- Set-AzureAutomationSchedule
-
-
-
-
-
-
-
- New-AzureAutomationRunbook
-
- Creates a new runbook.
-
-
-
-
- New
- AzureAutomationRunbook
-
-
-
-
- The New-AzureAutomationRunbook cmdlet creates a new, empty Microsoft Azure Automation runbook. Specify a name to create a new runbook.You can also specify the path to a Windows PowerShell? script (.ps1 ) file to import a runbook. The script to import must contain a single Windows PowerShell? Workflow definition. The name of this Windows PowerShell Workflow becomes the name of the runbook.
-
-
-
- New-AzureAutomationRunbook
-
- Name
-
- Specifies the name for the runbook.
-
- String
-
-
- Description
-
- Specifies a description for the runbook.
-
- String
-
-
- Tags
-
- Specifies one or more runbook tags.
-
- String[]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- New-AzureAutomationRunbook
-
- Path
-
- Specifies the path to a runbook to import.
-
- String
-
-
- Description
-
- Specifies a description for the runbook.
-
- String
-
-
- Tags
-
- Specifies one or more runbook tags.
-
- String[]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Name
-
- Specifies the name for the runbook.
-
- String
-
- String
-
-
- none
-
-
- Description
-
- Specifies a description for the runbook.
-
- String
-
- String
-
-
- none
-
-
- Tags
-
- Specifies one or more runbook tags.
-
- String[]
-
- String[]
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Path
-
- Specifies the path to a runbook to import.
-
- String
-
- String
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Create a runbook --------------------------
-
-
-
- PS C:\>New-AzureAutomationRunbook -AutomationAccountName "Contoso17" -Name "Runbook02"
-
- This command creates a new runbook named Runbook02 in the Azure Automation account named Contoso17.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397908
-
-
- Get-AzureAutomationRunbook
-
-
-
- Publish-AzureAutomationRunbook
-
-
-
- Remove-AzureAutomationRunbook
-
-
-
- Set-AzureAutomationRunbook
-
-
-
- Start-AzureAutomationRunbook
-
-
-
-
-
-
-
- New-AzureAutomationSchedule
-
- Creates an Azure Automation schedule.
-
-
-
-
- New
- AzureAutomationSchedule
-
-
-
-
- The New-AzureAutomationSchedule cmdlet creates a schedule in Microsoft Azure Automation.
-
-
-
- New-AzureAutomationSchedule
-
- Name
-
- Specifies a name for the schedule.
-
- String
-
-
- StartTime
-
- Specifies the start time of a schedule as a DateTime object. To obtain a DateTime object, use the Get-Date cmdlet.
-
- DateTime
-
-
- Description
-
- Specifies a description.
-
- String
-
-
- ExpiryTime
-
- Specifies the expiry time of a schedule as a DateTime object. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.
-
- DateTime
-
-
- DayInterval
-
- Specifies an interval for the schedule in days. If you do not specify this parameter, and you do not specify the OneTime parameter, then the day interval of the schedule is 1.
-
- Int32
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- New-AzureAutomationSchedule
-
- Name
-
- Specifies a name for the schedule.
-
- String
-
-
- StartTime
-
- Specifies the start time of a schedule as a DateTime object. To obtain a DateTime object, use the Get-Date cmdlet.
-
- DateTime
-
-
- Description
-
- Specifies a description.
-
- String
-
-
- OneTime
-
- Specifies that the cmdlet creates a one-time schedule.
-
- SwitchParameter
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Name
-
- Specifies a name for the schedule.
-
- String
-
- String
-
-
- none
-
-
- StartTime
-
- Specifies the start time of a schedule as a DateTime object. To obtain a DateTime object, use the Get-Date cmdlet.
-
- DateTime
-
- DateTime
-
-
- none
-
-
- Description
-
- Specifies a description.
-
- String
-
- String
-
-
- none
-
-
- ExpiryTime
-
- Specifies the expiry time of a schedule as a DateTime object. To obtain a DateTime object, use the Get-Date cmdlet. For more information, type Get-Help Get-Date.
-
- DateTime
-
- DateTime
-
-
- none
-
-
- DayInterval
-
- Specifies an interval for the schedule in days. If you do not specify this parameter, and you do not specify the OneTime parameter, then the day interval of the schedule is 1.
-
- Int32
-
- Int32
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- OneTime
-
- Specifies that the cmdlet creates a one-time schedule.
-
- SwitchParameter
-
- SwitchParameter
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Create a schedule --------------------------
-
-
-
- PS C:\>$StartDate = Get-Date -Day 12 -Month 6 -Year 2016
- PS C:\> $EndDate = Get-Date -Day 12 -Month 6 -Year 2023
- PS C:\> New-AzureAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule01" -StartTime $StartDate -ExpiryTime $EndDate
-
- The first command creates a date object by using the Get-Date cmdlet, and then stores the object in the $StartDate variable. Specify a time that is at least five minutes in the future. For more information, type Get-Help Get-Date.
-
-
-
- The second command creates a date object by using the Get-Date cmdlet, and then stores the object in the $EndDate variable. The command specifies a future time.The final command creates a daily schedule named Schedule01 to begin at the time stored in $StartDate and expire at the time stored in $EndDate.
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397909
-
-
- Get-AzureAutomationSchedule
-
-
-
- Remove-AzureAutomationSchedule
-
-
-
- Set-AzureAutomationSchedule
-
-
-
-
-
-
-
- Publish-AzureAutomationRunbook
-
- Publishes a runbook.
-
-
-
-
- Publish
- AzureAutomationRunbook
-
-
-
-
- The Publish-AzureAutomationRunbook cmdlet publishes a runbook for use in the production environment of Microsoft Azure Automation.
-
-
-
- Publish-AzureAutomationRunbook
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Publish-AzureAutomationRunbook
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Publish a runbook --------------------------
-
-
-
- PS C:\>Publish-AzureAutomationRunbook -AutomationAccountName "Contoso17" -Name "Runbk01"
-
- This command publishes the runbook named Runbk01 in the Azure Automation account named Contoso17.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397910
-
-
- Get-AzureAutomationRunbook
-
-
-
- New-AzureAutomationRunbook
-
-
-
- Remove-AzureAutomationRunbook
-
-
-
- Set-AzureAutomationRunbook
-
-
-
- Start-AzureAutomationRunbook
-
-
-
-
-
-
-
- Register-AzureAutomationScheduledRunbook
-
- Associates a runbook with a schedule.
-
-
-
-
- Register
- AzureAutomationScheduledRunbook
-
-
-
-
- The Register-AzureAutomationScheduledRunbook cmdlet associates a runbook with a schedule. The runbook starts based on the schedule you specify using the ScheduleName parameter.
-
-
-
- Register-AzureAutomationScheduledRunbook
-
- ScheduleName
-
- Specifies the name of a schedule. To create a schedule in Azure Automation, use the New-AzureAutomationSchedule cmdlet.
-
- String
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
-
- Parameters
-
- Specifies a hash table of key/value pairs. The keys in the hash table are the runbook parameter names. The values in the hash table are the runbook parameter values. When the runbook starts in response to when the associated schedule fires, these parameters are passed to the runbook.
-
- IDictionary
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Register-AzureAutomationScheduledRunbook
-
- ScheduleName
-
- Specifies the name of a schedule. To create a schedule in Azure Automation, use the New-AzureAutomationSchedule cmdlet.
-
- String
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- Parameters
-
- Specifies a hash table of key/value pairs. The keys in the hash table are the runbook parameter names. The values in the hash table are the runbook parameter values. When the runbook starts in response to when the associated schedule fires, these parameters are passed to the runbook.
-
- IDictionary
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- ScheduleName
-
- Specifies the name of a schedule. To create a schedule in Azure Automation, use the New-AzureAutomationSchedule cmdlet.
-
- String
-
- String
-
-
- none
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
- Parameters
-
- Specifies a hash table of key/value pairs. The keys in the hash table are the runbook parameter names. The values in the hash table are the runbook parameter values. When the runbook starts in response to when the associated schedule fires, these parameters are passed to the runbook.
-
- IDictionary
-
- IDictionary
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Associate a runbook with a schedule --------------------------
-
-
-
- PS C:\>Register-AzureAutomationScheduledRunbook -AutomationAccountName "Contoso17" -Name "Runbk01" -ScheduleName "Sched01"
-
- This command associates the runbook named Runbk01 with the schedule named Sched01 in the Azure Automation account named Contoso17.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397911
-
-
- New-AzureAutomationSchedule
-
-
-
- Unregister-AzureAutomationScheduledRunbook
-
-
-
-
-
-
-
- Remove-AzureAutomationRunbook
-
- Removes a runbook.
-
-
-
-
- Remove
- AzureAutomationRunbook
-
-
-
-
- The Remove-AzureAutomationRunbook cmdlet removes a runbook from Microsoft Azure Automation.
-
-
-
- Remove-AzureAutomationRunbook
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
-
- Force
-
- Forces the command to run without asking for user confirmation.
-
- SwitchParameter
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
- WhatIf
-
- Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
-
- SwitchParameter
-
-
- Confirm
-
- Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
-
- SwitchParameter
-
-
-
- Remove-AzureAutomationRunbook
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- Force
-
- Forces the command to run without asking for user confirmation.
-
- SwitchParameter
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
- WhatIf
-
- Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
-
- SwitchParameter
-
-
- Confirm
-
- Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
-
- SwitchParameter
-
-
-
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
- Force
-
- Forces the command to run without asking for user confirmation.
-
- SwitchParameter
-
- SwitchParameter
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- WhatIf
-
- Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
-
- SwitchParameter
-
- SwitchParameter
-
-
- false
-
-
- Confirm
-
- Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
-
- SwitchParameter
-
- SwitchParameter
-
-
- false
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Remove a runbook --------------------------
-
-
-
- PS C:\>Remove-AzureAutomationRunbook -AutomationAccountName "Contoso17" -Name "MyRunbook"
-
- This command removes the runbook named MyRunbook in the Azure Automation account named Contoso17.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397912
-
-
- Get-AzureAutomationRunbook
-
-
-
- New-AzureAutomationRunbook
-
-
-
- Publish-AzureAutomationRunbook
-
-
-
- Set-AzureAutomationRunbook
-
-
-
- Start-AzureAutomationRunbook
-
-
-
-
-
-
-
- Remove-AzureAutomationSchedule
-
- Deletes an Azure Automation schedule.
-
-
-
-
- Remove
- AzureAutomationSchedule
-
-
-
-
- The Remove-AzureAutomationSchedule cmdlet deletes a schedule from Microsoft Azure Automation.
-
-
-
- Remove-AzureAutomationSchedule
-
- Name
-
- Specifies the name of a schedule.
-
- String
-
-
- Force
-
- Forces the command to run without asking for user confirmation.
-
- SwitchParameter
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
- WhatIf
-
- Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
-
- SwitchParameter
-
-
- Confirm
-
- Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
-
- SwitchParameter
-
-
-
- Remove-AzureAutomationSchedule
-
- Id
-
- Specifies the ID of a schedule.
-
- Nullable`1[Guid]
-
-
- Force
-
- Forces the command to run without asking for user confirmation.
-
- SwitchParameter
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
- WhatIf
-
- Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
-
- SwitchParameter
-
-
- Confirm
-
- Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
-
- SwitchParameter
-
-
-
-
-
- Name
-
- Specifies the name of a schedule.
-
- String
-
- String
-
-
- none
-
-
- Force
-
- Forces the command to run without asking for user confirmation.
-
- SwitchParameter
-
- SwitchParameter
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- WhatIf
-
- Shows what would happen if the cmdlet runs. The cmdlet is not run.Shows what would happen if the cmdlet runs. The cmdlet is not run.
-
- SwitchParameter
-
- SwitchParameter
-
-
- false
-
-
- Confirm
-
- Prompts you for confirmation before running the cmdlet.Prompts you for confirmation before running the cmdlet.
-
- SwitchParameter
-
- SwitchParameter
-
-
- false
-
-
- Id
-
- Specifies the ID of a schedule.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Remove a schedule --------------------------
-
-
-
- PS C:\>Remove-AzureAutomationSchedule -AutomationAccountName "Contoso17" -Name "MySchedule"
-
- This command removes the schedule named MySchedule.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397913
-
-
- Get-AzureAutomationSchedule
-
-
-
- New-AzureAutomationSchedule
-
-
-
- Set-AzureAutomationSchedule
-
-
-
-
-
-
-
- Resume-AzureAutomationJob
-
- Resumes a suspended Azure Automation job.
-
-
-
-
- Resume
- AzureAutomationJob
-
-
-
-
- The Resume-AzureAutomationJob cmdlet resumes a suspended Microsoft Azure Automation job. Specify the suspended job. To suspend a job, use the Suspend-AzureAutomationJob cmdlet.
-
-
-
- Resume-AzureAutomationJob
-
- Id
-
- Specifies the ID of a job.
-
- Guid
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Id
-
- Specifies the ID of a job.
-
- Guid
-
- Guid
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Resume a suspended job --------------------------
-
-
-
- PS C:\>Resume-AzureAutomationJob -AutomationAccountName "Contoso17" -Id 2989b069-24fe-40b9-b3bd-cb7e5eac4b64
-
- This command resumes the job that has the specified ID.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397914
-
-
- Get-AzureAutomationJob
-
-
-
- Stop-AzureAutomationJob
-
-
-
- Suspend-AzureAutomationJob
-
-
-
-
-
-
-
- Set-AzureAutomationRunbook
-
- Modifies the configuration of a runbook.
-
-
-
-
- Set
- AzureAutomationRunbook
-
-
-
-
- The Set-AzureAutomationRunbook cmdlet modifies the configuration of a Microsoft Azure Automation runbook.
-
-
-
- Set-AzureAutomationRunbook
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
-
- Description
-
- Specifies a description for the runbook.
-
- String
-
-
- Tags
-
- Specifies one or more runbook tags.
-
- String[]
-
-
- LogDebug
-
- Indicates whether debug output is logged for jobs of this runbook.
-
- Nullable`1[Boolean]
-
-
- LogProgress
-
- Indicates whether progress output is logged for jobs of this runbook.
-
- Nullable`1[Boolean]
-
-
- LogVerbose
-
- Indicates whether verbose output is logged for jobs of this runbook.
-
- Nullable`1[Boolean]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Set-AzureAutomationRunbook
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- Description
-
- Specifies a description for the runbook.
-
- String
-
-
- Tags
-
- Specifies one or more runbook tags.
-
- String[]
-
-
- LogDebug
-
- Indicates whether debug output is logged for jobs of this runbook.
-
- Nullable`1[Boolean]
-
-
- LogProgress
-
- Indicates whether progress output is logged for jobs of this runbook.
-
- Nullable`1[Boolean]
-
-
- LogVerbose
-
- Indicates whether verbose output is logged for jobs of this runbook.
-
- Nullable`1[Boolean]
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
- Description
-
- Specifies a description for the runbook.
-
- String
-
- String
-
-
- none
-
-
- Tags
-
- Specifies one or more runbook tags.
-
- String[]
-
- String[]
-
-
- none
-
-
- LogDebug
-
- Indicates whether debug output is logged for jobs of this runbook.
-
- Nullable`1[Boolean]
-
- Nullable`1[Boolean]
-
-
- none
-
-
- LogProgress
-
- Indicates whether progress output is logged for jobs of this runbook.
-
- Nullable`1[Boolean]
-
- Nullable`1[Boolean]
-
-
- none
-
-
- LogVerbose
-
- Indicates whether verbose output is logged for jobs of this runbook.
-
- Nullable`1[Boolean]
-
- Nullable`1[Boolean]
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Enable verbose logging for a runbook --------------------------
-
-
-
- PS C:\>Set-AzureAutomationRunbook -AutomationAccountName "Contoso17" -Name "MyRunbook" -LogVerbose $True
-
- This command enables verbose logging for the jobs of the specified runbook in the Azure Automation account named Contoso17.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397915
-
-
- Get-AzureAutomationRunbook
-
-
-
- New-AzureAutomationRunbook
-
-
-
- Publish-AzureAutomationRunbook
-
-
-
- Remove-AzureAutomationRunbook
-
-
-
- Start-AzureAutomationRunbook
-
-
-
-
-
-
-
- Set-AzureAutomationRunbookDefinition
-
- Updates the draft definition of a runbook.
-
-
-
-
- Set
- AzureAutomationRunbookDefinition
-
-
-
-
- The Set-AzureAutomationRunbookDefinition cmdlet updates the draft definition of a Microsoft Azure Automation runbook. Provide a Windows PowerShell? script (.ps1) file that contains a runbook which becomes the draft runbook. If a draft already exists, use the Overwrite parameter to force the cmdlet to overwrite the existing draft.
-
-
-
- Set-AzureAutomationRunbookDefinition
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
-
- Path
-
- Specifies the path to the new draft runbook.
-
- String
-
-
- Overwrite
-
- Indicates that the new draft runbook overwrites the existing draft, if one exists.
-
- SwitchParameter
-
-
- AutomationAccountName
-
- Specifies the name of an automation account.
-
- String
-
-
-
- Set-AzureAutomationRunbookDefinition
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- Path
-
- Specifies the path to the new draft runbook.
-
- String
-
-
- Overwrite
-
- Indicates that the new draft runbook overwrites the existing draft, if one exists.
-
- SwitchParameter
-
-
- AutomationAccountName
-
- Specifies the name of an automation account.
-
- String
-
-
-
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
- Path
-
- Specifies the path to the new draft runbook.
-
- String
-
- String
-
-
- none
-
-
- Overwrite
-
- Indicates that the new draft runbook overwrites the existing draft, if one exists.
-
- SwitchParameter
-
- SwitchParameter
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Overwrite an existing draft definition of a runbook --------------------------
-
-
-
- PS C:\>Set-AzureAutomationRunbookDefinition -AutomationAccountName "Contoso17" -Name "Runbk01" -Path App01.ps1 -Overwrite
-
- This command overwrites the existing draft definition of a runbook.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397916
-
-
- Get-AzureAutomationRunbookDefinition
-
-
-
-
-
-
-
- Set-AzureAutomationSchedule
-
- Modifies an Azure Automation schedule.
-
-
-
-
- Set
- AzureAutomationSchedule
-
-
-
-
- The Set-AzureAutomationSchedule cmdlet modifies a schedule in Microsoft Azure Automation.
-
-
-
- Set-AzureAutomationSchedule
-
- Name
-
- Specifies the name of a schedule.
-
- String
-
-
- IsEnabled
-
-
-
- Nullable`1[Boolean]
-
-
- Description
-
- Specifies a description.
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Set-AzureAutomationSchedule
-
- Id
-
- Specifies the ID of a schedule.
-
- Nullable`1[Guid]
-
-
- IsEnabled
-
-
-
- Nullable`1[Boolean]
-
-
- Description
-
- Specifies a description.
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Name
-
- Specifies the name of a schedule.
-
- String
-
- String
-
-
- none
-
-
- IsEnabled
-
-
-
- Nullable`1[Boolean]
-
- Nullable`1[Boolean]
-
-
-
-
-
- Description
-
- Specifies a description.
-
- String
-
- String
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a schedule.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Modify a schedule --------------------------
-
-
-
- PS C:\>Set-AzureAutomationSchedule -AutomationAccountName "Contoso17" -Name "Schedule01" -Description "Automation Schedule"
-
- This command modifies the description of the schedule named Schedule01.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397917
-
-
- Get-AzureAutomationSchedule
-
-
-
- New-AzureAutomationSchedule
-
-
-
- Remove-AzureAutomationSchedule
-
-
-
-
-
-
-
- Start-AzureAutomationRunbook
-
- Starts a runbook job.
-
-
-
-
- Start
- AzureAutomationRunbook
-
-
-
-
- The Start-AzureAutomationRunbook cmdlet starts a Microsoft Azure Automation runbook job. Specify the ID or name of a runbook.
-
-
-
- Start-AzureAutomationRunbook
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
-
- Parameters
-
- Specifies a hash table of key/value pairs. The keys in the hash table are the runbook parameter names. The values in the hash table are the runbook parameter values.
-
- IDictionary
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Start-AzureAutomationRunbook
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- Parameters
-
- Specifies a hash table of key/value pairs. The keys in the hash table are the runbook parameter names. The values in the hash table are the runbook parameter values.
-
- IDictionary
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
- Parameters
-
- Specifies a hash table of key/value pairs. The keys in the hash table are the runbook parameter names. The values in the hash table are the runbook parameter values.
-
- IDictionary
-
- IDictionary
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Start a runbook job --------------------------
-
-
-
- PS C:\>Start-AzureAutomationRunbook -AutomationAccountName "Contoso17" -Name "Runbk01"
-
- This command starts a runbook job for the runbook named Runbk01 in the Azure Automation account named Contoso17.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397918
-
-
- Get-AzureAutomationRunbook
-
-
-
- New-AzureAutomationRunbook
-
-
-
- Publish-AzureAutomationRunbook
-
-
-
- Remove-AzureAutomationRunbook
-
-
-
- Set-AzureAutomationRunbook
-
-
-
-
-
-
-
- Stop-AzureAutomationJob
-
- Stops an Azure Automation job.
-
-
-
-
- Stop
- AzureAutomationJob
-
-
-
-
- The Stop-AzureAutomationJob cmdlet stops a Microsoft Azure Automation job. Specify a running automation job.
-
-
-
- Stop-AzureAutomationJob
-
- Id
-
- Specifies the ID of a job.
-
- Guid
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Id
-
- Specifies the ID of a job.
-
- Guid
-
- Guid
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Stop a job --------------------------
-
-
-
- PS C:\>Stop-AzureAutomationJob -AutomationAccountName "Contoso17" -Id 2989b069-24fe-40b9-b3bd-cb7e5eac4b64
-
- This command stops the job that has the specified ID.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397919
-
-
- Get-AzureAutomationJob
-
-
-
- Resume-AzureAutomationJob
-
-
-
- Suspend-AzureAutomationJob
-
-
-
-
-
-
-
- Suspend-AzureAutomationJob
-
- Suspends an Azure Automation job.
-
-
-
-
- Suspend
- AzureAutomationJob
-
-
-
-
- The Suspend-AzureAutomationJob cmdlet suspends a Microsoft Azure Automation job. Specify a running Automation job. To resume a suspended job, use the Resume-AzureAutomationJob cmdlet.
-
-
-
- Suspend-AzureAutomationJob
-
- Id
-
- Specifies the ID of a job.
-
- Guid
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Id
-
- Specifies the ID of a job.
-
- Guid
-
- Guid
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Suspend a job --------------------------
-
-
-
- PS C:\>Suspend-AzureAutomationJob -AutomationAccountName "Contoso17" -Id 2989b069-24fe-40b9-b3bd-cb7e5eac4b64
-
- This command suspends the job that has the specified ID.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397920
-
-
- Get-AzureAutomationJob
-
-
-
- Resume-AzureAutomationJob
-
-
-
- Stop-AzureAutomationJob
-
-
-
-
-
-
-
- Unregister-AzureAutomationScheduledRunbook
-
- Removes an association between a runbook and a schedule.
-
-
-
-
- Unregister
- AzureAutomationScheduledRunbook
-
-
-
-
- The Unregister-AzureAutomationScheduledRunbook cmdlet removes the association between a Microsoft Azure Automation runbook and a schedule, which stops the runbook from starting when the schedule fires.
-
-
-
- Unregister-AzureAutomationScheduledRunbook
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
-
- ScheduleName
-
- Specifies the name of a schedule.
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
- Unregister-AzureAutomationScheduledRunbook
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
-
- ScheduleName
-
- Specifies the name of a schedule.
-
- String
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
-
-
-
-
- Name
-
- Specifies the name of a runbook.
-
- String
-
- String
-
-
- none
-
-
- ScheduleName
-
- Specifies the name of a schedule.
-
- String
-
- String
-
-
- none
-
-
- AutomationAccountName
-
- Specifies the name of an Azure Automation account.
-
- String
-
- String
-
-
- none
-
-
- Id
-
- Specifies the ID of a runbook.
-
- Nullable`1[Guid]
-
- Nullable`1[Guid]
-
-
- none
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -------------------------- Example 1: Remove the association between a runbook and a schedule --------------------------
-
-
-
- PS C:\>Unregister-AzureAutomationScheduledRunbook -AutomationAccountName "Contoso17" -Name "Runbk01" -ScheduleName "Runbk01Sched"
-
- This command removes the association between the runbook named Runbk01 and the schedule named Runbk01Sched.
-
-
-
-
-
-
-
-
-
-
- Online Version:
- http://go.microsoft.com/fwlink/?LinkId=397921
-
-
- Register-AzureAutomationScheduledRunbook
-
-
-
-
-
\ No newline at end of file
+-- Any
+-- Warning
+-- Error
+-- VerboseCompilationJobStreamTypeCompilationJobStreamTypenone 1: Get-AzureAutomationDscCompilationJobStart-AzureAutomationDscCompilationJobGet-AzureAutomationDscCompilationJobGets DSC compilation jobs in Automation.GetAzureAutomationDscCompilationJobThe Get-AzureAutomationDscCompilationJob cmdlet gets PowerShell Desired State Configuration (DSC) compilation jobs in Azure Automation.Get-AzureAutomationDscCompilationJobResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC compilation jobs. StringAutomationAccountNameSpecifies the name of the Automation account that contains DSC compilation jobs that this cmdlet gets.StringEndTimeSpecifies an end time. This cmdlet gets compilations jobs that started up to the time that this parameter specifies. DateTimeOffsetProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileStartTimeSpecifies a start time. This cmdlet gets jobs that start at or after the time that this parameter specifies.DateTimeOffsetStatusSpecifies the status of jobs that this cmdlet gets. Valid values are:
+
+-- Completed
+-- Failed
+-- Queued
+-- Starting
+-- Resuming
+-- Running
+-- Stopped
+-- Stopping
+-- Suspended
+-- Suspending
+-- ActivatingCompletedFailedQueuedStartingResumingRunningStoppedStoppingSuspendedSuspendingActivatingGet-AzureAutomationDscCompilationJobResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC compilation jobs. StringAutomationAccountNameSpecifies the name of the Automation account that contains DSC compilation jobs that this cmdlet gets.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileIdSpecifies the unique ID of the DSC compilation job that this cmdlet gets. GuidGet-AzureAutomationDscCompilationJobResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC compilation jobs. StringAutomationAccountNameSpecifies the name of the Automation account that contains DSC compilation jobs that this cmdlet gets.StringEndTimeSpecifies an end time. This cmdlet gets compilations jobs that started up to the time that this parameter specifies. DateTimeOffsetProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileStartTimeSpecifies a start time. This cmdlet gets jobs that start at or after the time that this parameter specifies.DateTimeOffsetStatusSpecifies the status of jobs that this cmdlet gets. Valid values are:
+
+-- Completed
+-- Failed
+-- Queued
+-- Starting
+-- Resuming
+-- Running
+-- Stopped
+-- Stopping
+-- Suspended
+-- Suspending
+-- ActivatingCompletedFailedQueuedStartingResumingRunningStoppedStoppingSuspendedSuspendingActivatingConfigurationNameSpecifies the name of the DSC configuration for which this cmdlet gets compilation jobs.StringAutomationAccountNameSpecifies the name of the Automation account that contains DSC compilation jobs that this cmdlet gets.StringStringnoneConfigurationNameSpecifies the name of the DSC configuration for which this cmdlet gets compilation jobs.StringStringnoneEndTimeSpecifies an end time. This cmdlet gets compilations jobs that started up to the time that this parameter specifies. DateTimeOffsetDateTimeOffsetnoneIdSpecifies the unique ID of the DSC compilation job that this cmdlet gets. GuidGuidnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC compilation jobs. StringStringnoneStartTimeSpecifies a start time. This cmdlet gets jobs that start at or after the time that this parameter specifies.DateTimeOffsetDateTimeOffsetnoneStatusSpecifies the status of jobs that this cmdlet gets. Valid values are:
+
+-- Completed
+-- Failed
+-- Queued
+-- Starting
+-- Resuming
+-- Running
+-- Stopped
+-- Stopping
+-- Suspended
+-- Suspending
+-- ActivatingStringStringnone 1: Start-AzureAutomationDscCompilationJobGet-AzureAutomationDscCompilationJobOutputGet-AzureAutomationDscConfigurationGets DSC configurations from Automation.GetAzureAutomationDscConfigurationThe Get-AzureAutomationDscConfiguration cmdlet gets PowerShell Desired State Configuration (DSC) configurations from Azure Automation.Get-AzureAutomationDscConfigurationResourceGroupNameSpecifies the name of a resource group for which this cmdlet gets DSC configurations.StringAutomationAccountNameSpecifies the name of the Automation account that contains DSC configurations that this cmdlet gets.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileGet-AzureAutomationDscConfigurationResourceGroupNameSpecifies the name of a resource group for which this cmdlet gets DSC configurations.StringAutomationAccountNameSpecifies the name of the Automation account that contains DSC configurations that this cmdlet gets.StringNameSpecifies the name of the DSC configuration that this cmdlet gets.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAutomationAccountNameSpecifies the name of the Automation account that contains DSC configurations that this cmdlet gets.StringStringnoneNameSpecifies the name of the DSC configuration that this cmdlet gets.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group for which this cmdlet gets DSC configurations.StringStringnone 1: Export-AzureAutomationDscConfigurationImport-AzureAutomationDscConfigurationGet-AzureAutomationDscNodeConfigurationGets metadata for DSC node configurations in Automation. GetAzureAutomationDscNodeConfigurationThe Get-AzureAutomationDscNodeConfiguration cmdlet gets metadata for PowerShell Desired State Configuration (DSC) node configurations in Azure Automation. Automation stores DSC node configuration as a Managed Object Format (MOF) configuration document.Get-AzureAutomationDscNodeConfigurationResourceGroupNameSpecifies the name of a resource group. This cmdlet gets metadata for DSC node configurations in the resource group that this parameter specifies.StringAutomationAccountNameSpecifies the name of an Automation account that contains the DSC node configurations for which this cmdlet gets metadata.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileRollupStatusSpecifies the rollup status of DSC node configurations that this cmdlet gets. Valid values are: Bad and Good.GoodBadGet-AzureAutomationDscNodeConfigurationResourceGroupNameSpecifies the name of a resource group. This cmdlet gets metadata for DSC node configurations in the resource group that this parameter specifies.StringAutomationAccountNameSpecifies the name of an Automation account that contains the DSC node configurations for which this cmdlet gets metadata.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileNameSpecifies the name of the DSC node configuration for which this cmdlet gets metadata.StringGet-AzureAutomationDscNodeConfigurationResourceGroupNameSpecifies the name of a resource group. This cmdlet gets metadata for DSC node configurations in the resource group that this parameter specifies.StringAutomationAccountNameSpecifies the name of an Automation account that contains the DSC node configurations for which this cmdlet gets metadata.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileRollupStatusSpecifies the rollup status of DSC node configurations that this cmdlet gets. Valid values are: Bad and Good.GoodBadConfigurationNameSpecifies the name of DSC configuration for which this cmdlet gets node configuration metadata.StringAutomationAccountNameSpecifies the name of an Automation account that contains the DSC node configurations for which this cmdlet gets metadata.StringStringnoneConfigurationNameSpecifies the name of DSC configuration for which this cmdlet gets node configuration metadata.StringStringnoneNameSpecifies the name of the DSC node configuration for which this cmdlet gets metadata.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group. This cmdlet gets metadata for DSC node configurations in the resource group that this parameter specifies.StringStringnoneRollupStatusSpecifies the rollup status of DSC node configurations that this cmdlet gets. Valid values are: Bad and Good.StringStringnone 1: Get-AzureAutomationDscNodeReportGets reports sent from a DSC node to Automation.GetAzureAutomationDscNodeReportThe Get-AzureAutomationDscNodeReport cmdlet gets reports sent from a PowerShell Desired State Configuration (DSC) node to Azure Automation.Get-AzureAutomationDscNodeReportResourceGroupNameSpecifies the name of a resource group that contains the DSC node for which this cmdlet gets reports. StringAutomationAccountNameSpecifies the name of an Automation account. This cmdlet exports reports for a DSC node that belongs to the account that this parameter specifies. StringEndTimeSpecifies an end time. This cmdlet gets reports that Automation received before this time.DateTimeOffsetProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileStartTimeSpecifies a start time. This cmdlet gets reports that Automation received after this time.DateTimeOffsetNodeIdSpecifies the unique ID of the DSC node for which this cmdlet gets reports.GuidGet-AzureAutomationDscNodeReportResourceGroupNameSpecifies the name of a resource group that contains the DSC node for which this cmdlet gets reports. StringAutomationAccountNameSpecifies the name of an Automation account. This cmdlet exports reports for a DSC node that belongs to the account that this parameter specifies. StringLatestIndicates that this cmdlet gets the latest DSC report for the specified node only.ProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileNodeIdSpecifies the unique ID of the DSC node for which this cmdlet gets reports.GuidGet-AzureAutomationDscNodeReportResourceGroupNameSpecifies the name of a resource group that contains the DSC node for which this cmdlet gets reports. StringAutomationAccountNameSpecifies the name of an Automation account. This cmdlet exports reports for a DSC node that belongs to the account that this parameter specifies. StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileIdSpecifies the unique ID of the DSC node report for this cmdlet to get. GuidNodeIdSpecifies the unique ID of the DSC node for which this cmdlet gets reports.GuidAutomationAccountNameSpecifies the name of an Automation account. This cmdlet exports reports for a DSC node that belongs to the account that this parameter specifies. StringStringnoneEndTimeSpecifies an end time. This cmdlet gets reports that Automation received before this time.DateTimeOffsetDateTimeOffsetnoneIdSpecifies the unique ID of the DSC node report for this cmdlet to get. GuidGuidnoneLatestIndicates that this cmdlet gets the latest DSC report for the specified node only.SwitchParameterSwitchParameternoneNodeIdSpecifies the unique ID of the DSC node for which this cmdlet gets reports.GuidGuidnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group that contains the DSC node for which this cmdlet gets reports. StringStringnoneStartTimeSpecifies a start time. This cmdlet gets reports that Automation received after this time.DateTimeOffsetDateTimeOffsetnone 1: Export-AzureAutomationDscNodeReportContentGet-AzureAutomationDscNodeGets DSC nodes from Automation.GetAzureAutomationDscNodeThe Get-AzureAutomationDscNode cmdlet gets PowerShell Desired State Configuration (DSC) nodes from Azure Automation.Get-AzureAutomationDscNodeResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC nodes.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC nodes that this cmdlet gets.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileStatusSpecifies the status of the DSC nodes that this cmdlet gets. Valid values are:
+
+-- Compliant
+-- NotCompliant
+-- Failed
+-- Pending
+-- Received
+-- UnresponsiveCompliantNotCompliantFailedPendingReceivedUnresponsiveGet-AzureAutomationDscNodeResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC nodes.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC nodes that this cmdlet gets.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileIdSpecifies the unique ID of the DSC node that this cmdlet gets.GuidGet-AzureAutomationDscNodeResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC nodes.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC nodes that this cmdlet gets.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileStatusSpecifies the status of the DSC nodes that this cmdlet gets. Valid values are:
+
+-- Compliant
+-- NotCompliant
+-- Failed
+-- Pending
+-- Received
+-- UnresponsiveCompliantNotCompliantFailedPendingReceivedUnresponsiveNameSpecifies the name of a DSC node that this cmdlet gets.StringGet-AzureAutomationDscNodeResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC nodes.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC nodes that this cmdlet gets.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileStatusSpecifies the status of the DSC nodes that this cmdlet gets. Valid values are:
+
+-- Compliant
+-- NotCompliant
+-- Failed
+-- Pending
+-- Received
+-- UnresponsiveCompliantNotCompliantFailedPendingReceivedUnresponsiveNodeConfigurationNameSpecifies the name of a node configuration that this cmdlet gets. StringGet-AzureAutomationDscNodeResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC nodes.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC nodes that this cmdlet gets.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileConfigurationNameSpecifies the name of a DSC configuration. This cmdlet gets DSC nodes that match the node configurations generated from the configuration that this parameter specifies. StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC nodes that this cmdlet gets.StringStringnoneConfigurationNameSpecifies the name of a DSC configuration. This cmdlet gets DSC nodes that match the node configurations generated from the configuration that this parameter specifies. StringStringnoneIdSpecifies the unique ID of the DSC node that this cmdlet gets.GuidGuidnoneNameSpecifies the name of a DSC node that this cmdlet gets.StringStringnoneNodeConfigurationNameSpecifies the name of a node configuration that this cmdlet gets. StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group in which this cmdlet gets DSC nodes.StringStringnoneStatusSpecifies the status of the DSC nodes that this cmdlet gets. Valid values are:
+
+-- Compliant
+-- NotCompliant
+-- Failed
+-- Pending
+-- Received
+-- UnresponsiveDscNodeStatusDscNodeStatusnone 1: Register-AzureAutomationDscNodeSet-AzureAutomationDscNodeUnregister-AzureAutomationDscNodeGet-AzureAutomationDscOnboardingMetaconfigCreates meta-configuration .mof files.GetAzureAutomationDscOnboardingMetaconfigThe Get-AzureAutomationDscOnboardingMetaconfig cmdlet creates PowerShell Desired State Configuration (DSC) meta-configuration Managed Object Format (MOF) files. This cmdlet creates a .mof file for each computer name that you specify. The cmdlet creates a folder for the .mof files. You can run the Set-DscLocalConfigurationManager cmdlet against this folder to onboard these computers into an Azure Automation account as DSC nodes.Get-AzureAutomationDscOnboardingMetaconfigResourceGroupNameSpecifies the name of a resource group. This cmdlet creates .mof files to onboard computers in the resource group that this parameter specifies. StringAutomationAccountNameSpecifies the name of an Automation account. You can onboard the computers that the ComputerName parameter specifies to the account that this parameter specifies. StringComputerNameSpecifies an array of names of computers for which this cmdlet generates .mof files. If you do not specify this parameter, the cmdlet generates an .mof file for the current computer (localhost). String[]ForceForces the command to run without prompting you for confirmation, and to replace existing .mof files that have the same name.OutputFolderSpecifies the name of a folder where this cmdlet stores .mof files. StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAutomationAccountNameSpecifies the name of an Automation account. You can onboard the computers that the ComputerName parameter specifies to the account that this parameter specifies. StringStringnoneComputerNameSpecifies an array of names of computers for which this cmdlet generates .mof files. If you do not specify this parameter, the cmdlet generates an .mof file for the current computer (localhost). String[]String[]noneForceForces the command to run without prompting you for confirmation, and to replace existing .mof files that have the same name.SwitchParameterSwitchParameternoneOutputFolderSpecifies the name of a folder where this cmdlet stores .mof files. StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group. This cmdlet creates .mof files to onboard computers in the resource group that this parameter specifies. StringStringnone 1: Get-AzureAutomationModuleGets metadata for modules from Automation.GetAzureAutomationModuleThe Get-AzureAutomationModule cmdlet gets metadata for modules from Azure Automation.Get-AzureAutomationModuleResourceGroupNameSpecifies the name of a resource group for which this cmdlet gets module metadata.StringAutomationAccountNameSpecifies the name of the Automation account for which this cmdlet gets module metadata. StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileGet-AzureAutomationModuleResourceGroupNameSpecifies the name of a resource group for which this cmdlet gets module metadata.StringAutomationAccountNameSpecifies the name of the Automation account for which this cmdlet gets module metadata. StringNameSpecifies the name of the module for which this cmdlet gets metadata. StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAutomationAccountNameSpecifies the name of the Automation account for which this cmdlet gets module metadata. StringStringnoneNameSpecifies the name of the module for which this cmdlet gets metadata. StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group for which this cmdlet gets module metadata.StringStringnone 1: New-AzureAutomationModuleRemove-AzureAutomationModuleSet-AzureAutomationModuleGet-AzureAutomationRegistrationInfoGets registration information for onboarding a DSC node or hybrid worker to Automation. GetAzureAutomationRegistrationInfoThe Get-AzureAutomationRegistrationInfo cmdlet gets the endpoint and keys required to onboard a PowerShell Desired State Configuration (DSC) node or hybrid worker into an Azure Automation account.Get-AzureAutomationRegistrationInfoResourceGroupNameSpecifies the name of a resource group. This cmdlet gets registration information for the resource group that this parameter specifies.StringAutomationAccountNameSpecifies the name of automation account for which this cmdlet gets registration information. StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAutomationAccountNameSpecifies the name of automation account for which this cmdlet gets registration information. StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group. This cmdlet gets registration information for the resource group that this parameter specifies.StringStringnone 1: Get-AzureAutomationAccountGet-AzureAutomationDscNodeNew-AzureAutomationKeyImport-AzureAutomationDscConfigurationImports a DSC configuration into Automation.ImportAzureAutomationDscConfigurationThe Import-AzureAutomationDscConfiguration cmdlet imports a PowerShell Desired State Configuration (DSC) configuration into Azure Automation. Specify the path of a PowerShell script that contains a single DSC configuration.Import-AzureAutomationDscConfigurationResourceGroupNameSpecifies the name of a resource group for which this cmdlet imports a DSC configuration.StringAutomationAccountNameSpecifies the name of the Automation account into which this cmdlet imports a DSC configuration.StringDescriptionSpecifies a description of the configuration that this cmdlet imports. StringForceIndicates that this cmdlet can replace an existing DSC configuration in Automation.LogVerboseSpecifies whether this cmdlet turns verbose logging on or off for compilation jobs of this DSC configuration. Specify a value of $True to turn verbose logging on or $False to turn it off.BooleanProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfilePublishedIndicates that this cmdlet imports the DSC configuration in the published state.TagsSpecifies a dictionary of tags.IDictionarySourcePathSpecifies the path of the PowerShell script that contains the DSC configuration that this cmdlet imports. StringAutomationAccountNameSpecifies the name of the Automation account into which this cmdlet imports a DSC configuration.StringStringnoneDescriptionSpecifies a description of the configuration that this cmdlet imports. StringStringnoneForceIndicates that this cmdlet can replace an existing DSC configuration in Automation.SwitchParameterSwitchParameternoneLogVerboseSpecifies whether this cmdlet turns verbose logging on or off for compilation jobs of this DSC configuration. Specify a value of $True to turn verbose logging on or $False to turn it off.BooleanBooleannoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenonePublishedIndicates that this cmdlet imports the DSC configuration in the published state.SwitchParameterSwitchParameternoneResourceGroupNameSpecifies the name of a resource group for which this cmdlet imports a DSC configuration.StringStringnoneSourcePathSpecifies the path of the PowerShell script that contains the DSC configuration that this cmdlet imports. StringStringnoneTagsSpecifies a dictionary of tags.IDictionaryIDictionarynone 1: Export-AzureAutomationDscConfigurationGet-AzureAutomationDscConfigurationNew-AzureAutomationAccountCreates an Automation account.NewAzureAutomationAccountThe New-AzureAutomationAccount cmdlet creates an Azure Automation account in a resource group.An Automation account is a container for Automation resources that is isolated from the resources of other Automation accounts. Automation resources include runbooks, DSC configurations, jobs, and assets.New-AzureAutomationAccountResourceGroupNameSpecifies the name of a resource group to which this cmdlet adds an Automation account.StringNameSpecifies a name for the Automation account.StringLocationSpecifies the location in which this cmdlet creates the Automation account. To obtain valid locations, use the Get-AzureLocation cmdlet. StringPlanSpecifies the plan for the Automation account. Valid values are: Basic and Free.FreeBasicProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileTagsSpecifies tags for the Automation account.IDictionaryLocationSpecifies the location in which this cmdlet creates the Automation account. To obtain valid locations, use the Get-AzureLocation cmdlet. StringStringnoneNameSpecifies a name for the Automation account.StringStringnonePlanSpecifies the plan for the Automation account. Valid values are: Basic and Free.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group to which this cmdlet adds an Automation account.StringStringnoneTagsSpecifies tags for the Automation account.IDictionaryIDictionarynone 1: Get-AzureAutomationAccountRemove-AzureAutomationAccountSet-AzureAutomationAccountNew-AzureAutomationKeyRegenerates registration keys for an Automation account.NewAzureAutomationKeyThe New-AzureAutomationKey cmdlet regenerates registration keys for an Azure Automation account.New-AzureAutomationKeyResourceGroupNameSpecifies the name of a resource group. This cmdlet regenerates keys for an Automation account in the resource group that this parameter specifies. StringAutomationAccountNameSpecifies the name of an Automation account for which this cmdlet regenerates keys.StringKeyTypeSpecifies the type of the agent registration key. Valid values are: Primary and Secondary.PrimarySecondaryProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAutomationAccountNameSpecifies the name of an Automation account for which this cmdlet regenerates keys.StringStringnoneKeyTypeSpecifies the type of the agent registration key. Valid values are: Primary and Secondary.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group. This cmdlet regenerates keys for an Automation account in the resource group that this parameter specifies. StringStringnone 1: Get-AzureAutomationAccountNew-AzureAutomationAccountNew-AzureAutomationModuleImports a module into Automation.NewAzureAutomationModuleThe New-AzureAutomationModule cmdlet imports a module into Azure Automation. This command accepts a compressed file that has a .zip file name extension. The file contains a folder that includes a file that is one of the following types:
+
+-- Azure PowerShell module, which has a .psm1 file name extension
+-- Azure PowerShell module manifest, which has a .psd1 file name extension
+-- Dynamic link library, which has a .dll file name extensionThe name of the .zip file, the name of the folder, and the name of the file in the folder must be the same.Specify the .zip file as a URL that this computer can access.New-AzureAutomationModuleResourceGroupNameSpecifies the name of a resource group for which this cmdlet imports a module.StringAutomationAccountNameSpecifies the name of the Automation account for which this cmdlet imports a module. StringNameSpecifies the name of the module that this cmdlet imports.StringContentLinkSpecifies the URL of the .zip file that contains a module that this cmdlet imports.UriProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAutomationAccountNameSpecifies the name of the Automation account for which this cmdlet imports a module. StringStringnoneContentLinkSpecifies the URL of the .zip file that contains a module that this cmdlet imports.UriUrinoneNameSpecifies the name of the module that this cmdlet imports.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group for which this cmdlet imports a module.StringStringnone 1: Get-AzureAutomationModuleRemove-AzureAutomationModuleSet-AzureAutomationModuleRegister-AzureAutomationDscNodeRegisters an Azure virtual machine as a DSC node for an Automation account.RegisterAzureAutomationDscNodeThe Register-AzureAutomationDscNode cmdlet registers an Azure virtual machine as an Azure PowerShell Desired State Configuration (DSC) node in an Azure Automation account.Register-AzureAutomationDscNodeResourceGroupNameSpecifies the name of a resource group. The Automation account with which this cmdlet registers a virtual machine belongs to the resource group that this parameter specifies.StringAutomationAccountNameSpecifies the name of an Automation account in which this cmdlet registers a virtual machine.StringActionAfterRebootSpecifies the action that the virtual machine takes after it restarts. Valid values are: ContinueConfiguration and StopConfiguration. ContinueConfigurationStopConfigurationAllowModuleOverwriteSpecifies whether new configurations that this DSC node downloads from the Azure Automation DSC pull server replace the existing modules already on the target node.BooleanAzureVMLocationSpecifies the location in which this cmdlet registers a virtual machine. To obtain valid locations, use the Get-AzureLocation cmdlet. StringAzureVMResourceGroupSpecifies the name of the resource group of the Azure virtual machine that this cmdlet registers.StringConfigurationModeSpecifies the DSC configuration mode. Valid values are:
+
+-- ApplyAndMonitor
+-- ApplyAndAutocorrect
+-- ApplyOnlyApplyAndMonitorApplyAndAutocorrectApplyOnlyConfigurationModeFrequencyMinsSpecifies the frequency, in minutes, at which the background application of DSC attempts to implement the current configuration on the target node.Int32NodeConfigurationNameSpecifies the name of the node configuration that this cmdlet configures the virtual machine to pull from Azure Automation DSC.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileRebootNodeIfNeededSpecifies whether to restart the virtual machine, if needed. BooleanRefreshFrequencyMinsSpecifies the frequency, in minutes, at which the local Configuration Manager contacts the Azure Automation DSC pull server to download the latest node configuration.Int32AzureVMNameSpecifies the name of the Azure virtual machine that this cmdlet registers for management. StringActionAfterRebootSpecifies the action that the virtual machine takes after it restarts. Valid values are: ContinueConfiguration and StopConfiguration. StringStringnoneAllowModuleOverwriteSpecifies whether new configurations that this DSC node downloads from the Azure Automation DSC pull server replace the existing modules already on the target node.BooleanBooleannoneAutomationAccountNameSpecifies the name of an Automation account in which this cmdlet registers a virtual machine.StringStringnoneAzureVMLocationSpecifies the location in which this cmdlet registers a virtual machine. To obtain valid locations, use the Get-AzureLocation cmdlet. StringStringnoneAzureVMNameSpecifies the name of the Azure virtual machine that this cmdlet registers for management. StringStringnoneAzureVMResourceGroupSpecifies the name of the resource group of the Azure virtual machine that this cmdlet registers.StringStringnoneConfigurationModeSpecifies the DSC configuration mode. Valid values are:
+
+-- ApplyAndMonitor
+-- ApplyAndAutocorrect
+-- ApplyOnlyStringStringnoneConfigurationModeFrequencyMinsSpecifies the frequency, in minutes, at which the background application of DSC attempts to implement the current configuration on the target node.Int32Int32noneNodeConfigurationNameSpecifies the name of the node configuration that this cmdlet configures the virtual machine to pull from Azure Automation DSC.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneRebootNodeIfNeededSpecifies whether to restart the virtual machine, if needed. BooleanBooleannoneRefreshFrequencyMinsSpecifies the frequency, in minutes, at which the local Configuration Manager contacts the Azure Automation DSC pull server to download the latest node configuration.Int32Int32noneResourceGroupNameSpecifies the name of a resource group. The Automation account with which this cmdlet registers a virtual machine belongs to the resource group that this parameter specifies.StringStringnone 1: Get-AzureAutomationDscNodeSet-AzureAutomationDscNodeUnregister-AzureAutomationDscNodeRemove-AzureAutomationAccountRemoves an Automation account.RemoveAzureAutomationAccountThe Remove-AzureAutomationAccount cmdlet removes an Azure Automation account from a resource group.For more information about Automation accounts, type Get-Help New-AzureAutomationAccount.Remove-AzureAutomationAccountResourceGroupNameSpecifies the name of the resource group from which this cmdlet removes an Automation account.StringNameSpecifies the name of the Automation account that this cmdlet removes.StringForceForces the command to run without asking for user confirmation.ProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileForceForces the command to run without asking for user confirmation.SwitchParameterSwitchParameternoneNameSpecifies the name of the Automation account that this cmdlet removes.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of the resource group from which this cmdlet removes an Automation account.StringStringnone 1: Get-AzureAutomationAccountNew-AzureAutomationAccountSet-AzureAutomationAccountRemove-AzureAutomationModuleRemoves a module from Automation.RemoveAzureAutomationModuleThe Remove-AzureAutomationModule cmdlet removes a module from an Automation account in Azure Automation.Remove-AzureAutomationModuleResourceGroupNameSpecifies the name of a resource group in which this cmdlet removes a module. StringAutomationAccountNameSpecifies the name of the Automation account from which this cmdlet removes a module.StringNameSpecifies the name of the module that this cmdlet removes.StringForceForces the command to run without asking for user confirmation.ProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAutomationAccountNameSpecifies the name of the Automation account from which this cmdlet removes a module.StringStringnoneForceForces the command to run without asking for user confirmation.SwitchParameterSwitchParameternoneNameSpecifies the name of the module that this cmdlet removes.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group in which this cmdlet removes a module. StringStringnone 1: Get-AzureAutomationModuleNew-AzureAutomationModuleSet-AzureAutomationModuleSet-AzureAutomationAccountModifies an Automation account.SetAzureAutomationAccountThe Set-AzureAutomationAccount cmdlet modifies an Azure Automation account.For more information about Automation accounts, type Get-Help New-AzureAutomationAccount.Set-AzureAutomationAccountResourceGroupNameSpecifies the name of a resource group that contains the Automation account that this cmdlet modifies.StringNameSpecifies the name of the Automation account that this cmdlet modifies.StringPlanSpecifies the plan for the Automation account. Valid values are: Basic and Free.FreeBasicProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileTagsSpecifies Automation account tags for the Automation account.IDictionaryNameSpecifies the name of the Automation account that this cmdlet modifies.StringStringnonePlanSpecifies the plan for the Automation account. Valid values are: Basic and Free.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group that contains the Automation account that this cmdlet modifies.StringStringnoneTagsSpecifies Automation account tags for the Automation account.IDictionaryIDictionarynone 1: Get-AzureAutomationAccountNew-AzureAutomationAccountRemove-AzureAutomationAccountSet-AzureAutomationDscNodeModifies the node configuration that a DSC node is mapped to.SetAzureAutomationDscNodeThe Set-AzureAutomationDscNode cmdlet modifies a PowerShell Desired State Configuration (DSC) node configuration. Azure Automation stores DSC node configuration as a Managed Object Format (MOF) configuration document.Set-AzureAutomationDscNodeResourceGroupNameSpecifies the name of a resource group in which this cmdlet modifies a DSC node configuration.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC node for which this cmdlet modifies the configuration.StringForceForces the command to run without asking for user confirmation.ProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileIdSpecifies the unique ID of the DSC node for which this cmdlet modifies the configuration.GuidNodeConfigurationNameSpecifies the name of the node configuration to which this cmdlet maps the node.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC node for which this cmdlet modifies the configuration.StringStringnoneForceForces the command to run without asking for user confirmation.SwitchParameterSwitchParameternoneIdSpecifies the unique ID of the DSC node for which this cmdlet modifies the configuration.GuidGuidnoneNodeConfigurationNameSpecifies the name of the node configuration to which this cmdlet maps the node.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group in which this cmdlet modifies a DSC node configuration.StringStringnone 1: Get-AzureAutomationDscNodeRegister-AzureAutomationDscNodeUnregister-AzureAutomationDscNodeSet-AzureAutomationModuleUpdates a module in Automation.SetAzureAutomationModuleThe Set-AzureAutomationModule cmdlet updates a module in Azure Automation. This command accepts a compressed file that has a .zip file name extension. The file contains a folder that includes a file that is one of the following types:
+
+-- Azure PowerShell module, which has a .psm1 file name extension
+-- Azure PowerShell module manifest, which has a .psd1 file name extension
+-- Dynamic link library, which has a .dll file name extensionThe name of the .zip file, the name of the folder, and the name of the file in the folder must be the same.Specify the .zip file as a URL that this computer can access.Set-AzureAutomationModuleResourceGroupNameSpecifies the name of a resource group for which this cmdlet updates a module.StringAutomationAccountNameSpecifies the name of the Automation account for which this cmdlet updates a module.StringNameSpecifies the name of the module that this cmdlet imports.StringContentLinkUriSpecifies the URL of the .zip file that contains the new version of a module that this cmdlet imports.UriContentLinkVersionSpecifies the version of the module to which this cmdlet updates Automation.StringProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAutomationAccountNameSpecifies the name of the Automation account for which this cmdlet updates a module.StringStringnoneContentLinkUriSpecifies the URL of the .zip file that contains the new version of a module that this cmdlet imports.UriUrinoneContentLinkVersionSpecifies the version of the module to which this cmdlet updates Automation.StringStringnoneNameSpecifies the name of the module that this cmdlet imports.StringStringnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group for which this cmdlet updates a module.StringStringnone 1: Get-AzureAutomationModuleNew-AzureAutomationModuleRemove-AzureAutomationModuleStart-AzureAutomationDscCompilationJobCompiles a DSC configuration in Automation.StartAzureAutomationDscCompilationJobThe Start-AzureAutomationDscCompilationJob cmdlet compiles an Azure PowerShell Desired State Configuration (DSC) configuration in Azure Automation. Start-AzureAutomationDscCompilationJobResourceGroupNameSpecifies the name of a resource group in which this cmdlet compiles a configuration.StringAutomationAccountNameSpecifies the name of the Automation account that contains the DSC configuration that this cmdlet compiles. StringConfigurationNameSpecifies the name of the DSC configuration that this cmdlet compiles. StringParametersSpecifies a dictionary of parameters that this cmdlet uses to compile the DSC configuration. IDictionaryProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAutomationAccountNameSpecifies the name of the Automation account that contains the DSC configuration that this cmdlet compiles. StringStringnoneConfigurationNameSpecifies the name of the DSC configuration that this cmdlet compiles. StringStringnoneParametersSpecifies a dictionary of parameters that this cmdlet uses to compile the DSC configuration. IDictionaryIDictionarynoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group in which this cmdlet compiles a configuration.StringStringnone 1: Get-AzureAutomationDscCompilationJobGet-AzureAutomationDscCompilationJobOutputUnregister-AzureAutomationDscNodeRemoves a DSC node from management by an Automation account.UnregisterAzureAutomationDscNodeThe Unregister-AzureAutomationDscNode cmdlet removes an Azure PowerShell Desired State Configuration (DSC) node from management by an Azure Automation account.Unregister-AzureAutomationDscNodeResourceGroupNameSpecifies the name of a resource group in which this cmdlet unregisters a DSC node.StringAutomationAccountNameSpecifies the name of the Automation account from which this cmdlet removes a DSC node.StringForceForces the command to run without asking for user confirmation.ProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileIdSpecifies the unique ID of the DSC node that this cmdlet removes.GuidAutomationAccountNameSpecifies the name of the Automation account from which this cmdlet removes a DSC node.StringStringnoneForceForces the command to run without asking for user confirmation.SwitchParameterSwitchParameternoneIdSpecifies the unique ID of the DSC node that this cmdlet removes.GuidGuidnoneProfileSpecifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.AzureProfileAzureProfilenoneResourceGroupNameSpecifies the name of a resource group in which this cmdlet unregisters a DSC node.StringStringnone 1: Get-AzureAutomationDscNodeRegister-AzureAutomationDscNodeSet-AzureAutomationDscNode
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/BaseProperties.cs b/src/ResourceManager/Automation/Commands.Automation/Model/BaseProperties.cs
new file mode 100644
index 000000000000..08b5ead069a7
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/BaseProperties.cs
@@ -0,0 +1,54 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ ///
+ /// The BaseProperties.
+ ///
+ public class BaseProperties
+ {
+ ///
+ /// Gets or sets the resource group name.
+ ///
+ public string ResourceGroupName { get; set; }
+
+ ///
+ /// Gets or sets the automation account name.
+ ///
+ public string AutomationAccountName { get; set; }
+
+ ///
+ /// Gets or sets the name.
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the creation time.
+ ///
+ public DateTimeOffset CreationTime { get; set; }
+
+ ///
+ /// Gets or sets the last modified time.
+ ///
+ public DateTimeOffset LastModifiedTime { get; set; }
+
+ ///
+ /// Gets or sets the description.
+ ///
+ public string Description { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/CertificateInfo.cs b/src/ResourceManager/Automation/Commands.Automation/Model/CertificateInfo.cs
new file mode 100644
index 000000000000..fa28a224321e
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/CertificateInfo.cs
@@ -0,0 +1,67 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Properties;
+using System;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ public class CertificateInfo : BaseProperties
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The account name.
+ ///
+ ///
+ /// The connection.
+ ///
+ ///
+ ///
+ public CertificateInfo(string resourceGroupName, string accountAcccountName, Azure.Management.Automation.Models.Certificate certificate)
+ {
+ Requires.Argument("certificate", certificate).NotNull();
+ this.AutomationAccountName = accountAcccountName;
+ this.ResourceGroupName = resourceGroupName;
+ this.Name = certificate.Name;
+
+ if (certificate.Properties == null) return;
+
+ this.Description = certificate.Properties.Description;
+ this.CreationTime = certificate.Properties.CreationTime.ToLocalTime();
+ this.LastModifiedTime = certificate.Properties.LastModifiedTime.ToLocalTime();
+ this.ExpiryTime = certificate.Properties.ExpiryTime.ToLocalTime();
+ this.Thumbprint = certificate.Properties.Thumbprint;
+ this.Exportable = certificate.Properties.IsExportable;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public CertificateInfo()
+ {
+ }
+
+ public string Thumbprint { get; set; }
+
+ public bool Exportable { get; set; }
+
+ public DateTimeOffset ExpiryTime { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/Connection.cs b/src/ResourceManager/Automation/Commands.Automation/Model/Connection.cs
new file mode 100644
index 000000000000..29eea9e37473
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/Connection.cs
@@ -0,0 +1,70 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections;
+using System.Collections.Generic;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Properties;
+using System;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ public class Connection : BaseProperties
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The account name.
+ ///
+ ///
+ /// The connection.
+ ///
+ ///
+ ///
+ public Connection(string resourceGroupName, string accountAcccountName, Azure.Management.Automation.Models.Connection connection)
+ {
+ Requires.Argument("connection", connection).NotNull();
+ this.ResourceGroupName = resourceGroupName;
+ this.AutomationAccountName = accountAcccountName;
+ this.Name = connection.Name;
+
+ if (connection.Properties == null) return;
+
+ this.Description = connection.Properties.Description;
+ this.CreationTime = connection.Properties.CreationTime.ToLocalTime();
+ this.LastModifiedTime = connection.Properties.LastModifiedTime.ToLocalTime();
+ this.ConnectionTypeName = connection.Properties.ConnectionType.Name;
+ this.FieldDefinitionValues = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
+ foreach (var kvp in connection.Properties.FieldDefinitionValues)
+ {
+ this.FieldDefinitionValues.Add(kvp.Key, kvp.Value.ToString());
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Connection()
+ {
+ }
+
+ public string ConnectionTypeName { get; set; }
+
+ public Hashtable FieldDefinitionValues { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/CredentialInfo.cs b/src/ResourceManager/Automation/Commands.Automation/Model/CredentialInfo.cs
new file mode 100644
index 000000000000..f8a4e67e7137
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/CredentialInfo.cs
@@ -0,0 +1,59 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Properties;
+using System;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ public class CredentialInfo : BaseProperties
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The account name.
+ ///
+ ///
+ /// The Credential.
+ ///
+ public CredentialInfo(string resourceGroupName, string accountAcccountName, Azure.Management.Automation.Models.Credential credential)
+ {
+ Requires.Argument("credential", credential).NotNull();
+ this.ResourceGroupName = resourceGroupName;
+ this.AutomationAccountName = accountAcccountName;
+ this.Name = credential.Name;
+
+ if (credential.Properties == null) return;
+
+ this.Description = credential.Properties.Description;
+ this.CreationTime = credential.Properties.CreationTime.ToLocalTime();
+ this.LastModifiedTime = credential.Properties.LastModifiedTime.ToLocalTime();
+ this.UserName = credential.Properties.UserName;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public CredentialInfo()
+ {
+ }
+
+ public string UserName { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/Job.cs b/src/ResourceManager/Automation/Commands.Automation/Model/Job.cs
new file mode 100644
index 000000000000..79b7a3f1e7c9
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/Job.cs
@@ -0,0 +1,150 @@
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System.Collections;
+using System.Globalization;
+using Microsoft.Azure.Commands.Automation.Common;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ ///
+ /// The Job object.
+ ///
+ public class Job
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The account name.
+ ///
+ ///
+ /// The Job.
+ ///
+ ///
+ ///
+ public Job(string resourceGroupName, string accountName, Azure.Management.Automation.Models.Job job)
+ {
+ Requires.Argument("job", job).NotNull();
+ Requires.Argument("accountName", accountName).NotNull();
+
+ this.ResourceGroupName = resourceGroupName;
+ this.AutomationAccountName = accountName;
+
+ if (job.Properties == null) return;
+
+ this.Id = job.Properties.JobId;
+ this.CreationTime = job.Properties.CreationTime.ToLocalTime();
+ this.LastModifiedTime = job.Properties.LastModifiedTime.ToLocalTime();
+ this.StartTime = job.Properties.StartTime.HasValue ? job.Properties.StartTime.Value.ToLocalTime() : (DateTimeOffset?)null;
+ this.Status = job.Properties.Status;
+ this.StatusDetails = job.Properties.StatusDetails;
+ this.RunbookName = job.Properties.Runbook.Name;
+ this.Exception = job.Properties.Exception;
+ this.EndTime = job.Properties.EndTime.HasValue ? job.Properties.EndTime.Value.ToLocalTime() : (DateTimeOffset?) null;
+ this.LastStatusModifiedTime = job.Properties.LastStatusModifiedTime;
+ this.HybridWorker = job.Properties.RunOn;
+ this.JobParameters = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
+ foreach (var kvp in job.Properties.Parameters)
+ {
+ if (0 != String.Compare(kvp.Key, Constants.JobStartedByParameterName, CultureInfo.InvariantCulture, CompareOptions.IgnoreCase) &&
+ 0 != String.Compare(kvp.Key, Constants.JobRunOnParameterName, CultureInfo.InvariantCulture, CompareOptions.IgnoreCase))
+ {
+ this.JobParameters.Add(kvp.Key, (object)PowerShellJsonConverter.Deserialize(kvp.Value));
+ }
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Job()
+ {
+ }
+
+ ///
+ /// Gets or sets the resource group name.
+ ///
+ public string ResourceGroupName { get; set; }
+
+ ///
+ /// Gets or sets the automaiton account name.
+ ///
+ public string AutomationAccountName { get; set; }
+
+ ///
+ /// Gets or sets the job id.
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// Gets or sets the tags.
+ ///
+ public DateTimeOffset CreationTime { get; set; }
+
+ ///
+ /// Gets or sets the status of the job.
+ ///
+ public string Status { get; set; }
+
+ ///
+ /// Gets or sets the status details of the job.
+ ///
+ public string StatusDetails { get; set; }
+
+ ///
+ /// Gets or sets the start time of the job.
+ ///
+ public DateTimeOffset? StartTime { get; set; }
+
+ ///
+ /// Gets or sets the end time of the job.
+ ///
+ public DateTimeOffset? EndTime { get; set; }
+
+ ///
+ /// Gets or sets the exception of the job.
+ ///
+ public string Exception { get; set; }
+
+ ///
+ /// Gets or sets the last modified time of the job.
+ ///
+ public DateTimeOffset LastModifiedTime { get; set; }
+
+ ///
+ /// Gets or sets the last status modified time of the job."
+ ///
+ public DateTimeOffset LastStatusModifiedTime { get; set; }
+
+ ///
+ /// Gets or sets the parameters of the job.
+ ///
+ public Hashtable JobParameters { get; set; }
+
+ ///
+ /// Gets or sets the runbook.
+ ///
+ public string RunbookName { get; set; }
+
+ ///
+ /// Gets or sets the HybridWorker.
+ ///
+ public string HybridWorker { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/JobSchedule.cs b/src/ResourceManager/Automation/Commands.Automation/Model/JobSchedule.cs
new file mode 100644
index 000000000000..8fdf8bbace4a
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/JobSchedule.cs
@@ -0,0 +1,94 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Globalization;
+using Microsoft.Azure.Commands.Automation.Common;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ ///
+ /// The Job Schedule.
+ ///
+ public class JobSchedule
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The account name.
+ ///
+ ///
+ /// The job schedule.
+ ///
+ public JobSchedule(string resourceGroupName, string automationAccountName, Azure.Management.Automation.Models.JobSchedule jobSchedule)
+ {
+ Requires.Argument("jobSchedule", jobSchedule).NotNull();
+ this.ResourceGroupName = resourceGroupName;
+ this.AutomationAccountName = automationAccountName;
+ this.JobScheduleId = jobSchedule.Properties.Id.ToString();
+ this.RunbookName = jobSchedule.Properties.Runbook.Name;
+ this.ScheduleName = jobSchedule.Properties.Schedule.Name;
+ this.Parameters = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
+ foreach (var kvp in jobSchedule.Properties.Parameters.Where(kvp => 0 != String.Compare(kvp.Key, Constants.JobStartedByParameterName, CultureInfo.InvariantCulture,
+ CompareOptions.IgnoreCase)))
+ {
+ this.Parameters.Add(kvp.Key, (object)PowerShellJsonConverter.Deserialize(kvp.Value));
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public JobSchedule()
+ {
+ }
+
+ ///
+ /// Gets or sets the resource group name.
+ ///
+ public string ResourceGroupName { get; set; }
+
+ ///
+ /// Gets or sets the automation account name.
+ ///
+ public string AutomationAccountName { get; set; }
+
+ ///
+ /// Gets or sets the job schedule id.
+ ///
+ public string JobScheduleId { get; set; }
+
+ ///
+ /// Gets or sets the runbook name.
+ ///
+ public string RunbookName { get; set; }
+
+ ///
+ /// Gets or sets the schedule name.
+ ///
+ public string ScheduleName { get; set; }
+
+ ///
+ /// Gets or sets the runbook parameters.
+ ///
+ public Hashtable Parameters { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/Runbook.cs b/src/ResourceManager/Automation/Commands.Automation/Model/Runbook.cs
new file mode 100644
index 000000000000..bb23b0c1968e
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/Runbook.cs
@@ -0,0 +1,133 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Management.Automation.Models;
+using Microsoft.WindowsAzure.Commands.Common;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ using AutomationManagement = Azure.Management.Automation;
+
+ ///
+ /// The Runbook.
+ ///
+ public class Runbook : BaseProperties
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The account name.
+ ///
+ ///
+ /// The runbook.
+ ///
+ ///
+ ///
+ public Runbook(string resourceGroupName, string accountName, AutomationManagement.Models.Runbook runbook)
+ {
+ Requires.Argument("runbook", runbook).NotNull();
+ Requires.Argument("accountName", accountName).NotNull();
+
+ this.ResourceGroupName = resourceGroupName;
+ this.AutomationAccountName = accountName;
+ this.Name = runbook.Name;
+ this.Location = runbook.Location;
+
+ if (runbook.Properties == null) return;
+
+ this.CreationTime = runbook.Properties.CreationTime.ToLocalTime();
+ this.LastModifiedTime = runbook.Properties.LastModifiedTime.ToLocalTime();
+ this.Description = runbook.Properties.Description;
+
+ this.LogVerbose = runbook.Properties.LogVerbose;
+ this.LogProgress = runbook.Properties.LogProgress;
+ this.State = runbook.Properties.State;
+ this.JobCount = runbook.Properties.JobCount;
+ this.RunbookType = runbook.Properties.RunbookType;
+ this.LastModifiedBy = runbook.Properties.LastModifiedBy;
+ this.Tags = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
+ foreach (var kvp in runbook.Tags)
+ {
+ this.Tags.Add(kvp.Key, kvp.Value);
+ }
+
+ this.Parameters = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
+ foreach (var kvp in runbook.Properties.Parameters)
+ {
+ this.Parameters.Add(kvp.Key, (object)kvp.Value);
+ }
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Runbook()
+ {
+ }
+
+ ///
+ /// Gets or sets the location.
+ ///
+ public string Location { get; set; }
+
+ ///
+ /// Gets or sets the tags.
+ ///
+ public Hashtable Tags { get; set; }
+
+ ///
+ /// Gets or sets the JobCount.
+ ///
+ public int JobCount { get; set; }
+
+ ///
+ /// Gets or sets the runbook type.
+ ///
+ public string RunbookType { get; set; }
+
+ ///
+ /// Gets or sets the parameters.
+ ///
+ public Hashtable Parameters { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether log verbose is enabled.
+ ///
+ public bool LogVerbose { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether log progress is enabled.
+ ///
+ public bool LogProgress { get; set; }
+
+ ///
+ /// Gets or sets a last modified by.
+ ///
+ public string LastModifiedBy { get; set; }
+
+ ///
+ /// Gets or sets the state of runbook.
+ ///
+ public string State { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/Schedule.cs b/src/ResourceManager/Automation/Commands.Automation/Model/Schedule.cs
new file mode 100644
index 000000000000..efeef2a4cd09
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/Schedule.cs
@@ -0,0 +1,94 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using Microsoft.Azure.Commands.Automation.Common;
+using Microsoft.Azure.Commands.Automation.Properties;
+using System;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ ///
+ /// The Schedule.
+ ///
+ public class Schedule : BaseProperties
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ /// The automation account name.
+ ///
+ ///
+ /// The schedule.
+ ///
+ public Schedule(string resourceGroupName, string automationAccountName, Azure.Management.Automation.Models.Schedule schedule)
+ {
+ Requires.Argument("schedule", schedule).NotNull();
+ this.ResourceGroupName = resourceGroupName;
+ this.AutomationAccountName = automationAccountName;
+ this.Name = schedule.Name;
+ this.Description = schedule.Properties.Description;
+ this.StartTime = schedule.Properties.StartTime.ToLocalTime();
+ this.ExpiryTime = schedule.Properties.ExpiryTime.ToLocalTime();
+ this.CreationTime = schedule.Properties.CreationTime.ToLocalTime();
+ this.LastModifiedTime = schedule.Properties.LastModifiedTime.ToLocalTime();
+ this.IsEnabled = schedule.Properties.IsEnabled;
+ this.NextRun = schedule.Properties.NextRun.HasValue
+ ? schedule.Properties.NextRun.Value.ToLocalTime()
+ : this.NextRun;
+ this.Interval = schedule.Properties.Interval.HasValue ? schedule.Properties.Interval.Value : this.Interval;
+ this.Frequency = (ScheduleFrequency)Enum.Parse(typeof(ScheduleFrequency), schedule.Properties.Frequency, true);
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Schedule()
+ {
+ }
+
+ ///
+ /// Gets or sets the start time.
+ ///
+ public DateTimeOffset StartTime { get; set; }
+
+ ///
+ /// Gets or sets the expiry time.
+ ///
+ public DateTimeOffset ExpiryTime { get; set; }
+
+ ///
+ /// Gets or sets a value indicating whether is enabled.
+ ///
+ public bool IsEnabled { get; set; }
+
+ ///
+ /// Gets or sets the next run.
+ ///
+ public DateTimeOffset? NextRun { get; set; }
+
+ ///
+ /// Gets or sets the schedule interval.
+ ///
+ public byte? Interval { get; set; }
+
+ ///
+ /// Gets or sets the schedule frequency.
+ ///
+ public ScheduleFrequency Frequency { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/ScheduleFrequency.cs b/src/ResourceManager/Automation/Commands.Automation/Model/ScheduleFrequency.cs
new file mode 100644
index 000000000000..97149351e5b1
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/ScheduleFrequency.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ public enum ScheduleFrequency
+ {
+ Onetime,
+ Day,
+ Hour
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Model/Variable.cs b/src/ResourceManager/Automation/Commands.Automation/Model/Variable.cs
new file mode 100644
index 000000000000..0c1ab42e9464
--- /dev/null
+++ b/src/ResourceManager/Automation/Commands.Automation/Model/Variable.cs
@@ -0,0 +1,81 @@
+// ----------------------------------------------------------------------------------
+//
+// Copyright Microsoft Corporation
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+// http://www.apache.org/licenses/LICENSE-2.0
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+// ----------------------------------------------------------------------------------
+
+using Microsoft.Azure.Commands.Automation.Common;
+using System;
+
+namespace Microsoft.Azure.Commands.Automation.Model
+{
+ using AutomationManagement = Azure.Management.Automation;
+
+ ///
+ /// The Variable.
+ ///
+ public class Variable : BaseProperties
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ ///
+ /// The varaiable.
+ ///
+ ///
+ /// The automation account name.
+ ///
+ ///
+ /// The resource group name.
+ ///
+ ///
+ ///
+ public Variable(AutomationManagement.Models.Variable variable, string automationAccoutName, string resourceGroupName)
+ {
+ Requires.Argument("variable", variable).NotNull();
+
+ this.ResourceGroupName = resourceGroupName;
+ this.Name = variable.Name;
+ this.CreationTime = variable.Properties.CreationTime.ToLocalTime();
+ this.LastModifiedTime = variable.Properties.LastModifiedTime.ToLocalTime();
+
+ if (variable.Properties.Value == null || variable.Properties.IsEncrypted)
+ {
+ this.Value = null;
+ }
+ else
+ {
+ this.Value = PowerShellJsonConverter.Deserialize(variable.Properties.Value);
+ }
+
+ this.Description = variable.Properties.Description;
+ this.Encrypted = variable.Properties.IsEncrypted;
+ this.AutomationAccountName = automationAccoutName;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Variable()
+ {
+ }
+
+ ///
+ /// Gets or sets the value.
+ ///
+ public object Value { get; set; }
+
+ ///
+ /// Gets or sets the description.
+ ///
+ public bool Encrypted { get; set; }
+ }
+}
diff --git a/src/ResourceManager/Automation/Commands.Automation/Properties/Resources.Designer.cs b/src/ResourceManager/Automation/Commands.Automation/Properties/Resources.Designer.cs
index 6b6d54c8584e..157b7fa2e9c2 100644
--- a/src/ResourceManager/Automation/Commands.Automation/Properties/Resources.Designer.cs
+++ b/src/ResourceManager/Automation/Commands.Automation/Properties/Resources.Designer.cs
@@ -294,6 +294,15 @@ internal static string InvalidFolderPath {
}
}
+ ///
+ /// Looks up a localized string similar to Imported file should be either .ps1 or .graphrunbook..
+ ///
+ internal static string InvalidImportFile {
+ get {
+ return ResourceManager.GetString("InvalidImportFile", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Invalid runbook parameters..
///
@@ -303,6 +312,15 @@ internal static string InvalidRunbookParameters {
}
}
+ ///
+ /// Looks up a localized string similar to The runbook type is invalid for the file extension. PowerShell workflow and scripts should be .ps1. Graph runbook extension should be .graphrunbook. Provided file extension: {0} .
+ ///
+ internal static string InvalidRunbookTypeForExtension {
+ get {
+ return ResourceManager.GetString("InvalidRunbookTypeForExtension", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to The Job having Id: {0} was not found..
///
@@ -537,6 +555,15 @@ internal static string RunbookAlreadyHasDraft {
}
}
+ ///
+ /// Looks up a localized string similar to Runbook file already exists. Specify the force switch switch overwrite. Runbook file name: {0}.
+ ///
+ internal static string RunbookFileAlreadyExists {
+ get {
+ return ResourceManager.GetString("RunbookFileAlreadyExists", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to The runbook has no draft version. Runbook name {0}..
///
diff --git a/src/ResourceManager/Automation/Commands.Automation/Properties/Resources.resx b/src/ResourceManager/Automation/Commands.Automation/Properties/Resources.resx
index 6a7091667d81..a5e5111c1626 100644
--- a/src/ResourceManager/Automation/Commands.Automation/Properties/Resources.resx
+++ b/src/ResourceManager/Automation/Commands.Automation/Properties/Resources.resx
@@ -388,8 +388,19 @@
The Webhook with Name: {0} was not found.
Automation
-
+
For security purposes, the URL of the created webhook will only be viewable in the output of this command. No other commands will return the webhook URL. Make sure to copy down the webhook URL from this command's output before closing your PowerShell session, and to store it securely.
Automation
+
+ Imported file should be either .ps1 or .graphrunbook.
+ Automation
+
+
+ The runbook type is invalid for the file extension. PowerShell workflow and scripts should be .ps1. Graph runbook extension should be .graphrunbook. Provided file extension: {0}
+
+
+ Runbook file already exists. Specify the force switch switch overwrite. Runbook file name: {0}
+ Automation
+
\ No newline at end of file