【问题标题】:Azure DSC extension for ARM, powershell script will not update适用于 ARM 的 Azure DSC 扩展,powershell 脚本不会更新
【发布时间】:2016-05-09 16:09:19
【问题描述】:

我在获取 DSC 扩展以更新 Azure 中 ARM 配置的 VM 上的资源时遇到问题。

这是我正在使用的 ARM 模板资源:

{
      "name": "[concat(parameters('vmName'),'/dscExtension')]",
      "type": "Microsoft.Compute/virtualMachines/extensions",
      "location": "[resourceGroup().location]",
      "apiVersion": "[variables('apiVersion')]",
      "dependsOn": [
        "[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
      ],
      "tags": {
        "displayName": "Desired State Configuration"
      },
      "properties": {
        "publisher": "Microsoft.Powershell",
        "type": "DSC",
        "typeHandlerVersion": "2.9",
        "autoUpgradeMinorVersion": true,
        "forceUpdateTag": "1.012",
        "settings": {
          "wmfVersion": "latest",
          "modulesUrl": "[concat(parameters('_artifactsLocation'), '/', parameters('DSCConfigurationFile'))]",
          "sasToken": "[parameters('_artifactsLocationSasToken')]",
          "configurationFunction": "[parameters('DSCConfigurationFunction')]",
          "properties": {
          }
        },
        "protectedSettings": { }
      }
    }
  ],
  "outputs": {
  }

我尝试过Update the LocalConfigurationManager 和Using the forceUpdateTag——这两个选项似乎都没有效果。

这里是 CommandExecution.log

[05/09/2016 20:17:00.25] Executing: C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\bin\enable.cmd 
[05/09/2016 20:17:02.08] Execution Complete.
######
Execution Output:
Waiting for install to complete...
Install completed.
C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0>powershell.exe -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -File C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\bin\enable.ps1 -StartAsyncProcess  0<nul 
VERBOSE: [2016-05-09T20:17:01] Retrieving status of current request...
VERBOSE: [2016-05-09T20:17:02]     Sequence Number     : 0
VERBOSE: [2016-05-09T20:17:02]     Previous Sequence   : 0
VERBOSE: [2016-05-09T20:17:02]     RebootPending       : False
VERBOSE: [2016-05-09T20:17:02]     RebootNodeIfNeeded  : False
VERBOSE: [2016-05-09T20:17:02]     UseExisting         : False
VERBOSE: [2016-05-09T20:17:02]     State               : Completed
VERBOSE: [2016-05-09T20:17:02] The request for Sequence Number 0 was already processed; will exit.
C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0>exit 0 


Execution Error:

######
Command C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\bin\enable.cmd of Microsoft.Powershell.DSC has exited with Exit code: 0
Plugin (name: Microsoft.Powershell.DSC, version: 2.17.0.0) completed successfully.

值得注意的是,输出了几个 commandexecution*.log 文件,每个部署一个,但只有 1 个 DscExtensionHandler*.log

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----         5/9/2016   8:17 PM           1331 CommandExecution.log
-a----         5/9/2016   8:15 PM           1331 CommandExecution_12.log
-a----         5/9/2016   8:12 PM           1331 CommandExecution_11.log
-a----         5/9/2016   8:09 PM           1331 CommandExecution_10.log
-a----         5/9/2016   8:07 PM           1331 CommandExecution_9.log
-a----         5/9/2016   8:05 PM           1331 CommandExecution_8.log
-a----         5/9/2016   8:03 PM           1331 CommandExecution_7.log
-a----         5/9/2016   8:01 PM           1331 CommandExecution_6.log
-a----         5/9/2016   7:59 PM          24686 DscExtensionHandler.0.20160509-195436.log
-a----         5/9/2016   7:54 PM           2305 CommandExecution_5.log

这是最新的 DscExtensionHandler*.log

(C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\Status\0.status)
    VERBOSE: [2016-05-09T19:54:58] Get-DscLocalConfigurationManager: 

    ActionAfterReboot              : ContinueConfiguration
    AgentId                        : E3E292F1-161F-11E6-80C8-000D3A3076AA
    AllowModuleOverWrite           : False
    CertificateID                  : 
    ConfigurationDownloadManagers  : {}
    ConfigurationID                : 
    ConfigurationMode              : ApplyAndMonitor
    ConfigurationModeFrequencyMins : 15
    Credential                     : 
    DebugMode                      : {All}
    DownloadManagerCustomData      : 
    DownloadManagerName            : 
    LCMCompatibleVersions          : {1.0, 2.0}
    LCMState                       : Idle
    LCMStateDetail                 : 
    LCMVersion                     : 2.0
    StatusRetentionTimeInDays      : 10
    PartialConfigurations          : 
    RebootNodeIfNeeded             : False
    RefreshFrequencyMins           : 30
    RefreshMode                    : PUSH
    ReportManagers                 : {}
    ResourceModuleManagers         : {}
    PSComputerName                 : 

    VERBOSE: [2016-05-09T19:54:58] Executing Start-DscConfiguration...
    VERBOSE: [2016-05-09T19:54:58] Settings handler status to 'transitioning' 
    (C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\Status\0.status)
    VERBOSE: [2016-05-09T19:54:58] [VERBOSE] Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = 
    SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = 
    root/Microsoft/Windows/DesiredStateConfiguration'.
    VERBOSE: [2016-05-09T19:54:58] [VERBOSE] An LCM method call arrived from computer WB01 with user sid S-1-5-18.
    VERBOSE: [2016-05-09T19:54:58] [VERBOSE] [WB01]: LCM:  [ Start  Set      ]
    VERBOSE: [2016-05-09T19:54:59] [VERBOSE] [WB01]:                            [DSCEngine] Importing the module 
    C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\DscResources\MSFT_RoleResource\MSFT_RoleResource
    .psm1 in force mode.
    VERBOSE: [2016-05-09T19:54:59] [VERBOSE] [WB01]:                            [DSCEngine] Importing the module 
    C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\DscResources\MSFT_ScriptResource\MSFT_ScriptReso
    urce.psm1 in force mode.
    VERBOSE: [2016-05-09T19:54:59] [VERBOSE] [WB01]:                            [DSCEngine] Importing the module 
    C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\DscResources\MSFT_PackageResource\MSFT_PackageRe
    source.psm1 in force mode.
    VERBOSE: [2016-05-09T19:54:59] [VERBOSE] [WB01]:                            [DSCEngine] Importing the module 
    C:\Windows\system32\WindowsPowerShell\v1.0\Modules\PSDesiredStateConfiguration\DscResources\MSFT_ServiceResource\MSFT_ServiceRe
    source.psm1 in force mode.
    VERBOSE: [2016-05-09T19:54:59] [VERBOSE] [WB01]:                            [DSCEngine] Importing the module C:\Program 
    Files\WindowsPowerShell\Modules\xWebAdministration\1.10.0.0\DscResources\MSFT_xWebsite\MSFT_xWebsite.psm1 in force mode.
    VERBOSE: [2016-05-09T19:55:00] [VERBOSE] [WB01]: LCM:  [ Start  Resource ]  [[File]textfile]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ Start  Test     ]  [[File]textfile]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]:                            [[File]textfile] The system cannot find the file 
    specified.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]:                            [[File]textfile] The related file/directory is: 
    C:\dsc.txt.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ End    Test     ]  [[File]textfile]  in 0.0310 seconds.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ Start  Set      ]  [[File]textfile]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]:                            [[File]textfile] The system cannot find the file 
    specified.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]:                            [[File]textfile] The related file/directory is: 
    C:\dsc.txt.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ End    Set      ]  [[File]textfile]  in 0.0000 seconds.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ End    Resource ]  [[File]textfile]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ Start  Resource ]  [[File]HangfireDirectory]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ Start  Test     ]  [[File]HangfireDirectory]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]:                            [[File]HangfireDirectory] The system cannot find 
    the file specified.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]:                            [[File]HangfireDirectory] The related 
    file/directory is: C:\inetpub\wwwroot\Onf.Web.Hangfire.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ End    Test     ]  [[File]HangfireDirectory]  in 0.0150 seconds.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ Start  Set      ]  [[File]HangfireDirectory]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]:                            [[File]HangfireDirectory] The system cannot find 
    the file specified.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]:                            [[File]HangfireDirectory] The related 
    file/directory is: C:\inetpub\wwwroot\Onf.Web.Hangfire.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ End    Set      ]  [[File]HangfireDirectory]  in 0.0940 seconds.
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ End    Resource ]  [[File]HangfireDirectory]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ Start  Resource ]  [[WindowsFeature]IIS]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]: LCM:  [ Start  Test     ]  [[WindowsFeature]IIS]
    VERBOSE: [2016-05-09T19:55:01] [VERBOSE] [WB01]:                            [[WindowsFeature]IIS] Importing the module 
    MSFT_RoleResource in force mode.
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[WindowsFeature]IIS] The operation 
    'Get-WindowsFeature' started: Web-Server
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[WindowsFeature]IIS] The operation 
    'Get-WindowsFeature' succeeded: Web-Server
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ End    Test     ]  [[WindowsFeature]IIS]  in 1.3380 seconds.
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ Skip   Set      ]  [[WindowsFeature]IIS]
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ End    Resource ]  [[WindowsFeature]IIS]
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ Start  Resource ]  [[WindowsFeature]ApplicationInitialization]
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ Start  Test     ]  [[WindowsFeature]ApplicationInitialization]
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[WindowsFeature]ApplicationInitialization] 
    Importing the module MSFT_RoleResource in force mode.
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[WindowsFeature]ApplicationInitialization] The 
    operation 'Get-WindowsFeature' started: Web-AppInit
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[WindowsFeature]ApplicationInitialization] The 
    operation 'Get-WindowsFeature' succeeded: Web-AppInit
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ End    Test     ]  [[WindowsFeature]ApplicationInitialization]  in 
    0.2500 seconds.
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ Skip   Set      ]  [[WindowsFeature]ApplicationInitialization]
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ End    Resource ]  [[WindowsFeature]ApplicationInitialization]
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ Start  Resource ]  [[Script]DownloadWebDeploy]
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ Start  Test     ]  [[Script]DownloadWebDeploy]
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[Script]DownloadWebDeploy] Importing the module 
    MSFT_ScriptResource in force mode.
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ End    Test     ]  [[Script]DownloadWebDeploy]  in 0.0930 seconds.
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]: LCM:  [ Start  Set      ]  [[Script]DownloadWebDeploy]
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[Script]DownloadWebDeploy] Importing the module 
    MSFT_ScriptResource in force mode.
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[Script]DownloadWebDeploy] Performing the 
    operation "Set-TargetResource" on target "Executing the SetScript with the user supplied credential".
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[Script]DownloadWebDeploy] GET 
    http://download.microsoft.com/download/0/1/D/01DC28EA-638C-4A22-A57B-4CEF97755C6C/WebDeploy_amd64_en-US.msi with 0-byte 
    payload
    VERBOSE: [2016-05-09T19:55:02] [VERBOSE] [WB01]:                            [[Script]DownloadWebDeploy] received 5951488-byte 
    response of content type application/octet-stream
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]: LCM:  [ End    Set      ]  [[Script]DownloadWebDeploy]  in 0.7570 seconds.
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]: LCM:  [ End    Resource ]  [[Script]DownloadWebDeploy]
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]: LCM:  [ Start  Resource ]  [[Package]InstallWebDeploy]
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]: LCM:  [ Start  Test     ]  [[Package]InstallWebDeploy]
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Importing the module 
    MSFT_PackageResource in force mode.
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] 
    Validate-StandardArguments, Path was C:\WindowsAzure\WebDeploy_amd64_en-US.msi
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] The path extension was 
    .msi
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Parsing 
    {ED4CC1E5-043E-4157-8452-B5E533FE2BA1} as an identifyingNumber
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Parsed 
    {ED4CC1E5-043E-4157-8452-B5E533FE2BA1} as {ED4CC1E5-043E-4157-8452-B5E533FE2BA1}
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Ensure is Present
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] product installation 
    cannot be determined
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] product as boolean is 
    False
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] The package Microsoft 
    Web Deploy 3.6 is not installed
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]: LCM:  [ End    Test     ]  [[Package]InstallWebDeploy]  in 0.0930 seconds.
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]: LCM:  [ Start  Set      ]  [[Package]InstallWebDeploy]
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Importing the module 
    MSFT_PackageResource in force mode.
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] 
    Validate-StandardArguments, Path was C:\WindowsAzure\WebDeploy_amd64_en-US.msi
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] The path extension was 
    .msi
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Parsing 
    {ED4CC1E5-043E-4157-8452-B5E533FE2BA1} as an identifyingNumber
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Parsed 
    {ED4CC1E5-043E-4157-8452-B5E533FE2BA1} as {ED4CC1E5-043E-4157-8452-B5E533FE2BA1}
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Ensure is Present
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] product installation 
    cannot be determined
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] product as boolean is 
    False
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] The package Microsoft 
    Web Deploy 3.6 is not installed
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] 
    Validate-StandardArguments, Path was C:\WindowsAzure\WebDeploy_amd64_en-US.msi
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] The path extension was 
    .msi
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Parsing 
    {ED4CC1E5-043E-4157-8452-B5E533FE2BA1} as an identifyingNumber
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Parsed 
    {ED4CC1E5-043E-4157-8452-B5E533FE2BA1} as {ED4CC1E5-043E-4157-8452-B5E533FE2BA1}
    VERBOSE: [2016-05-09T19:55:03] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Package configuration 
    starting
    VERBOSE: [2016-05-09T19:55:06] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Starting 
    C:\Windows\system32\msiexec.exe with /i "C:\WindowsAzure\WebDeploy_amd64_en-US.msi" /quiet /quiet ADDLOCAL=ALL
    VERBOSE: [2016-05-09T19:55:06] [VERBOSE] [WB01]:                            [[Package]InstallWebDeploy] Starting process 
    C:\Windows\system32\msiexec.exe with arguments /i "C:\WindowsAzure\WebDeploy_amd64_en-US.msi" /quiet /quiet ADDLOCAL=ALL
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ End    Set      ]  [[Package]InstallWebDeploy]  in 265.9510 seconds.
    VERBOSE: [2016-05-09T19:59:29] Settings handler status to 'transitioning' 
    (C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\Status\0.status)
    VERBOSE: [2016-05-09T19:59:29] [ERROR] PowerShell DSC resource MSFT_PackageResource  failed to execute Set-TargetResource 
    functionality with error message: The return code 1603 was not expected. Configuration is likely not correct 
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ Start  Resource ]  [[Script]SetupWebDeploy]
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ Start  Test     ]  [[Script]SetupWebDeploy]
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]:                            [[Script]SetupWebDeploy] Importing the module 
    MSFT_ScriptResource in force mode.
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ End    Test     ]  [[Script]SetupWebDeploy]  in 0.0150 seconds.
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ Skip   Set      ]  [[Script]SetupWebDeploy]
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ End    Resource ]  [[Script]SetupWebDeploy]
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ Start  Resource ]  [[Service]StartWebDeploy]
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ Start  Test     ]  [[Service]StartWebDeploy]
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]:                            [[Service]StartWebDeploy] Importing the module 
    MSFT_ServiceResource in force mode.
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]:                            [[Service]StartWebDeploy] Startup type for service 
    'WMSVC' is 'Manual'. It does not match 'Automatic'.
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ End    Test     ]  [[Service]StartWebDeploy]  in 0.0630 seconds.
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]: LCM:  [ Start  Set      ]  [[Service]StartWebDeploy]
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]:                            [[Service]StartWebDeploy] Importing the module 
    MSFT_ServiceResource in force mode.
    VERBOSE: [2016-05-09T19:59:29] [VERBOSE] [WB01]:                            [[Service]StartWebDeploy] Service 'WMSVC' already 
    exists. Write properties such as Status, DisplayName, Description, Dependencies will be ignored for existing services.
    VERBOSE: [2016-05-09T19:59:32] [VERBOSE] [WB01]: LCM:  [ End    Set      ]  [[Service]StartWebDeploy]  in 2.4770 seconds.
    VERBOSE: [2016-05-09T19:59:32] [ERROR] PowerShell DSC resource MSFT_ServiceResource  failed to execute Set-TargetResource 
    functionality with error message: Failure starting service 'WMSVC'. Please check the path 
    'C:\Windows\system32\inetsrv\wmsvc.exe' provided for the service. Message: 'Exception calling "WaitForStatus" with "2" 
    argument(s): "Time out has expired and the operation has not been completed."' 
    VERBOSE: [2016-05-09T19:59:32] [VERBOSE] [WB01]: LCM:  [ Start  Resource ]  [[xWebsite]CompanySite]
    VERBOSE: [2016-05-09T19:59:32] [VERBOSE] [WB01]: LCM:  [ Start  Test     ]  [[xWebsite]CompanySite]
    VERBOSE: [2016-05-09T19:59:32] [VERBOSE] [WB01]:                            [[xWebsite]CompanySite] Importing the module 
    MSFT_xWebsite in force mode.
    VERBOSE: [2016-05-09T19:59:36] [VERBOSE] [WB01]:                            [[xWebsite]CompanySite] The Ensure state for 
    website "hangfire.onfulfillment.com" does not match the desired state.
    VERBOSE: [2016-05-09T19:59:36] [VERBOSE] [WB01]:                            [[xWebsite]CompanySite] The target resource is not 
    in the desired state.
    VERBOSE: [2016-05-09T19:59:36] [VERBOSE] [WB01]: LCM:  [ End    Test     ]  [[xWebsite]CompanySite]  in 3.6200 seconds.
    VERBOSE: [2016-05-09T19:59:36] [VERBOSE] [WB01]: LCM:  [ Start  Set      ]  [[xWebsite]CompanySite]
    VERBOSE: [2016-05-09T19:59:36] [VERBOSE] [WB01]:                            [[xWebsite]CompanySite] Importing the module 
    MSFT_xWebsite in force mode.
    VERBOSE: [2016-05-09T19:59:36] [VERBOSE] [WB01]:                            [[xWebsite]CompanySite] Performing the operation 
    "Set Item" on target "Item: ConfirmPreference Value: High".
    VERBOSE: [2016-05-09T19:59:38] [VERBOSE] [WB01]: LCM:  [ End    Set      ]  [[xWebsite]CompanySite]  in 2.9560 seconds.
    VERBOSE: [2016-05-09T19:59:38] [ERROR] PowerShell DSC resource MSFT_xWebsite  failed to execute Set-TargetResource 
    functionality with error message: Failure to add certificate to web binding. Please make sure that the certificate thumbprint 
    "?XXXXXXX" is valid. Error: "Value does not fall within the expected range.". 
    VERBOSE: [2016-05-09T19:59:38] [VERBOSE] [WB01]: LCM:  [ End    Set      ]
    VERBOSE: [2016-05-09T19:59:38] [ERROR] The SendConfigurationApply function did not succeed.
    VERBOSE: [2016-05-09T19:59:38] [VERBOSE] Operation 'Invoke CimMethod' complete.
    VERBOSE: [2016-05-09T19:59:38] [VERBOSE] Time taken for configuration job to complete is 280.052 seconds
    VERBOSE: [2016-05-09T19:59:39] Settings handler status to 'transitioning' 
    (C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\Status\0.status)
    VERBOSE: [2016-05-09T19:59:39] Updating execution status (HKLM:\SOFTWARE\Microsoft\Azure\DSC\ExecutionStatus)
    VERBOSE: [2016-05-09T19:59:39] DSC configuration completed.
    VERBOSE: [2016-05-09T19:59:39] Removing meta.mof and mof files...
    VERBOSE: [2016-05-09T19:59:39] Resetting metaconfiguration...
    0
    VERBOSE: [2016-05-09T19:59:39] Settings handler status to 'error' 
    (C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\Status\0.status)
    VERBOSE: [2016-05-09T19:59:40] Loading Event Source assembly for telemetry...
    VERBOSE: [2016-05-09T19:59:40] [Telemetry] Invoking [Configuration][End] event for telemetry.[Status]: Failure
    VERBOSE: [2016-05-09T19:59:40] Updating execution status (HKLM:\SOFTWARE\Microsoft\Azure\DSC\ExecutionStatus)
    VERBOSE: [2016-05-09T19:59:40] Transitioning to Completed state ...
    VERBOSE: [2016-05-09T19:59:40] Removing file 
    C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\bin\..\DSCWork\ExtensionHandler.Lock.0.dsc
    VERBOSE: [2016-05-09T19:59:40] Removing file 
    C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\bin\..\DSCWork\ExtensionHandler.Lock.dsc

以上脚本来自较旧的部署(dsc 工件已更改)

最后,zip 文件引用似乎总是指向每次部署时的相同位置:

{
  "runtimeSettings": [
    {
      "handlerSettings": {
        "protectedSettingsCertThumbprint": "XXXXXXXXXXXX",
        "protectedSettings": "XXXXXXX",
        "publicSettings": {"wmfVersion":"latest","modulesUrl":"https://XXXXXX.blob.core.windows.net/onf-storage-hangfire-artifacts/DSC6451f1662.zip","sasToken":"?sv=2015-04-05&sr=c&sig=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX%3D&se=2016-05-09T23%3A52%3A43Z&sp=r","configurationFunction":"ConfigureWebServer.ps1\\Main","properties":{}}
      }
    }
  ]
}

目前唯一成功的选择是移除虚拟机并从头开始

想法?提前致谢!

【问题讨论】:

  • 您要针对已经运行的虚拟机部署它?我认为这不会起作用,它可能会检查 VM 的存在并考虑部署的整个事情。 (我可能是错的,我从未尝试过这样的配置,但听起来很可能)
  • 我可能是错的,但我认为 DSC 的目的是根据需要运行它多次,因为我们正在恢复状态

标签: powershell azure azure-resource-manager dsc


【解决方案1】:

每次部署此模板时,您都必须更新“forceUpdateTag”的值,否则该请求将被忽略。如果您每次都更新“forceUpdateTag”但仍然没有发生任何事情,请从 VM 收集日志并共享它。日志收集工具可用@https://github.com/PowerShell/xDscDiagnostics

【讨论】:

  • 很快就会尝试这个——我已经用 DSC 文件名更改的结果更新了我的原始问题。现在它运行正确的 DSC 工件,我将尝试您建议的答案!
  • 发布了我的结果...非常感谢您的时间!
【解决方案2】:

已修复!找到一个与脚本扩展相关的论坛帖子,而不是重新处理。这是解决方案。将 VM 规模集属性 upgradePolicy 更改为 Automatic。 How to force VM created with an ARM template + CustomScriptExtension to redownload the script and run it?

 "properties": {
    "overprovision": "true",
    "upgradePolicy": {
      "mode": "Automatic"
    },

【讨论】:

  • 感谢您的帖子——不幸的是,我无法轻松地重新创建我的原始问题,因为它需要对安装了 DSC 扩展的机器进行映像。我发布的答案包含有关如何删除扩展程序然后创建 VM 映像的说明;我很想看看机器是否可以在安装了 DSC 的情况下进行成像,并让它遵守这个设置。如果我有机会测试此解决方案,我肯定会回来并将其标记为答案(将其作为参数传递要比在未安装 DSC 扩展的情况下重新映像 VM 容易得多)跨度>
【解决方案3】:

发现问题。

似乎捕获已安装 DSC 扩展的服务器是问题的根源

解决 dsc 扩展设置的步骤如下:

1) 通过运行卸载 DSC 扩展 C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\bin\uninstall.cmd

注意:编辑了 cmd 文件(下面的 rem 行),因为它正在 cd'ing 到错误的文件夹:

@echo off
rem 
rem Uninstall is a no-op for the DSC extension.
rem

rem if exist %CD%\bin_dev (
rem    set bin_root=%CD%\bin_dev
rem ) else (
rem    set bin_root=%CD%\bin
rem )

set bin_root=%CD%


echo Cleaning up registry key - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Azure\DSC\ExecutionStatus

@echo on
powershell.exe -NoProfile -NonInteractive -ExecutionPolicy RemoteSigned -File %bin_root%\uninstall.ps1 < nul

echo Uninstall completed.

2) 清除 C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\RuntimeSettings\0.settings 文件

3) 重新抓机,重新部署模板

值得注意的是,forceUpdateTag 现在可以按预期工作了 :)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-15
    • 2020-03-09
    • 2023-03-07
    • 2012-08-04
    相关资源
    最近更新 更多