Hi,
Im trying to build an image with Packer. For my use case i need to do it in vnet/subnet with private ip. But it results in error -
==> azure-arm: Waiting for WinRM to become available…
==> azure-arm: Timeout waiting for WinRM.
Template im using:
{
“builders”: [
{
“type”: “azure-arm”,
“client_id”: “clinetId”,
“client_secret”: “secret”,
“tenant_id”: “tenantId”,
“subscription_id”: “subscriptionId”,
“build_resource_group_name”:“packer-test”,
“managed_image_resource_group_name”: “packer-test”,
“managed_image_name”: “hivemq-windows2-vnet”,
“os_type”: “Windows”,
“image_publisher”: “MicrosoftWindowsServer”,
“image_offer”: “WindowsServer”,
“image_sku”: “2019-Datacenter”,
“communicator”: “winrm”,
“winrm_use_ssl”: true,
“winrm_insecure”: true,
“winrm_timeout”: “5m”,
“winrm_username”: “packer”,
“azure_tags”: {
“dept”: “Engineering”,
“task”: “POC”
},
“vm_size”: “Standard_D2_v2”,
“virtual_network_name”: “test-vnet”,
“virtual_network_subnet_name”: “test-subnet3”,
“virtual_network_resource_group_name”: “packer-test”
}
],
“provisioners”: [
{
“type”: “powershell”,
“inline”: [
“Add-WindowsFeature Web-Server”,
“while ((Get-Service RdAgent).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 } }”
]
}
]
}
Can anyone guide my what i might be doing wrong here?
When im not referencing existing vnet, it works fine.