I'm having difficulties joining a Windows machine to Azure DSC automation. I'm getting the following error:
Registration of the Dsc Agent with the server https://azureserver/accounts/XXXXXXXXXXXXXXXXXXXX failed. The underlying error is: The attempt to register Dsc Agent with AgentId
XXXXXXXXXXXXXXXXXXXXXX with the server https://azureserver/accounts/XXXXXXXXXXXXXXXXXXXX/Nodes(AgentId='XXXXXXXXXXXXXXXXXXXXXX') returned unexpected response code
Unauthorized. .
+ CategoryInfo : InvalidResult: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : RegisterDscAgentUnsuccessful,Microsoft.PowerShell.DesiredStateConfiguration.Commands.RegisterDscAgentCommand
+ PSComputerName : AZURE-TEST
Here is my meta mof config
param (
[Parameter(Mandatory=$True)]
[String]$RegistrationUrl,
[Parameter(Mandatory=$True)]
[String]$RegistrationKey,
[Parameter(Mandatory=$True)]
[String[]]$ComputerName,
[Int]$RefreshFrequencyMins = 30,
[Int]$ConfigurationModeFrequencyMins = 15,
[String]$ConfigurationMode = "ApplyAndMonitor",
[String]$NodeConfigurationName
)
[DscLocalConfigurationManager()]
Configuration DscMetaConfigs
{
param
(
[Parameter(Mandatory=$True)]
[String]$RegistrationUrl,
[Parameter(Mandatory=$True)]
[String]$RegistrationKey,
[Parameter(Mandatory=$True)]
[String[]]$ComputerName,
[Int]$RefreshFrequencyMins = 30,
[Int]$ConfigurationModeFrequencyMins = 15,
[String]$ConfigurationMode = "ApplyAndMonitor",
[String]$NodeConfigurationName,
[Boolean]$RebootNodeIfNeeded= $False,
[String]$ActionAfterReboot = "ContinueConfiguration",
[Boolean]$AllowModuleOverwrite = $False,
[Boolean]$ReportOnly = $False
)
if(!$NodeConfigurationName -or $NodeConfigurationName -eq "")
{
$ConfigurationNames = $null
}
else
{
$ConfigurationNames = @($NodeConfigurationName)
}
if($ReportOnly)
{
$RefreshMode = "PUSH"
}
else
{
$RefreshMode = "PULL"
}
Node $ComputerName
{
Settings
{
RefreshFrequencyMins = $RefreshFrequencyMins
RefreshMode = $RefreshMode
ConfigurationMode = $ConfigurationMode
AllowModuleOverwrite = $AllowModuleOverwrite
RebootNodeIfNeeded = $RebootNodeIfNeeded
ActionAfterReboot = $ActionAfterReboot
ConfigurationModeFrequencyMins = $ConfigurationModeFrequencyMins
}
if(!$ReportOnly)
{
ConfigurationRepositoryWeb AzureAutomationDSC
{
ServerUrl = $RegistrationUrl
RegistrationKey = $RegistrationKey
ConfigurationNames = $ConfigurationNames
}
ResourceRepositoryWeb AzureAutomationDSC
{
ServerUrl = $RegistrationUrl
RegistrationKey = $RegistrationKey
}
}
ReportServerWeb AzureAutomationDSC
{
ServerUrl = $RegistrationUrl
RegistrationKey = $RegistrationKey
}
}
}
DscMetaConfigs -RegistrationUrl $RegistrationUrl -RegistrationKey $RegistrationKey -ComputerName $env:COMPUTERNAME -NodeConfigurationName $NodeConfigurationName
I have a script that allows an end user to put in the necessary information (Registration keys, URL etc..), generates the meta mof then feeds it to the LCM. But I get the aforementioned error when I try to execute.
Here is the relevant DSC event error log
Job {6E7C0C83-BD69-11E7-BD75-005056852B86} :
Http Client XXXXXXXXXXXXXXXXXXXXXX failed for WebReportManager for configuration
FullyQualifiedErrorId :ReportManagerSendStatusReportUnsuccessful
CategoryInfo:InvalidResult: (:) [], InvalidOperationException
ExceptionMessage:The attempt to send status report to the server https://azureserver/accounts/XXXXXXXXXXXXXXXXX/Nodes(AgentId='XXXXXXXXXXXXXXXXXXXXXXXXX')/SendReport returned unexpected response code Unauthorized.
, InnerException
.
Does anybody have any ideas on what could be the problem? Given the error I'm assuming it's permissions/authentication related, but I'm not sure what it could besides the key, which I've double checked to make sure is correct.




