packer i used
`{
"builders": [
{
"name": "image",
"type": "azure-arm",
"os_disk_size_gb": "256",
"vm_size": "Standard_F8s_v2",
"managed_image_storage_account_type": "Standard_LRS",
"client_id": "xxxxxxxxxxxxxxxxxxx",
"client_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"tenant_id": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"subscription_id": "xxxxxxxxxxxxxxxxxxxxxxxx",
"object_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"managed_image_name": "mypackerimage",
"managed_image_resource_group_name": "resource_group_name",
"build_resource_group_name": "rg",
"virtual_network_name": "VizDev-AzureDevOps-vnet",
"virtual_network_resource_group_name": "VizDev-AzureDevOps",
"virtual_network_subnet_name": "default",
"os_type": "Windows",
"image_publisher": "MicrosoftWindowsServer",
"image_offer": "WindowsServer",
"image_sku": "2022-Datacenter",
"communicator": "winrm",
"winrm_use_ssl": "true",
"winrm_insecure": "true",
"winrm_username": "packer"
}
],
"provisioners": [
{
"type": "shell",
"script": "./provisioning-script.sh"
},
{
"type": "powershell",
"inline": [
"Write-Output 'Hello, Packer!'"
]
}
]
}`
please find the error code as below :
` Some builds didn't complete successfully and had errors:
--> azure-arm.image: polling after CreateOrUpdate: Code="DeploymentFailed" Message="At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details." Targ
et="/subscriptions//resourceGroups/VizDev-AzureDevOps/providers/Microsoft.Resources/deployments/pkrdpgt4raapkqo" Details=[{"code":"InvalidResourceReference","details":[],"message":"Resource /subscriptions/resourceGroups/VizDev-AzureDevOps/providers/Microsoft.Network/virtualNetworks/VizDev-AzureDevOps-vnet/subnets/default referenced by resource /subscriptions//resourceGroups/VizDev-AzureDevOps/providers/M
icrosoft.Network/networkInterfaces/pkrnigt4raapkqo was not found. Please make sure that the referenced resource exists, and that both resources are in the same region."}]
==> Builds finished but no artifacts were created.`
By default, packer should use the resource group location, so check if
"virtual_network_resource_group_name": "VizDev-AzureDevOps"and"build_resource_group_name": "rg"exist in the same location. Both RGs should exist in the same subscription ("subscription_id": "xxxxxxxxxxxxxxxxxxxxxxxx").locationcan be used whenbuild_resource_group_nameis not defined.As a starting point you can use basic example provided in documentation: https://developer.hashicorp.com/packer/integrations/hashicorp/azure/latest/components/builder/arm#basic-example