i am following official document - https://docs.microsoft.com/en-us/azure/virtual-machines/windows/build-image-with-packer
My win2016.json here. increased "winrm_timeout": "20m",
{
"builders": [{
"type": "azure-arm",
"subscription_id": "XXXXXXX,
"client_id": "XXXXXXXX",
"client_secret": "XXXXXXXXXXXXXXX",
"tenant_id": "4XXXXXXXXXXXXXX",
"managed_image_resource_group_name": "myResourceGroup",
"build_resource_group_name": "myResourceGroup",
"managed_image_name": "PackerImagewin2016",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2016-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": true,
"winrm_insecure": true,
"winrm_timeout": "20m",
"winrm_username": "packer",
"vm_size": "Standard_DS2_v2"
}],
"provisioners": [{
"type": "powershell",
"inline": [
"Add-WindowsFeature Web-Server",
"& $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 } }"
]
}]
}
logs
==> azure-arm: Getting the VM's IP address ...
==> azure-arm: -> ResourceGroupName : 'myResourceGroup'
==> azure-arm: -> PublicIPAddressName : 'pkrip56bb0okjgdgdgddg0tes'
==> azure-arm: -> NicName : 'pkrni56bb0ojkgsdgdjgdhk0tes'
==> azure-arm: -> Network Connection : 'PublicEndpoint'
==> azure-arm: -> IP Address : '41.134.45.20'
==> azure-arm: Waiting for WinRM to become available...
==> azure-arm: Timeout waiting for WinRM.
==> azure-arm:
==> azure-arm: The resource group was not created by Packer, deleting individual resources ...
==> azure-arm: -> Deployment: pkrdp56bb0ojdggjgsg0tes
==> azure-arm: -> Microsoft.Compute/virtualMachines : 'pkrvm56bb0cbxcxo0tes'
==> azure-arm: -> Microsoft.Network/networkInterfaces : 'pkrni56bvvvgvxgvb0o0tes'
==> azure-arm: -> Microsoft.Network/virtualNetworks : 'pkrvn56bb0o0tejkvjfhfjkfs'
==> azure-arm: -> Microsoft.Network/publicIPAddresses : 'pkrip56bb0o0tefjgfjfgfs'
==> azure-arm: -> Microsoft.Compute/disks : '/subscriptions/XXXXXXXXXX/resourceGroups/myResourceGroup/providers/Microsoft.Compute/disks/pkros56bbdjgkdggddjdgdj0o0tes'
==> azure-arm:
==> azure-arm: The resource group was not created by Packer, deleting individual resources ...
==> azure-arm: Could not retrieve OS Image details
==> azure-arm: -> Deployment: kvpkrdp56bb0o0tes
==> azure-arm: -> Microsoft.KeyVault/vaults/secrets : 'pkr5uxvtyskvdbnvs/packerKeyVaultSecret'
==> azure-arm: -> Microsoft.KeyVault/vaults : 'pkrkv59derla0tmo0tes'
==> azure-arm: -> : ''
==> azure-arm: Error deleting resource. Please delete manually.
==> azure-arm:
==> azure-arm: Name:
==> azure-arm: Error: Unable to parse path of image
==> azure-arm:
==> azure-arm: The resource group was not created by Packer, not deleting ...
Build 'azure-arm' errored: Timeout waiting for WinRM.
==> Some builds didn't complete successfully and had errors:
--> azure-arm: Timeout waiting for WinRM.
==> Builds finished but no artifacts were created.
Same code working for 2019-Datacenter
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@sanchetanparmar , Could you please share the document that you are referring to.
@DashleenBhandari-MSFT i am referring - https://docs.microsoft.com/en-us/azure/virtual-machines/windows/build-image-with-packer
i can see other facing same issue - https://github.com/MicrosoftDocs/azure-docs/issues/31188#issuecomment-566506282
@sanchetanparmar Can you follow the suggestion from this comment https://github.com/hashicorp/packer/issues/8093#issuecomment-530079184
And let us know if that solved your problem or not
@jakaruna-MSFT Tried that as well, didn't work for me.
Please note, the exact same packer config with "image_sku": "2019-Datacenter", works just fine. This issue only appears to happen in the 2016-Datacenter sku. I've tried with 2016-datacenter-server-core, this also works without issues.
This is happening both through Azure Devops as well as on my own laptop.
@jakaruna-MSFT No its not working with 2016-Datacenter as i can see that in win2019 WinRM enable default, which is not in 2016
Tried with custom_data_file": file.ps1
where in file.ps1 Enable-PSRemoting -Force
but not working. how can i pass custom date while temp. vm booting ? it's working with AWS.
If you create manage image from vm where WinRM enable, store in SIG with version and then you can use SIG old version to create new version.
Above code working for 2012-R2-Datacenter
and 2016-Datacenter-Server-Core
but not for 2016-Datacenter
2016-Datacenter
==> azure-arm: Waiting for WinRM to become available...
==> azure-arm: Timeout waiting for WinRM.
@sanchetanparmar Thanks for checking with multiple versions.
I will escalate this to the product teams and update you when i have some information.
@cynthn Please add your comments
I am getting same timeout for 2019-Datacenter.
==> azure-arm: Waiting for WinRM to become available...
==> azure-arm: Timeout waiting for WinRM.
These are my communicator configs.
"type": "azure-arm",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2016-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_timeout": "10m",
"winrm_username": "packer",
I verified that I can ping the target vm from the machine where packer is running.
do the default firewall rules on 2019-Datacenter block winrm?
@pmozbert please change -"image_sku": "2019-Datacenter",
it will work for 2019, facing issue only with "image_sku":"2016-Datacenter"
@danielsollondon Daniel, do you know who could help with a Packer issue?
Hi, I tested this with packer 1.4.5 and 1.5.0, with the config below, I could get a successful build, it was using this version: 14393.3326.1911120150
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2016-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": true,
"winrm_insecure": true,
"winrm_timeout": "15m",
"winrm_username": "packer",
"vm_size": "Standard_D1_v2"
@sanchetanparmar - can you retest with this config, also can you let me know the region you are testing in please?
@danielsollondon used above config but same error ==> azure-arm: Timeout waiting for WinRM..
testing in Southeast Asia tried in us-east and west-us too
Hi, sorry for the delay, we have been doing further investigation with the Windows PG, we have found an issue when using Standard_D1_v2 and the Nov/Dev WinSvr 2016 images, which is mitigated by increasing the vm size to Standard_D2_v2, I am waiting for details on the solution. But I am not convinced this is your issue, I have tried to repro this issue a few times, but cannot get it to repro, but I want to help. Can you drop me an email [email protected], as I would like to review your full packer config. thanks!
Hi @danielsollondon,
I'm also experiencing the WinRM timeout issue with Windows Server 2016 and Windows Server 2019 images. This WinRM behaviour is very random, some times causing timeout issues and other times is work like a charm.
Just to put some more context into this, my packer template includes the following settings below:
"communicator": "winrm",
"winrm_use_ssl": true,
"winrm_insecure": true,
"winrm_timeout": "1h",
"winrm_username": "packer",
"location": "Southeast Asia",
"vm_size": "Standard_DS2_v2"
I can provide you a detail packer debug log file to your [email protected] email if you are able to assist in resolving this with Windows PG.
Hi @danielsollondon and @kiazhi,
I am facing the exact same issue. It worked for me a couple of days ago when I changed the "winrm_timeout" value to "20m" from "10m", but then again it only worked for me once.
Today, I have completed removed the "winrm_timeout" from my packer code and was successful in creating the image, tested it for both 2016 and 2019 Windows Server DC edition (Azure Marketplace).
You can give it a try and see if this can fix the issue for you.
@danielsollondon Having the issue (again. went "ok" yesterday) following settings:
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2016-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": true,
"winrm_insecure": true,
"winrm_timeout": "15m",
"winrm_username": "packer",
"location": "westeurope",
"vm_size": "Standard_D16s_v3",
The Azure Devops output gives this:
==> azure-arm: Not waiting for Resource Group delete as requested by user. Resource Group Name is packer-Resource-Group-ftfy0bchbe
Build 'azure-arm' errored: Timeout waiting for WinRM.
==> Some builds didn't complete successfully and had errors:
--> azure-arm: Timeout waiting for WinRM.
==> Builds finished but no artifacts were created.
Hello,
This issue is hitting our builds randomly too. We run Packer inside Azure DevOps pipelines with the following config:
"builders": [
{
"type": "azure-arm",
<authorization options removed>
"managed_image_resource_group_name": "{{user `rg_name`}}",
"managed_image_name": "<image_name_removed>",
"managed_image_storage_account_type": "Premium_LRS",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2016-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_timeout": "4h",
"winrm_username": "packer",
"virtual_network_name": "VNet_name_removed",
"virtual_network_subnet_name": "default",
"virtual_network_resource_group_name": "{{user `rg_name`}}",
"location": "eastus",
"vm_size": "Standard_D16s_v3",
"os_disk_size_gb": "512"
}
]
I spent a lot of time trying to debug it and the only thing I found is broken WinRM cert on a temp machine. If I run Test-WSMan -ComputerName temp_vm_name -usessl
against the broken temp machine it shows the following error:
_The server certificate on the
destination computer (30.0.0.133:5986) has the following errors:
Encountered an internal error in the SSL library._
If I run the same command against the temp machine which was able to connect, there is no error like this. Also I found that I can make the temp machine works by generating a self-signed cert on it and reconfiguring WinRM listener with a new cert. Here are the steps:
• Set a huge WinRM timeout in Packer config to have enough time for the next steps
• Grab the temp machine name from the Packer log, keep the build running
• Find the temp machine on the Azure portal and execute the following via Run Command
$Cert = New-SelfSignedCertificate -CertstoreLocation Cert:\LocalMachine\My -DnsName "$env:COMPUTERNAME"
Remove-Item -Path WSMan:\Localhost\listener\listener* -Recurse
New-Item -Path WSMan:\LocalHost\Listener -Transport HTTPS -Address * -CertificateThumbPrint $Cert.Thumbprint -Force
Stop-Service winrm
Start-Service winrm
• After this Packer will be able to connect to the temp machine
I assume that running this script on the temp machine as a startup script or applying it as an Azure extension can resolve the issue, but unfortunately Packer don't provide a way to configure startup scripts / azure extensions in azure-arm builder (or I can't find how to do it).
Issue with current marketplace image.
If you create win-2019 vm, by default
get-Service winrm
will show enable but not the same case with 2016-datacenter.
I have created VM from portal and checked,
WinRm disabled by default in 2016-datacenter, Enabled in 2019.
Please check and verify
Unfortunately switching to win-2019 is not an option for us. Also I believe Packer configures WinRM during temp VM provisioning. The issue is intermittent, sometimes Packer is able to connect to temp VM so I believe the issue is not in marketplace image.
@AlexeyKarpushin I tried your workaround, and indeed now the build continues to run. I had set the winrm_timeout to 90m to test, but even that gave me nothing. I was trying echo y |winrm quickconfig too, but no luck. Your PowerShell code immediately made the deployment go on!
However, I don't get why I was able to start the same build yesterday, which (after about 12 minutes waiting) went on just fine by itself.
We are working to identify the correct team to have this investigated. We will provide updates on this issue here as we have them.
The Engineering team is aware of this issue and are working to identify the root cause of the problem. I do not have an ETA on when it will be resolved. That being said I am following up and based on the ETA we can update the documentation to use 2019 and add a note about Server 2016 or if the ETA is fairly short, we will provide it here and leave the doc as is.
In the meantime, if you are following this tutorial, it is suggested to modify the template to use either Server 2012 or 2019. It appears users are not seeing the same issue with these versions of Windows.
I think same issue started happening just now but for 2019-Datacenter, exactly the same as for 2016-Datacenter, in both cases I was testing the entire morning and in the afternoon it stopped working, around the same time (between 2pm and 3pm UK time).
I have an Azure Pipeline that runs the packer to generate the image, even running the same release that failed because one of the provisioners is being tested, it is no longer able to connect the WinRM.
My last successful run that was able to connect to WinRM was 2020-02-07T14:04:37 (UK Time)
The next one I ran and after this it is not connecting anymore was around 2020-02-07T15:01:53 (UK Time)
Don't know if it's useful but the resource group where the packer build is executing is in North Europe.
I would like to know if someone can confirm this.
@mimckitt can you please pass along this to the team and ask them if there was any recent change to the base image today.
Thanks
Hi All, I'm a Program Manager for the Azure VM image builder (which uses Packer under the hood), we have seen this too with Win2016 from images after October, and we have engaged the Windows PG to investigate. Initially there was a low memory condition which could cause problems, when using Standard D1_v2, this was due to Windows Update, and has been mitigated. However, there is still an issue, Windows PG is investigating, and I will report back when I hear.
Randomly getting same WinRM timeout issue for 2019-Datacenter as well.
@sanchetanparmar What are you using for "winrm_timeout": ? The current workaround for issues with 2016 has been to use 2019.
@cynthn i have tried with multiple time-out values.
Seeing exactly the same issues with 2019/2016 datacenter and core, sometimes it works, sometimes it doesn't. Also seeing timeout / instability issues when running ansible via winrm against a provisioned VM from the marketplace.
Since I have switched to using an earlier version of the base image I have seen no winrm timeout issues:
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2019-Datacenter-Core",
"image_version": "17763.737.1909062324"
I have the same issue on cis-ws2019-l1 version 1.0.4. No way to remotely activate the winrm using packer. I have to do a command from azure virtual machine or Powershell to activate the Winrm using script. It's a shame that the user_data_file option is not present for Azure ARM.
The team has posted an updated here: https://support.microsoft.com/en-us/help/4540981/windows-server-images-for-february-2020
Symptom | Workaround
-- | --
Windows Server 2016 images might have a performance issue after the computer first restarts. This began in November 2019 and is related to an OS code integrity operation. This issue is more pronounced on small Azure virtual machines (VM) (with lower throughput and I/O) and prevents the VM from being immediately usable after the first restart. | The performance issue is mitigated in the February 2020 images and onwards. Please use the latest February 2020 Windows Server 2016 image once it is available from the Marketplace.
You might encounter issues when using Windows Server container images for this update. | For more information on this issue, please see KB4542617.
So as mentioned, please use the newer versions of the OS systems to avoid this.
As far as action items from this thread, there is nothing else to be done and I will be closing it out.
I am facing this same issue for a very basic sample image creation fusing Packer in Azure.I tried using 2019,2016-Datacenter image_sku as well.Ultimately tried creation of image removing all of the WinRM parameters.Still it show the same error.
Kidly suggest.
Below is my code.
{
"builders": [{
"type": "azure-arm",
"client_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"client_secret": "ppppppp-pppp-pppp-pppp-ppppppppppp",
"tenant_id": "zzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz",
"subscription_id": "yyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyy",
"managed_image_resource_group_name": "myResourceGroup",
"managed_image_name": "myPackerImage",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2016-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": true,
"winrm_insecure": true,
"winrm_timeout": "5m",
"winrm_username": "packer",
"azure_tags": {
"dept": "Engineering",
"task": "Image deployment"
},
"location": "East US",
"vm_size": "Standard_DS2_v2"
}],
"provisioners": [{
"type": "powershell",
"inline": [
"Add-WindowsFeature Web-Server",
"& $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 } }"
]
}]
}
Error:
C:\sample_windows>packer build ./windows.json
azure-arm: output will be in this color.
==> azure-arm: Running builder ...
==> azure-arm: Getting tokens using client secret
==> azure-arm: Getting tokens using client secret
azure-arm: Creating Azure Resource Manager (ARM) client ...
==> azure-arm: WARNING: Zone resiliency may not be supported in West Europe, checkout the docs at https://docs.microsoft.com/en-us/azure/availability-zones/
==> azure-arm: Creating resource group ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-2jjnnn94ya'
==> azure-arm: -> Location : 'West Europe'
==> azure-arm: -> Tags :
==> azure-arm: ->> dept : Engineering
==> azure-arm: ->> task : Image deployment
==> azure-arm: Validating deployment template ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-2jjnnn94ya'
==> azure-arm: -> DeploymentName : 'pkrdp2jjnnn94ya'
==> azure-arm: Deploying deployment template ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-2jjnnn94ya'
==> azure-arm: -> DeploymentName : 'kvpkrdp2jjnnn94ya'
==> azure-arm: Getting the certificate's URL ...
==> azure-arm: -> Key Vault Name : 'pkrkv2jjnnn94ya'
==> azure-arm: -> Key Vault Secret Name : 'packerKeyVaultSecret'
==> azure-arm: -> Certificate URL : 'https://pkrkv2jjnnn94ya.vault.azure.net/secrets/packerKeyVaultSecret/c3a6a724292b49b5a0f3a69eb31c2b7d'
==> azure-arm: Setting the certificate's URL ...
==> azure-arm: Validating deployment template ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-2jjnnn94ya'
==> azure-arm: -> DeploymentName : 'pkrdp2jjnnn94ya'
==> azure-arm: Deploying deployment template ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-2jjnnn94ya'
==> azure-arm: -> DeploymentName : 'pkrdp2jjnnn94ya'
==> azure-arm: Getting the VM's IP address ...
==> azure-arm: -> ResourceGroupName : 'packer-Resource-Group-2jjnnn94ya'
==> azure-arm: -> PublicIPAddressName : 'pkrip2jjnnn94ya'
==> azure-arm: -> NicName : 'pkrni2jjnnn94ya'
==> azure-arm: -> Network Connection : 'PublicEndpoint'
==> azure-arm: -> IP Address : '40.114.144.89'
==> azure-arm: Waiting for WinRM to become available...
==> azure-arm: Timeout waiting for WinRM.
==> azure-arm: Removing the created Deployment object: 'pkrdp2jjnnn94ya'
==> azure-arm: Removing the created Deployment object: 'kvpkrdp2jjnnn94ya'
==> azure-arm:
==> azure-arm: Cleanup requested, deleting resource group ...
==> azure-arm: Resource group has been deleted.
Build 'azure-arm' errored: Timeout waiting for WinRM.
==> Some builds didn't complete successfully and had errors:
--> azure-arm: Timeout waiting for WinRM.
==> Builds finished but no artifacts were created.
Hi,
yeah I am too still seeing the intermittent WinRM timeout issues..
{
"variables": {
"armClientID": "",
"armClientSecret": "",
"armTenantID": "",
"armSubscriptionID": "",
"packerBuildResourceGroup": "",
"imageName": "",
"buildID": "",
"codeSourceDir": "",
"winrm_user": "packer",
"buildPublish": ""
},
"builders": [{
"type": "azure-arm",
"client_id": "{{user `armClientID`}}",
"client_secret": "{{user `armClientSecret`}}",
"tenant_id": "{{user `armTenantID`}}",
"subscription_id": "{{user `armSubscriptionID`}}",
"build_resource_group_name": "{{user `packerBuildResourceGroup`}}",
"managed_image_resource_group_name": "{{user `packerBuildResourceGroup`}}",
"managed_image_name": "{{user `imageName`}}_{{user `buildID`}}_{{user `buildPublish`}}",
"os_type": "windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2019-Datacenter-Core",
"vm_size": "Standard_D8s_v3",
"communicator": "winrm",
"winrm_use_ssl": true,
"winrm_insecure": true,
"winrm_timeout": "10m",
"winrm_username": "{{user `winrm_user`}}",
"managed_image_storage_account_type": "Premium_LRS",
"os_disk_size_gb": "256"
}],
"provisioners": [
{
"type": "powershell",
"inline": [
"switch -Wildcard ($env:PACKER_BUILDER_TYPE) {",
" \"azure*\" { $publicipv4 = Invoke-RestMethod -Method GET -Uri \"http://169.254.169.254/metadata/instance/network/interface/0/ipv4/ipAddress/0/publicIpAddress?api-version=2017-12-01&format=text\" -Headers @{\"Metadata\" = \"true\"} }",
" \"googlecompute\" { $publicipv4 = Invoke-RestMethod -Method GET -Uri http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip -Headers @{\"Metadata-Flavor\" = \"Google\"} }",
" Default { Throw \"Unknown PACKER_BUILDER_TYPE\" } }",
"\"[{{build_name}}]\" | Out-File C:\\Windows\\Temp\\host -encoding ascii",
"$publicipv4 | Out-File C:\\Windows\\Temp\\host -encoding ascii"
]
},
{
"type": "powershell",
"elevated_user": "{{user `winrm_user`}}",
"elevated_password": "{{.WinRMPassword}}",
"inline": "Add-WindowsCapability -Online -Name 'ServerCore.AppCompatibility~~~~0.0.1.0'"
},
{
"type": "windows-restart"
},
{
"type": "file",
"pause_before": "2m",
"direction": "download",
"source": "C:\\Windows\\Temp\\host",
"destination": "{{build_name}}-host"
},
{
"type": "shell-local",
"inline": [
"#https://github.com/ansible/ansible/issues/55053 for REQUESTS_CA_BUNDLE bug",
"unset REQUESTS_CA_BUNDLE",
"ansible-playbook -i {{build_name}}-host --extra-vars \"ansible_user={{user `winrm_user`}} ansible_password={{.WinRMPassword}} ansible_become_pass={{.WinRMPassword}} ansible_port=5986 ansible_connection=winrm ansible_winrm_server_cert_validation=ignore ansible_winrm_transport=ntlm\" {{user `codeSourceDir`}}/{{user `imageName`}}/ansible_playbooks/playbook.yml"
]
},
{
"type": "powershell",
"inline": [
" # NOTE: the following *3* lines are only needed if the you have installed the Guest Agent.",
" while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running') { Start-Sleep -s 5 }",
" while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
"& $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 } }"
]
}
]
}
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/bin/bash --noprofile --norc /__w/_temp/5253d20a-3c84-4b13-a7f9-4c68f0eb26b9.sh
azure-arm output will be in this color.
==> azure-arm: Running builder ...
==> azure-arm: Getting tokens using client secret
==> azure-arm: Getting tokens using client secret
azure-arm: Creating Azure Resource Manager (ARM) client ...
==> azure-arm: Using existing resource group ...
==> azure-arm: -> ResourceGroupName : 'xxxxxxxx'
==> azure-arm: -> Location : 'westeurope'
==> azure-arm: Validating deployment template ...
==> azure-arm: -> ResourceGroupName : 'xxxxxxxx'
==> azure-arm: -> DeploymentName : 'pkrdp85n7kcshur'
==> azure-arm: Deploying deployment template ...
==> azure-arm: -> ResourceGroupName : 'xxxxxxx'
==> azure-arm: -> DeploymentName : 'kvpkrdp85n7kcshur'
==> azure-arm: Getting the certificate's URL ...
==> azure-arm: -> Key Vault Name : 'pkrkv85n7kcshur'
==> azure-arm: -> Key Vault Secret Name : 'packerKeyVaultSecret'
==> azure-arm: -> Certificate URL : 'https://pkrkv85n7kcshur.vault.azure.net/secrets/packerKeyVaultSecret/104356c1d41345af9e04bc640c7c7f63'
==> azure-arm: Setting the certificate's URL ...
==> azure-arm: Validating deployment template ...
==> azure-arm: -> ResourceGroupName : 'xxxxxx'
==> azure-arm: -> DeploymentName : 'pkrdp85n7kcshur'
==> azure-arm: Deploying deployment template ...
==> azure-arm: -> ResourceGroupName : 'xxxxxx'
==> azure-arm: -> DeploymentName : 'pkrdp85n7kcshur'
==> azure-arm: Getting the VM's IP address ...
==> azure-arm: -> ResourceGroupName : 'xxxxx'
==> azure-arm: -> PublicIPAddressName : 'pkrip85n7kcshur'
==> azure-arm: -> NicName : 'pkrni85n7kcshur'
==> azure-arm: -> Network Connection : 'PublicEndpoint'
==> azure-arm: -> IP Address : '52.148.198.108'
==> azure-arm: Waiting for WinRM to become available...
==> azure-arm: Timeout waiting for WinRM.
==> azure-arm:
==> azure-arm: The resource group was not created by Packer, deleting individual resources ...
==> azure-arm: -> Deployment: pkrdp85n7kcshur
==> azure-arm: -> Microsoft.Compute/virtualMachines : 'pkrvm85n7kcshur'
==> azure-arm: -> Microsoft.Network/networkInterfaces : 'pkrni85n7kcshur'
==> azure-arm: -> Microsoft.Network/publicIPAddresses : 'pkrip85n7kcshur'
==> azure-arm: -> Microsoft.Network/virtualNetworks : 'pkrvn85n7kcshur'
==> azure-arm: -> Microsoft.Compute/disks : '/subscriptions/xxxxxxxxxx/resourceGroups/xxxxxxxx/providers/Microsoft.Compute/disks/pkros85n7kcshur'
==> azure-arm:
==> azure-arm: The resource group was not created by Packer, deleting individual resources ...
==> azure-arm: Could not retrieve OS Image details
==> azure-arm: -> Deployment: kvpkrdp85n7kcshur
==> azure-arm: -> Microsoft.KeyVault/vaults/secrets : 'pkrkv85n7kcshur/packerKeyVaultSecret'
==> azure-arm: -> Microsoft.KeyVault/vaults : 'pkrkv85n7kcshur'
==> azure-arm: -> : ''
==> azure-arm: Error deleting resource. Please delete manually.
==> azure-arm:
==> azure-arm: Name:
==> azure-arm: Error: Unable to parse path of image
==> azure-arm:
==> azure-arm: The resource group was not created by Packer, not deleting ...
Build 'azure-arm' errored: Timeout waiting for WinRM.
Hi, if you are still seeing issues, please see this:
https://github.com/hashicorp/packer/issues/8658#issuecomment-600857201
Most helpful comment
@cynthn i have tried with multiple time-out values.
Its random issue, don't think , winrm_timeout issue.