【发布时间】:2017-09-26 12:45:55
【问题描述】:
我正在尝试将新的 Windows Server 2016 服务器注册到 Azure 自动化中,作为 DSC 节点。我正在使用脚本here 这样做。脚本运行后,报告会出现在节点旁边的自动化中,标记为“一致性”,状态为“合规”。然而,报告似乎什么也没做,没有生成资源,尽管配置正确。
我发现它什么也没做,直到我重新启动机器,然后 PowerShell DSC 再次开始运行,并按预期生成所有资源。 (见下面两份报告的截图)。
我检查了原始日志,并在第一份报告中收到此消息:
Registration of the Dsc Agent with the server https://ne-agentservice-prod-1.azure-automation.net/accounts/(removed) failed. The underlying error is: The attempt to register Dsc Agent with AgentId (removed) with the server https://ne-agentservice-prod-1.azure-automation.net/accounts/(removed)/Nodes(AgentId=\\(removed)) returned unexpected response code BadRequest.
我可以在日志中看到这一点:
Performing the operation \"Start-DscConfiguration: \r\nSendMetaConfigurationApply\" on target \"MSFT_DSCLocalConfigurationManager\".\nVERBOSE: Perform operation 'Invoke CimMethod' with following parameters, \r\n''methodName' = SendMetaConfigurationApply,'className' = \r\nMSFT_DSCLocalConfigurationManager,'namespaceName' = \r\nroot/Microsoft/Windows/DesiredStateConfiguration'.\nVERBOSE: An LCM method call arrived from computer (removed) with user sid\r\n S-1-5-18.\n\tFailed to apply SetupLCM DSC Configuration to self!\n\tError details: Microsoft.Management.Infrastructure.CimException: Cannot invoke the Set-DscLocalConfigurationManager cmdlet. The Consistency Check or Pull cmdlet is in progress and must return before Set-DscLocalConfigurationManager can be invoked. Use -Force option if that is available to cancel the current operation.
我无法确定自动化中是否存在错误、我用来注册的脚本或问题实际出在哪里。我也不明白为什么重启可以解决问题,当我第一次开始测试注册 DSC 时,它不需要重启。
【问题讨论】:
标签: powershell azure dsc azure-automation