首页 > 解决方案 > 如何从专用网络中在 Azure 自动化中注册 AzureVM

问题描述

我有一个 azure 虚拟机,刚刚启动,它通过 VPN 连接到我的办公室。NSG 进行管理,使计算机只能通过需要身份验证的本地代理访问 Internet。

设置代理后,以我的用户身份浏览互联网就可以了。

我正在尝试将机器注册到 Azure 自动化中——只是一个安装 IIS 以测试功能的简单脚本——但我无法让它工作。我唯一能想到的是互联网访问限制。

我已将运行 Azure VM 代理的用户更改为我的用户,该用户应该可以访问 Internet,并且是 VM 上的管理员。

这是我要回来的错误:

{
        "code": "ComponentStatus/DscConfigurationLog/failed/8",
        "level": "Error",
        "displayStatus": "Provisioning failed",
        "message": "[2018-08-07 10:12:15Z] [VERBOSE] Performing the operation \"Start-DscConfiguration: SendMetaConfigurationApply\" on target \"MSFT_DSCLocalConfigurationManager\".\r\n[2018-08-07 10:12:15Z] [VERBOSE] Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendMetaConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.\r\n[2018-08-07 10:12:16Z] [VERBOSE] An LCM method call arrived from computer UKS-DV2-APP01 with user sid S-1-5-21-749233376-2042966360-840782136-22985.\r\n[2018-08-07 10:12:16Z] [VERBOSE] [UKS-DV2-APP01]: LCM:  [ Start  Set      ]\r\n[2018-08-07 10:12:16Z] [VERBOSE] [UKS-DV2-APP01]: LCM:  [ Start  Resource ]  [MSFT_DSCMetaConfiguration]\r\n[2018-08-07 10:12:16Z] [VERBOSE] [UKS-DV2-APP01]: LCM:  [ Start  Set      ]  [MSFT_DSCMetaConfiguration]\r\n[2018-08-07 10:12:16Z] [VERBOSE] [UKS-DV2-APP01]: LCM:  [ End    Set      ]  [MSFT_DSCMetaConfiguration]  in 0.0630 seconds.\r\n[2018-08-07 10:12:16Z] [VERBOSE] [UKS-DV2-APP01]: LCM:  [ End    Resource ]  [MSFT_DSCMetaConfiguration]\r\n[2018-08-07 10:12:38Z] [VERBOSE] [UKS-DV2-APP01]: LCM:  [ End    Set      ]\r\n[2018-08-07 10:13:21Z] [ERROR] Registration of the Dsc Agent with the server https://uks-agentservice-prod-1.azure-automation.net/accounts/GUID failed. The underlying error is: Failed to register Dsc Agent with AgentId GUID with the server https://uks-agentservice-prod-1.azure-automation.net/accounts/GUID/Nodes(AgentId='GUID'). .\r\n[2018-08-07 10:13:21Z] Settings handler status to 'transitioning' (C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\Status\\0.status)\r\n[2018-08-07 10:13:21Z] [VERBOSE] Operation 'Invoke CimMethod' complete.\r\n[2018-08-07 10:13:21Z] [VERBOSE] Set-DscLocalConfigurationManager finished in 65.647 seconds."
    },
    {
        "code": "ComponentStatus/DscExtensionLog/failed/8",
        "level": "Error",
        "displayStatus": "Provisioning failed",
        "message": "[2018-08-07 10:12:07Z] Updating execution status (HKLM:\\SOFTWARE\\Microsoft\\Azure\\DSC\\2.76.0.0\\Status)\r\n[2018-08-07 10:12:07Z] Transitioning to ProcessConfiguration state ...\r\n[2018-08-07 10:12:07Z] Getting handler execution status HKLM:\\SOFTWARE\\Microsoft\\Azure\\DSC\\2.76.0.0\\Status ...\r\n[2018-08-07 10:12:07Z] Getting handler execution status HKLM:\\SOFTWARE\\Microsoft\\Azure\\DSC\\2.76.0.0\\Status ...\r\n[2018-08-07 10:12:07Z] Settings handler status to 'transitioning' (C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\Status\\0.status)\r\n[2018-08-07 10:12:07Z] Applying DSC configuration:\r\n[2018-08-07 10:12:07Z]     Sequence Number:              0\r\n[2018-08-07 10:12:07Z]     Configuration URL:            C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\bin\\..\\scripts\\dscaa\\RegistrationMetaConfigV2.ps1\r\n[2018-08-07 10:12:07Z]     Configuration Script:         RegistrationMetaConfigV2.ps1\r\n[2018-08-07 10:12:07Z]     Configuration Function:       RegistrationMetaConfigV2\r\n[2018-08-07 10:12:07Z] Creating Working directory: C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\bin\\..\\DSCWork\\RegistrationMetaConfigV2.0\r\n[2018-08-07 10:12:07Z] Downloading configuration package\r\n[2018-08-07 10:12:07Z] Downloading C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\bin\\..\\scripts\\dscaa\\RegistrationMetaConfigV2.ps1 to C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\bin\\..\\DSCWork\\RegistrationMetaConfigV2.0\\RegistrationMetaConfigV2.ps1\r\n[2018-08-07 10:12:07Z] Looking for the definition of the configuration function.\r\n[2018-08-07 10:12:07Z] Executing C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\bin\\..\\DSCWork\\RegistrationMetaConfigV2.0\\RegistrationMetaConfigV2.ps1\r\n[2018-08-07 10:12:07Z] Preparing configuration arguments and configuration data.\r\n[2018-08-07 10:12:09Z] Created encryption certificate 9CACC48CC5509493F01B97B1F3B5710A63DA311E\r\n[2018-08-07 10:12:09Z] Adding encryption certificate CERT KEY to the configuration data\r\n[2018-08-07 10:12:09Z] Creating MOF files.\r\n[2018-08-07 10:12:09Z] Executing the configuration function to generate the MOF files.\r\n[2018-08-07 10:12:11Z] Meta configuration found. Injecting Thumbprint.\r\n[2018-08-07 10:12:11Z] CertificateID not present in existing meta configuration; inserting CERT KEY.\r\n[2018-08-07 10:12:11Z] Verifying metaconfiguration for reboot information...\r\n[2018-08-07 10:12:11Z] Executing Set-DscLocalConfigurationManager...\r\n[2018-08-07 10:12:12Z] Settings handler status to 'transitioning' (C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\Status\\0.status)\r\n[2018-08-07 10:13:22Z] Settings handler status to 'transitioning' (C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\Status\\0.status)\r\n[2018-08-07 10:13:22Z] Updating execution status (HKLM:\\SOFTWARE\\Microsoft\\Azure\\DSC\\2.76.0.0\\Status)\r\n[2018-08-07 10:13:22Z] DSC configuration completed.\r\n[2018-08-07 10:13:22Z] No meta mof back up file exist to restore ...\r\n[2018-08-07 10:13:22Z] Settings handler status to 'error' (C:\\Packages\\Plugins\\Microsoft.Powershell.DSC\\2.76.0.0\\Status\\0.status)"
    },

标签: azuredscazure-automationpowershell-dsc

解决方案


DSC 当前不支持代理配置。我建议对此功能请求进行投票以使 DSC 具有代理意识。这些将直接提交给产品团队进行审核。https://feedback.azure.com/forums/246290-automation/suggestions/33579367-lcm-dsc-proxy-awareness 您可以使用混合运行手册作为解决方法。


推荐阅读