1

我在使用 Packer 和 Azure Stack 时遇到问题,我正在尝试在 azure stack 中构建图像,但看起来 packer 不要尝试使用我的自定义 URL。

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

    "client_id": "client_id",
    "client_secret": "client_secret",
    "tenant_id": "tenant_id",
    "subscription_id": "subscription_id",

    "managed_image_resource_group_name": "resource_group_name",
    "managed_image_name": "random_name",

    "os_type": "Linux",
    "image_publisher": "Canonical",
    "image_offer": "UbuntuServer",
    "image_sku": "18.04-LTS",

    "azure_tags": {
        "dept": "Engineering",
        "task": "Image deployment"
    },

    "location": "custom_location",
    "vm_size": "Standard_DS2_v2"
  }],
  "provisioners": [{
    "execute_command": "chmod +x {{ .Path }}; {{ .Vars }} sudo -E sh '{{ .Path }}'",
    "inline": [
      "apt-get update",
      "apt-get upgrade -y",
      "apt-get -y install nginx",

      "/usr/sbin/waagent -force -deprovision+user && export HISTSIZE=0 && sync"
    ],
    "inline_shebang": "/bin/sh -x",
    "type": "shell"
  }]
}

错误

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 ...
Build 'azure-arm' errored: Cannot locate the managed image resource group resource_group_name.

==> Some builds didn't complete successfully and had errors:
--> azure-arm: Cannot locate the managed image resource group olaf.

==> Builds finished but no artifacts were created.

但是凭据是正确的,我可以使用 ServiceAccount/App 凭据登录并列出所有资源组。似乎一切正常。

有人知道如何让 Packer 使用 azure stack 吗?有没有办法给堆栈域而不是原始的天蓝色域或类似的东西?

谢谢!=)

4

1 回答 1

0

我知道这个问题很老,您可能已经弄清楚了,但是我今天遇到了同样的问题,并认为为遇到此问题的其他人添加我的解决方案可能会有所帮助:

确保将您的服务主体添加为资源组的参与者。

  • 在 Azure 门户中,导航到目标资源组

  • 点击左侧的“访问(IAM)”。

  • 单击顶部的“添加”并搜索服务主体

于 2020-10-30T00:06:05.767 回答