I am having problem with AZURE Redhats BYOS Gold image and getting it to work. I can build with the Market place Version with no problem so I know the whole template is good.
But when I change to the RHEL provided image
image_publisher = "RedHat"
image_offer = "rhel-byos"
image_sku = "rhel-lvm78-gen2"
I get teh following VMMarketPlaceInvalidInput Error. And I am at a loss of what I am doing wrong
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\": \"VMMarketplaceInvalidInput\",\r\n
\"message\": \"Creating a virtual machine from Marketplace image or a custom image sourced from a Marketplace image requires Plan information in the request. VM: '/subscriptions/XXXXXXXX-XXXXX-XXXXXX-XXXXX-XXXXXXXXXXXXX/resourceGroups/YY-YY-YYYYY-YYY-YYYY/providers/Microsoft.Compute/virtualMachines/rhel-packer-image-builder-20210108t202236'.\"\r\n }\r\n ]\r\n }\r\n}"}]
I went to Redhats Cloud Resource and Enabled the RHEL Gold Images and I can see the “Offers”
az vm image list --publisher RedHat --offer rhel-byos -s rhel-lvm78-gen2 --all -o table
Offer Publisher Sku Urn Version
--------- ----------- --------------- --------------------------------------------- ------------
rhel-byos RedHat rhel-lvm78-gen2 RedHat:rhel-byos:rhel-lvm78-gen2:7.8.20200715 7.8.20200715
rhel-byos RedHat rhel-lvm78-gen2 RedHat:rhel-byos:rhel-lvm78-gen2:7.8.20200824 7.8.20200824
rhel-byos RedHat rhel-lvm78-gen2 RedHat:rhel-byos:rhel-lvm78-gen2:7.8.20201222 7.8.20201222
here is the whole template I wrap it with ansible so there is nothing that I have changed other then the image_publisher offer and sku
source "azure-arm" "autogenerated_1" {
client_id = "{{ azure_client_id }}"
client_secret = "{{ azure_client_secret }}"
subscription_id = "{{ azure_subscription_id }}"
tenant_id = "{{ azure_tenant_id }}"
build_resource_group_name = "{{ build_rg_name }}"
image_publisher = "RedHat"
image_offer = "rhel-byos"
image_sku = "rhel-lvm78-gen2"
managed_image_name = "{{ publish_image_name }}_{{ ansible_date_time.iso8601_basic_short | lower}}"
managed_image_os_disk_snapshot_name = "snapshot_{{ publish_image_name }}_{{ ansible_date_time.iso8601_basic_short| lower }}"
managed_image_resource_group_name = "{{ build_rg_name }}"
os_type = "Linux"
private_virtual_network_with_public_ip = "false"
shared_gallery_image_version_exclude_from_latest = "{{ publish_exclude_from_latest | lower }}"
shared_image_gallery_timeout = "{{ build_timeout_minute }}m"
shared_image_gallery_destination {
gallery_name = "{{ publish_gallery_name }}"
image_name = "{{ publish_image_name }}"
image_version = "{{ version_major }}.{{ version_minor }}.{{ version_build }}"
replication_regions = ["{{ build_location }}"]
resource_group = "{{ publish_rg_name }}"
subscription = "{{ azure_subscription_id }}"
}
temp_compute_name = "rhel-packer-image-builder-{{ ansible_date_time.iso8601_basic_short| lower }}"
virtual_network_name = "{{ build_vm_network }}"
virtual_network_subnet_name = "{{ build_vm_subnet }}"
vm_size = "{{ build_vm_size }}"
}
build {
sources = ["source.azure-arm.autogenerated_1"]
provisioner "ansible" {
ansible_env_vars = ["ANSIBLE_TIMEOUT=30",
"ANSIBLE_HOST_KEY_CHECKING=False",
"ANSIBLE_SSH_ARGS='-o ForwardAgent=yes -o ControlMaster=auto -o ControlPersist=15m'",
"ANSIBLE_NOCOLOR=True"]
extra_arguments = ["--skip-tags", "restart","--diff"]
playbook_file = "build-ansible/playbook.yml"
}
post-processor "manifest" {
output = "manifest.json"
strip_path = true
custom_data = {
version = "{{ version_major }}.{{ version_minor }}.{{ version_build }}"
}
}
}