Packer - Unable to create VM resource via azure arm with os disk type Standard HDD

347 views
Skip to first unread message

Rahul Negi

unread,
Nov 2, 2022, 3:58:59 AM11/2/22
to Packer

Hi Team, I am using packer with azure-arm template to build up managed images and store them in Share Image Gallery or Azure Compute Gallery.

While creating the temporary vm resource, I am getting below error. Below error is related to OS Disk type which is by default picking Premium SSD type while that has been disallowed by our team so it’s failing like below.

==> azure-arm: Validating deployment template …
==> azure-arm: → ResourceGroupName : ‘packer-rg-bo’
==> azure-arm: → DeploymentName : ‘pkrdpu4fs7gzjif’
==> azure-arm: Deploying deployment template …
==> azure-arm: → ResourceGroupName : ‘packer-rg-bo’
==> azure-arm: → DeploymentName : ‘pkrdpu4fs7gzjif’
==> azure-arm: Code=“DeploymentFailed” Message=“At least one resource deployment operation failed. Please list deployment operations for details. Please see Deployment history - Azure Resource Manager | Microsoft Learn for usage details.” Details=[{“code”:“Conflict”,“message”:“{\r\n "status": "Failed",\r\n "error": {\r\n "code": "ResourceDeploymentFailure",\r\n "message": "The resource operation completed with terminal provisioning state ‘Failed’.",\r\n "details": [\r\n {\r\n "code": "RequestDisallowedByPolicy",\r\n "message": "Resource ‘pkrosu4fs7gzjif’ was disallowed by policy. Reasons: ‘INFORMATION : THE USE OF PREMIUM SSD IS DENIED. PLEASE ENSURE THAT ON DISKS TAB EITHER STANDARD HDD OR STANDARD SSD IS SELECTED OR DEPLOYMENT MAY FAIL.\nPLEASE READ DEP DOCUMENTATION FOR MORE INFORMATION’. See error details for policy resource IDs. Target: ‘/subscriptions/xxxxxxxxxxxx/resourceGroups/packer-rg-bo/providers/Microsoft.Compute/disks/pkrosu4fs7gzjif’."\r\n }\r\n ]\r\n }\r\n}”}]
==> azure-arm:
==> azure-arm: Deleting individual resources …
==> azure-arm: Could not retrieve OS Image details: unable to obtain a OS disk for “slazpckrbo01”, please check that the instance has been created

Kindly suggest us any option parameter to using in builders section or packer-nft.json to choose Standard HDD as OS Disk type.

Thanks and Regards
Rahul Negi

Alvaro Miranda Aguilera

unread,
Nov 4, 2022, 3:51:47 PM11/4/22
to packe...@googlegroups.com
please share template

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/f0eb6943-95cb-4ef9-a1e9-3aa070627688n%40googlegroups.com.


--
Alvaro

Rahul Negi

unread,
Nov 7, 2022, 1:01:42 AM11/7/22
to Packer
Hi Alvaro,  Please check the configuration of packer-nft.json file as below

"builders": [ { "type": "azure-arm", "use_azure_cli_auth": "True", "os_type": "Linux", "os_disk_size_gb": "64", "shared_image_gallery": { "subscription": "{{user `subscription_id`}}", "resource_group": "{{user `sig_gallery_resource_group`}}", "gallery_name": "{{user `sig_gallery_name`}}", "image_name": "{{user `sig_image_name`}}", "image_version": "{{user `sig_source_image_version`}}" }, "shared_image_gallery_destination": { "subscription": "{{user `subscription_id`}}", "resource_group": "{{user `sig_gallery_resource_group`}}", "gallery_name": "{{user `sig_gallery_name`}}", "image_name": "{{user `sig_image_name`}}", "image_version": "{{user `sig_dest_image_version`}}", "replication_regions": ["{{user `location`}}"] }, "temp_resource_group_name": "{{user `temp_resource_group_name`}}", "temp_compute_name": "{{user `temp_compute_name`}}", "private_virtual_network_with_public_ip": true, "polling_duration_timeout": "0h30m0s", "ssh_username": "{{user `ssh_username`}}", "ssh_private_key_file": "{{user `ssh_private_key_file`}}", "ssh_pty": "true", "location": "{{user `location`}}", "vm_size": "{{user `vm_size`}}", "managed_image_name": "{{user `managed_image_name`}}", "managed_image_storage_account_type": "Standard_LRS", "disk_caching_type": "None", "managed_image_resource_group_name": "{{user `sig_gallery_resource_group`}}", "shared_image_gallery_timeout": "2h5m2s", "azure_tags": { "packer": "true" } } ],

Thanks and Regards,
Rahul Negi

Alvaro Miranda Aguilera

unread,
Nov 12, 2022, 4:15:09 AM11/12/22
to packe...@googlegroups.com
Hello

I can see you are using the right setting 

  • managed_image_storage_account_type (string) - Specify the storage account type for a managed image. Valid values are Standard_LRS and Premium_LRS. The default is Standard_LRS.

So my suggestion will be

- try with a different base image for a test
- work with your azure admin account to understand more the error





--
Alvaro

Rahul Negi

unread,
Nov 21, 2022, 1:34:16 AM11/21/22
to Packer
Hi Alvaro,

I tried to check with our azure admin account to understand more of the error and we got to know that this is expected as we cannot create VMs with OS disk type Premium SSD. Earlier we were able to do so hence it was working fine but now as the policy are changed by our admins hence we are unable to create the Packer Intermediate VM so it's failing.

Is there any chance to avoid this error and make the temporary VM with standard OS disk type always instead of primary. I don't know why it is trying to create VM with OS disk type Primary SSD.

Kindly suggest.

Thanks
Rahul Negi

Reply all
Reply to author
Forward
0 new messages