Azure / Azure/azvmimagebuilder
Deprovisioning failures
- Dominant language
- PowerShell
- Stars
- 111
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
I'm getting the following error in the deprovisioning phase of my Windows image:
```
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: Write-Output '>>> Waiting for GA Service (RdAgent) to start ...'
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: Write-Output '>>> Waiting for GA Service (WindowsAzureTelemetryService) to start ...'
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: while ((Get-Service WindowsAzureTelemetryService) -and ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running')) { Start-Sleep -s 5 }
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: Write-Output '>>> Waiting for GA Service (WindowsAzureGuestAgent) to start ...'
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: Write-Output '>>> Sysprepping VM ...'
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: if( Test-Path $Env:SystemRoot\system32\Sysprep\unattend.xml ) {
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: Remove-Item $Env:SystemRoot\system32\Sysprep\unattend.xml -Force
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: }
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: & $Env:SystemRoot\System32\Sysprep\Sysprep.exe /oobe /generalize /quiet /quit
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: while($true) {
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: $imageState = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\State).ImageState
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: Write-Output $imageState
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: if ($imageState -eq 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { break }
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: Start-Sleep -s 5
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: }
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: Write-Output '>>> Sysprep complete ...'
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: >>> Waiting for GA Service (RdAgent) to start ...
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: >>> Waiting for GA Service (WindowsAzureTelemetryService) to start ...
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: >>> Waiting for GA Service (WindowsAzureGuestAgent) to start ...
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: >>> Sysprepping VM ...
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: IMAGE_STATE_COMPLETE
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT ==> azure-arm: Get-Service : Cannot find any service with service name 'WindowsAzureTelemetryService'.
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT ==> azure-arm: At C:\DeprovisioningScript.ps1:4 char:9
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT ==> azure-arm: + while ((Get-Service WindowsAzureTelemetryService) -and ((Get-Service ...
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT ==> azure-arm: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT ==> azure-arm: + CategoryInfo : ObjectNotFound: (WindowsAzureTelemetryService:String) [Get-Service], ServiceCommandExcep
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT ==> azure-arm: tion
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT ==> azure-arm: + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT ==> azure-arm:
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: IMAGE_STATE_UNDEPLOYABLE
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: IMAGE_STATE_UNDEPLOYABLE
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: IMAGE_STATE_UNDEPLOYABLE
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: IMAGE_STATE_UNDEPLOYABLE
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: IMAGE_STATE_UNDEPLOYABLE
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: IMAGE_STATE_UNDEPLOYABLE
[0ca7f19d-2eb3-4405-a951-1f0fe5139a0d] PACKER OUT azure-arm: IMAGE_STATE_UNDEPLOYABLE
```
Relevant info from my template includes:
```
...
"vmProfile": {
"vmSize": "Standard_D2_v5",
"osDiskSizeGB": 200
},
"source": {
"type": "PlatformImage",
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2022-Datacenter",
"version": "latest"
},
"customize": [
{
"type": "PowerShell",
"name": "Setup",
"runElevated": true,
"scriptUri": "https://myimages.blob.core.windows.net/image-setup-scripts/windows_jumpbox_vmss_setup.ps1"
},
{
"type": "WindowsRestart",
"restartCheckCommand": "echo Azure-Image-Builder-Restarted-the-VM > c:\\buildArtifacts\\azureImageBuilderRestart.txt",
"restartTimeout": "5m"
},
{
"type": "PowerShell",
"name": "settingUpMgmtAgtPath",
"runElevated": false,
"inline": [
"mkdir c:\\buildActions",
"echo Azure-Image-Builder-Was-Here > c:\\buildActions\\buildActionsOutput.txt"
]
},
{
"type": "WindowsUpdate",
"searchCriteria": "IsInstalled=0",
"filters": [
"exclude:$_.Title -like '*Preview*'",
"include:$true"
],
"updateLimit": 20
}
],
...
```
Is there anything obvious I'm missing here? I took the customization steps from the Windows Managed Image template, and customized the setup script. My setup script runs without error.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.