Skip to content

Commit 9a01f1f

Browse files
committed
Fixed the import issue when importing a DSC Node Configuration
1 parent afe4928 commit 9a01f1f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/ResourceManager/Automation/Commands.Automation/Cmdlet/ImportAzureAutomationDscNodeConfiguration.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,20 @@ public override void ExecuteCmdlet()
7979
{
8080
var nodeName = System.IO.Path.GetFileNameWithoutExtension(Path);
8181
var nodeConfigurationName = ConfigurationName + "." + nodeName;
82+
NodeConfiguration nodeConfigurationModel = null;
8283

83-
// if node configuration already exists, ensureuser knows about it.
84-
var nodeConfigurationModel = AutomationClient.GetNodeConfiguration(ResourceGroupName,
85-
AutomationAccountName,
86-
nodeConfigurationName,
87-
null);
84+
try
85+
{
86+
// if node configuration already exists, ensureuser knows about it.
87+
nodeConfigurationModel = AutomationClient.GetNodeConfiguration(ResourceGroupName,
88+
AutomationAccountName,
89+
nodeConfigurationName,
90+
null);
91+
}
92+
catch (ResourceNotFoundException)
93+
{
94+
nodeConfigurationModel = null;
95+
}
8896

8997
if (nodeConfigurationModel != null && !IncrementNodeConfigurationBuild.IsPresent)
9098
{

0 commit comments

Comments
 (0)