diff --git a/src/Automation/Automation/ChangeLog.md b/src/Automation/Automation/ChangeLog.md index 3756c69cd573..9a3712ee4190 100644 --- a/src/Automation/Automation/ChangeLog.md +++ b/src/Automation/Automation/ChangeLog.md @@ -21,6 +21,8 @@ * Update help for Import-AzAutomationDscNodeConfiguration * Added configuration name validation to Import-AzAutomationDscConfiguration cmdlet * Improved error handling for Import-AzAutomationDscConfiguration cmdlet +* Changed behavior for Start-AzAutomationDscCompilationJob to just start the job instead of waiting for its completion. + - Fix for issue https://github.com/Azure/azure-powershell/issues/8347 ## Version 1.1.0 * Added support for Python 2 runbooks diff --git a/src/Automation/Automation/Cmdlet/StartAzureAutomationDscCompilationJob.cs b/src/Automation/Automation/Cmdlet/StartAzureAutomationDscCompilationJob.cs index 5a83c735d57c..c7d0fa897954 100644 --- a/src/Automation/Automation/Cmdlet/StartAzureAutomationDscCompilationJob.cs +++ b/src/Automation/Automation/Cmdlet/StartAzureAutomationDscCompilationJob.cs @@ -14,6 +14,7 @@ using Microsoft.Azure.Commands.Automation.Model; using Microsoft.Azure.Commands.Automation.Properties; +using Microsoft.WindowsAzure.Commands.Common.CustomAttributes; using System; using System.Collections; using System.Globalization; diff --git a/src/Automation/Automation/Common/AutomationPSClientDSC.cs b/src/Automation/Automation/Common/AutomationPSClientDSC.cs index cd5542abc8d0..24419ba91c18 100644 --- a/src/Automation/Automation/Common/AutomationPSClientDSC.cs +++ b/src/Automation/Automation/Common/AutomationPSClientDSC.cs @@ -983,7 +983,24 @@ public CompilationJob StartCompilationJob(string resourceGroupName, string autom }; - var job = this.automationManagementClient.DscCompilationJob.Create(resourceGroupName, automationAccountName, Guid.NewGuid().ToString(), createJobParameters); + string jobId = Guid.NewGuid().ToString(); + + var jobTask = this.automationManagementClient.DscCompilationJob.CreateAsync(resourceGroupName, automationAccountName, jobId, createJobParameters).GetAwaiter(); + DscCompilationJob job = null; + + do + { + System.Threading.Thread.Sleep(1000); + + try + { + job = this.automationManagementClient.DscCompilationJob.Get(resourceGroupName, automationAccountName, jobId); + } + catch + { + job = null; + } + } while (job == null); return new Model.CompilationJob(resourceGroupName, automationAccountName, job); }