gpt4 book ai didi

azure - 打包程序 azure-arm : Cannot locate the managed image resource group

转载 作者:行者123 更新时间:2023-12-05 09:17:26 30 4
gpt4 key购买 nike

我是 Packer 新手,我一直在尝试按照本指南在 Azure 镜像上构建我的第一个 Packer - https://learn.microsoft.com/en-us/azure/virtual-machines/windows/build-image-with-packer

我没有完全遵循该指南,因为我已经设置了 Azure 订阅和资源组。但现在当我尝试构建我的 Packer 镜像时,出现以下错误

Build 'azure-arm' errored: Cannot locate the managed image resource group myResourceGroup

通过阅读文档,它指出唯一的要求是资源组已经存在,正如我在 Azure 门户中看到的那样。

我的打包器 json 文件遵循如下所示的指南中的文件,如有任何帮助,感激不尽

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

"client_id": "0831b578-8ab6-40b9-a581-9a880a94aab1",
"client_secret": "P@ssw0rd!",
"tenant_id": "72f988bf-86f1-41af-91ab-2d7cd011db47",
"subscription_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx",
"object_id": "a7dfb070-0d5b-47ac-b9a5-cf214fff0ae2",

"managed_image_resource_group_name": "myResourceGroup",
"managed_image_name": "myPackerImage",

"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2016-Datacenter",

"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_timeout": "3m",
"winrm_username": "packer",

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

"location": "East US",
"vm_size": "Standard_DS2_v2"
}],
"provisioners": [{
"type": "powershell",
"inline": [
"Add-WindowsFeature Web-Server",
"if( Test-Path $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml ){ rm $Env:SystemRoot\\windows\\system32\\Sysprep\\unattend.xml -Force}",
"& $Env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /shutdown /quiet"
]
}]
}

最佳答案

这发生在我身上,因为我的服务主体没有足够的权限来读取资源组。

确保您拥有正确的权限,这应该创建正确的服务主体:

az ad sp create-for-rbac --role Contributor --name sp-packer-001

关于azure - 打包程序 azure-arm : Cannot locate the managed image resource group,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47871191/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com