Azure Pipeline builds - WinRM timeouts w/VNet and Public IP

Hello there. I’ve got an issue when doing some Azure Pipeline packer image builds, and hoping to get some ideas and direction from the community.

Bit of background: We’ve been doing some basic customized Packer images for Azure Shared Image Gallery for sometime. We are utilizing Azure Pipelines (utilizing the Agent Pools in Azure), and create our packer VM in a specified Resource Group. Typically we’ve just let it do all of it’s own resource creation and cleanup. Aside from the WinRM timeout issues that happened end of 2019/start of 2020, it has been fairly smooth sailing.

We decided we would like to extend the customization and do Chef configuration additions during the build. We got ExpressRoute setup in Azure with connection to on-prem networks, validated that all works fine. Got a custom subnet stoodup for the packer builds to have private IP on ER.

The problem now, is that when I try a Packer build with the private Vnet info and Chef provisioner steps, I get a WinRM timeout. I know that this is related to the use of the ER Vnet settings, because if I remove them from the json I have no problem running the packer build.

I’m utilizing the following related to the Vnet and WinRM settings. I was wondering if I needed to specify winrm_host to somehow make sure the public IP or public DNS is specified. Any thoughts or suggestions are greatly appreciated.

      "virtual_network_name": "{{user `virtual_network_name`}}",
      "virtual_network_resource_group_name": "{{user `virtual_network_resource_group_name`}}",
      "virtual_network_subnet_name": "{{user `virtual_network_subnet_name`}}",
      "private_virtual_network_with_public_ip": true,
  

      "communicator": "winrm",
      "winrm_use_ssl": true,
      "winrm_insecure": true,
      "winrm_timeout": "30m",
      "winrm_username": "usernamehereisntreal",

Hey dcherry88, I know the post is a bit old, but were you able to fix this issue? I’m getting the exact same error as yours. Thanks.