Granting user manged identity to packer machine and using it

I want to give user managed identity to the packer build virtual machine which is being created in the backend. is it possible if yes how?

Yes, it is possible to assign a User Managed Identity to a Packer build VM in Azure. You’ll need to use the Azure ARM builder in your Packer template and specify the user_assigned_identity_id with the identity’s resource ID. Ensure your Packer version is up to date to support this feature.