Error trying to run packer in AzureChinaCloud

170 Views Asked by At

I am trying to build a VM image from packer configuration using the following command:


    packer build \
        -var base_img=$base_img \
        -var client_id=$client_id \
        -var client_secret=$client_secret \
        -var tenant_id=$tenant_id \
        -var subscription_id=$subscription_id \
        -var az_cloud_environment_name=China \
        -only=azure-arm \
        packer.json

However, I am getting the following error and I could not find what it means and what the resolution of it is: Build 'azure-arm' errored: packer-azure application not set up for Azure environment "AzureChinaCloud"

Have anyone seen something like this?

1

There are 1 best solutions below

0
Alex AIT On BEST ANSWER

This should only happen if you use the "quick start" device code flow - see e.g. https://github.com/hashicorp/packer/issues/5034.

It should not happen if you pass your own clientId and clientSecret. You probably did not use them correctly in your packer file

  "builders": [
    {
      "type": "azure-arm",

      "client_id": "{{user `client_id`}}",
      "client_secret": "{{user `client_secret`}}",

      "vm_size": "Standard_DS2_v2"
    }
  ],