Issue connecting to AWS when creating ARM client

I’m running into a very strange issue which started happening a few weeks ago. Up until then, Azure builds were running fine, but now all builds in Azure fail after the “getting tokens using client secret” step, when setting up the connection, (Creating Azure Resource Manager (ARM) client…) with “cannot locate the managed image resource group…”. This happens when running through our Jenkins build pipeline which creates image in both AWS and Azure. AWS works just fine, but Azure stopped working. Packer runs inside a container which does all the work. What’s also strange is that when running things manually, by using that same container, it works. It connects just fine to AWS. A possible explanation could be the fact that we transitioned the container from CentOS 8 to AlmaLinux, but as I mentioned before, when running this manually it just works.

What we tried so far in the troubleshooting process:

  • made sure Azure credentials are good (the successful manual builds run with the same set of credentials)
  • made sure objects are still in place in Azure
  • using an older version of Packer
  • made sure build environmental variables are passed ok via Jenkins
  • made sure this is not a networking issue and Jenkins can talk to Azure