DscWorkshop icon indicating copy to clipboard operation
DscWorkshop copied to clipboard

Azure DevOps Automation breaks on MOF Upload if server name contains hyphen

Open danielniccoli opened this issue 4 years ago • 0 comments

Our server names contain hyphens. This breaks the Azure DevOps automation in a specific way. When the release pipeline script is triggered, that uploads the MOF files to Azure, then you'll run into an error (that doesn't stop execution).

2021-09-01T12:12:35.2831940Z VERBOSE: Performing the operation "Import" on target "D:\a\r1\a\_Windows Server DSC-CI\MOF\server-xyz-123.mof".
2021-09-01T12:13:06.5410128Z Import-AzureRmAutomationDscNodeConfiguration : Long running operation failed with status 'NotFound'.

The error message is misleading. What actually causes the error can only be found out when uploading the mof file in the Azure portal:

image

I haven't found an easy workaround for this, because the configuration name is derived from the mof's filename exactly at this line of the automation script:

# […]
Import-AzureRmAutomationDscNodeConfiguration -ResourceGroupName $env:ResourceGroupName -AutomationAccountName $env:AutomationAccountName -Path $config.FullName -ConfigurationName $config.BaseName -Verbose -Force
# […]

So changing the ConfigurationNames in the node's YAML doesn't actually fix the problem.

NodeName: server-xyz-123
Environment: Prod
Location: Frankfurt

# […]

LcmConfig:
  ConfigurationRepositoryWeb:
    Server:
      # ConfigurationNames: server-xyz-123.server-xyz-123 # BEFORE
      ConfigurationNames: serverxyz123.server-xyz-123 # AFTER, no fix

Is there a fix for this that I do not see?

danielniccoli avatar Sep 01 '21 14:09 danielniccoli