Hello,
I have being experiencing some issues while performing windows updates in a
azure-arm type builder. from VSTS
I am using the windows-updates provisioner
My template:
{
"variables": {
"client_id": "{{env `CLIENT_ID`}}",
"client_secret": "{{env `CLIENT_SECRET`}}",
"resource_group": "{{env `RESOURCE_GROUP`}}",
"storage_account": "{{env `STORAGE_ACCOUNT`}}",
"subscription_id": "{{env `SUBSCRIPTION_ID`}}",
"vm_size": "{{env `VM_SIZE`}}",
"saPwd": "{{env `SA_PWD`}}",
"admin_username": "{{env `ADMIN_USERNAME`}}",
"location": "{{env `LOCATION`}}",
"script_folder": "{{env `SCRIPT_FOLDER`}}"
},
"builders": [
{
"type": "azure-arm",
"client_id": "{{user `client_id`}}",
"client_secret": "{{user `client_secret`}}",
"resource_group_name": "{{user `resource_group`}}",
"storage_account": "{{user `storage_account`}}",
"subscription_id": "{{user `subscription_id`}}",
"capture_container_name": "custom-vhd-images",
"capture_name_prefix": "packer",
"os_type": "Windows",
"image_publisher": "microsoftvisualstudio",
"image_offer": "Windows",
"image_sku": "Win7-SP1-Ent-N-x64",
"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_timeout": "4h",
"winrm_username": "{{user `admin_username`}}",
"vm_size": "{{user `vm_size`}}",
"location": "{{user `location`}}"
}
],
"provisioners": [
{
"type": "powershell",
"script": "{{user `script_folder`}}\\installChocolatey.ps1"
},
{
"type": "powershell",
"elevated_user": "{{user `admin_username`}}",
"elevated_password": "{{.WinRMPassword}}",
"inline": [
"choco install dotnet3.5 -f -y"
]
},
{
"type": "windows-restart",
"restart_check_command": "powershell -command \"& {Write-Output
'restarted.'}\""
},
{
"type": "powershell",
"elevated_user": "{{user `admin_username`}}",
"elevated_password": "{{.WinRMPassword}}",
"inline": [
"choco install mssqlserver2014express -f -y -ia \"/SAPWD={{user
`saPwd`}} /SECURITYMODE=SQL /TCPENABLED=1 /NPENABLED=1\""
]
},
{
"type": "powershell",
"inline": [
"choco install -y sql-server-management-studio"
]
},
{
"type": "windows-restart",
"restart_check_command": "powershell -command \"& {Write-Output
'restarted.'}\""
},
{
"type": "powershell",
"elevated_user": "{{user `admin_username`}}",
"elevated_password": "{{.WinRMPassword}}",
"script": "{{user `script_folder`}}\\setupIIS-win7.ps1"
},
{
"type": "windows-restart",
"restart_check_command": "powershell -command \"& {Write-Output
'restarted.'}\""
},
{
"type": "windows-update"
},
{
"type": "windows-restart",
"restart_check_command": "powershell -command \"& {Write-Output
'restarted.'}\""
},
{
"type": "powershell",
"elevated_user": "{{user `admin_username`}}",
"elevated_password": "{{.WinRMPassword}}",
"script": "{{user `script_folder`}}\\disableUAC.ps1"
},
{
"type": "windows-restart",
"restart_check_command": "powershell -command \"& {Write-Output
'restarted.'}\""
},
{
"type": "powershell",
"inline": [
"if( Test-Path
$Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm
$Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}",
"& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize
/quiet /quit",
"while($true) { $imageState = Get-ItemProperty
HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select
ImageState; if($imageState.ImageState -ne
'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output
$imageState.ImageState; Start-Sleep -s 10 } else { break } }"
]
}
]
}
And the output log
2018-10-23T20:32:14.7905517Z ==> azure-arm: Uploading the Windows update
script...
2018-10-23T20:32:14.7906403Z
2018-10-23T20:32:14.7908032Z ##[debug]Parsing log line to extract output...
2018-10-23T20:32:14.7909748Z ##[debug]/*************************************
2018-10-23T20:32:14.7910987Z ##[debug]==> azure-arm: Uploading the Windows
update script...
2018-10-23T20:32:14.7912825Z
##[debug]**************************************/
2018-10-23T20:32:14.7914354Z ##[debug]Match start index: -1
2018-10-23T20:32:14.7915283Z ##[debug]Match start index: -1
2018-10-23T20:32:16.2075867Z ==> azure-arm: Running Windows update...
2018-10-23T20:32:16.2077598Z
2018-10-23T20:32:16.2080447Z ##[debug]Parsing log line to extract output...
2018-10-23T20:32:16.2082223Z ##[debug]/*************************************
2018-10-23T20:32:16.2084156Z ##[debug]==> azure-arm: Running Windows
update...
2018-10-23T20:32:16.2085004Z
##[debug]**************************************/
2018-10-23T20:32:16.2085701Z ##[debug]Match start index: -1
2018-10-23T20:32:16.2086333Z ##[debug]Match start index: -1
2018-10-23T20:32:19.2184093Z azure-arm: Searching for Windows updates...
2018-10-23T20:32:19.2185206Z
2018-10-23T20:32:19.2186927Z ##[debug]Parsing log line to extract output...
2018-10-23T20:32:19.2187901Z ##[debug]/*************************************
2018-10-23T20:32:19.2188658Z ##[debug] azure-arm: Searching for Windows
updates...
2018-10-23T20:32:19.2189392Z
##[debug]**************************************/
2018-10-23T20:32:19.2190063Z ##[debug]Match start index: -1
2018-10-23T20:32:19.2190682Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5204768Z azure-arm: Found Windows update
(2018-10-21; 12.23 MB): Definition Update for Windows Defender Antivirus -
KB915597 (Definition 1.279.208.0)
2018-10-23T20:45:21.5206270Z
2018-10-23T20:45:21.5209639Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5210906Z ##[debug]/*************************************
2018-10-23T20:45:21.5212063Z ##[debug] azure-arm: Found Windows update
(2018-10-21; 12.23 MB): Definition Update for Windows Defender Antivirus -
KB915597 (Definition 1.279.208.0)
2018-10-23T20:45:21.5214402Z
##[debug]**************************************/
2018-10-23T20:45:21.5217163Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5219803Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5221042Z azure-arm: Downloading Windows updates (1
updates; 12.23 MB)...
2018-10-23T20:45:21.5222320Z
2018-10-23T20:45:21.5224214Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5227315Z ##[debug]/*************************************
2018-10-23T20:45:21.5228252Z ##[debug] azure-arm: Downloading Windows
updates (1 updates; 12.23 MB)...
2018-10-23T20:45:21.5229103Z
##[debug]**************************************/
2018-10-23T20:45:21.5230713Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5232247Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5245172Z azure-arm: ERROR: Value does not fall
within the expected range.
2018-10-23T20:45:21.5246892Z
2018-10-23T20:45:21.5248789Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5250076Z ##[debug]/*************************************
2018-10-23T20:45:21.5251675Z ##[debug] azure-arm: ERROR: Value does not
fall within the expected range.
2018-10-23T20:45:21.5253588Z
##[debug]**************************************/
2018-10-23T20:45:21.5255093Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5259920Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5260717Z azure-arm: ERROR: at <ScriptBlock>,
C:\Windows\Temp\packer-windows-update.ps1: line 195
2018-10-23T20:45:21.5261089Z
2018-10-23T20:45:21.5261836Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5262784Z ##[debug]/*************************************
2018-10-23T20:45:21.5263606Z ##[debug] azure-arm: ERROR: at
<ScriptBlock>, C:\Windows\Temp\packer-windows-update.ps1: line 195
2018-10-23T20:45:21.5264376Z
##[debug]**************************************/
2018-10-23T20:45:21.5265052Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5265707Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5270011Z azure-arm: ERROR: at <ScriptBlock>, <No
file>: line 1
2018-10-23T20:45:21.5271587Z
2018-10-23T20:45:21.5275738Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5276489Z ##[debug]/*************************************
2018-10-23T20:45:21.5277242Z ##[debug] azure-arm: ERROR: at
<ScriptBlock>, <No file>: line 1
2018-10-23T20:45:21.5277956Z
##[debug]**************************************/
2018-10-23T20:45:21.5278633Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5279277Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5280139Z azure-arm: ERROR EXCEPTION:
System.ArgumentException: Value does not fall within the expected range.
2018-10-23T20:45:21.5280555Z
2018-10-23T20:45:21.5281178Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5281886Z ##[debug]/*************************************
2018-10-23T20:45:21.5282866Z ##[debug] azure-arm: ERROR EXCEPTION:
System.ArgumentException: Value does not fall within the expected range.
2018-10-23T20:45:21.5283725Z
##[debug]**************************************/
2018-10-23T20:45:21.5284364Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5285013Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5293468Z azure-arm: ERROR EXCEPTION: at
System.Management.Automation.ComInterop.ComRuntimeHelpers.CheckThrowException(Int32
hresult, ExcepInfo& excepInfo, ComMethodDesc method, Object[] args, UInt32
argErr)
2018-10-23T20:45:21.5294186Z
2018-10-23T20:45:21.5296101Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5301994Z ##[debug]/*************************************
2018-10-23T20:45:21.5305442Z ##[debug] azure-arm: ERROR EXCEPTION: at
System.Management.Automation.ComInterop.ComRuntimeHelpers.CheckThrowException(Int32
hresult, ExcepInfo& excepInfo, ComMethodDesc method, Object[] args, UInt32
argErr)
2018-10-23T20:45:21.5306602Z
##[debug]**************************************/
2018-10-23T20:45:21.5308554Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5309579Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5310198Z azure-arm: ERROR EXCEPTION: at
CallSite.Target(Closure , CallSite , ComObject , Int32 )
2018-10-23T20:45:21.5310596Z
2018-10-23T20:45:21.5311205Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5311908Z ##[debug]/*************************************
2018-10-23T20:45:21.5313031Z ##[debug] azure-arm: ERROR EXCEPTION: at
CallSite.Target(Closure , CallSite , ComObject , Int32 )
2018-10-23T20:45:21.5313864Z
##[debug]**************************************/
2018-10-23T20:45:21.5314530Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5315175Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5315804Z azure-arm: ERROR EXCEPTION: at
System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site,
T0 arg0, T1 arg1)
2018-10-23T20:45:21.5316220Z
2018-10-23T20:45:21.5316844Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5318080Z ##[debug]/*************************************
2018-10-23T20:45:21.5318997Z ##[debug] azure-arm: ERROR EXCEPTION: at
System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site,
T0 arg0, T1 arg1)
2018-10-23T20:45:21.5319853Z
##[debug]**************************************/
2018-10-23T20:45:21.5320522Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5321163Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5321802Z azure-arm: ERROR EXCEPTION: at
System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site,
T0 arg0, T1 arg1)
2018-10-23T20:45:21.5322319Z
2018-10-23T20:45:21.5322921Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5323617Z ##[debug]/*************************************
2018-10-23T20:45:21.5324481Z ##[debug] azure-arm: ERROR EXCEPTION: at
System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site,
T0 arg0, T1 arg1)
2018-10-23T20:45:21.5325581Z
##[debug]**************************************/
2018-10-23T20:45:21.5326810Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5328074Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5333559Z azure-arm: ERROR EXCEPTION: at
System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame
frame)
2018-10-23T20:45:21.5334381Z
2018-10-23T20:45:21.5335451Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5336181Z ##[debug]/*************************************
2018-10-23T20:45:21.5337056Z ##[debug] azure-arm: ERROR EXCEPTION: at
System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame
frame)
2018-10-23T20:45:21.5338218Z
##[debug]**************************************/
2018-10-23T20:45:21.5338896Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5339540Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5348675Z azure-arm: ERROR EXCEPTION: at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
2018-10-23T20:45:21.5349238Z
2018-10-23T20:45:21.5353962Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5355037Z ##[debug]/*************************************
2018-10-23T20:45:21.5360233Z ##[debug] azure-arm: ERROR EXCEPTION: at
System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame
frame)
2018-10-23T20:45:21.5361250Z
##[debug]**************************************/
2018-10-23T20:45:21.5362010Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5362735Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5371153Z ==> azure-arm:
2018-10-23T20:45:21.5371778Z
2018-10-23T20:45:21.5373094Z ##[debug]Parsing log line to extract output...
2018-10-23T20:45:21.5374259Z ##[debug]/*************************************
2018-10-23T20:45:21.5375181Z ##[debug]==> azure-arm:
2018-10-23T20:45:21.5376344Z
##[debug]**************************************/
2018-10-23T20:45:21.5377255Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5378069Z ##[debug]Match start index: -1
2018-10-23T20:45:21.5379918Z ==> azure-arm: Cleanup requested, deleting
resource group ...
2018-10-23T20:45:21.5383580Z
--
This mailing list is governed under the HashiCorp Community Guidelines -
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of
those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/packer-tool/2d075474-9a3a-439e-988f-750f402cf756%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.