Using custom Azure Images

Problem:

We’ve created a custom Linux image in Azure which is visible to the user but is not seen via the Foreman UI. For example, we are able to use the public image for CentOS7.9 using the syntax OpenLogic:CentOS:7_9-gen2:latest but a custom image using the syntax Imageworks:CentOS:7_9 is not visible. We’ve also tried Imageworks:CentOS:7_9:latest.

Expected outcome:

The ability to use custom Azure images in Foreman 1.24

Foreman and Proxy versions:

1.24 Foreman / Foreman Proxy

Foreman and Proxy plugin versions:

tfm-rubygem-foreman_azure_rm 2.0.8

Distribution and version:

Other relevant data:

Failed to create a compute Azure-westus2-prod (Azure Resource Manager) instance elias-wegrzyn.xxxxxxxxx.com: { “message”: “MsRestAzure::AzureOperationError: InvalidParameter: The value of parameter imageReference.version is invalid.”, “request”: { “base_uri”: “https://management.azure.com”, “path_template”: “subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}”, “method”: “put”, “path_params”: { “resourceGroupName”: “azr-linux-workstation-foreman”, “vmName”: “elias-wegrzyn”, “subscriptionId”: “b9d1b469-ea77-415c-beaa-75e32f204cde” }, “skip_encoding_path_params”: null, “query_params”: { “api-version”: “2019-03-01” }, “skip_encoding_query_params”: null, “headers”: { “Content-Type”: “application/json; charset=utf-8”, “Accept”: “application/json”, “accept-language”: “en-US”, “x-ms-client-request-id”: “7cda920e-2a96-4393-901b-97cb02a227ee” }, “body”: “{“location”:“westus2”,“properties”:{“hardwareProfile”:{“vmSize”:“Standard_NC12s_v3”},“storageProfile”:{“imageReference”:{“publisher”:“Imageworks”,“offer”:“CentOS”,“sku”:“7_9”},“osDisk”:{“osType”:“Linux”,“name”:“elias-wegrzyn-osdisk”,“caching”:“ReadWrite”,“createOption”:“FromImage”,“managedDisk”:{“storageAccountType”:“Standard_LRS”}}},“osProfile”:{“computerName”:“elias-wegrzyn”,“adminUsername”:“xxxx”,“adminPassword”:“xxxxxxxx”,“customData”:“IyBUZW1wbGF0ZSBmb3IgVk1XYXJlIGN1c3RvbWl6YXRpb24gdmlhIG9wZW4tdm0tdG9vbHMKCmlkZW50aXR5OgogIExpbnV4UHJlcDoKICAgIGRvbWFpbjogc3BpbWFnZXdvcmtzLmNvbQogICAgaG9zdE5hbWU6IGVsaWFzLXdlZ3J6eW4KICAgIGh3Q2xvY2tVVEM6IHRydWUKICAgIHRpbWVab25lOiBVVEMKCmdsb2JhbElQU2V0dGluZ3M6CiAgZG5zU3VmZml4TGlzdDogW3NwaW1hZ2V3b3Jrcy5jb21dCiAgZG5zU2VydmVyTGlzdDogW10KCm5pY1NldHRpbmdNYXA6CiAgLSBhZGFwdGVyOgogICAgICBkbnNEb21haW46IHNwaW1hZ2V3b3Jrcy5jb20KICAgICAgZG5zU2VydmVyTGlzdDogW10KICAgICAgZ2F0ZXdheTogW10KICAgICAgaXA6IAogICAgICBzdWJuZXRNYXNrOiAyNTUuMjU1LjI1NS4wCg==”,“linuxConfiguration”:{“disablePasswordAuthentication”:false,“ssh”:{“publicKeys”:[{“path”:”/home/guru/.ssh/authorized_keys",“keyData”:“ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGvwaNJ4E0MeZRt834B3iS5XMod/xcAcvUo2C9gMfzJHa6ZxFLxP0e93F215p/ZpIIck64Va7g9mBir5CXkVkCgLgoSrN8DxH/S7Fwz7HAPYIngEhSn+hkAmCK7O9A2yry30+3UxAz9zBjSCUILBCf3NK8V0Q7QXs3CS1yKMNK5y7rjQjkWpgs6fARxEW8Diil29rkmKBMkAfUkvoak0SqrpWMHKDngNPUKKXxyUlX2+tJg6Dmp7DWauP0Eru6uU64vN3ppJdJAEIdpelgpMrc3CM2J4SdE7kZVUv7qaNDde6wppsg3hRRNikQAJ2MvqlXxNJXUL6NI+DLmuQ+lF9N”}]}}},“networkProfile”:{“networkInterfaces”:[{“id”:"/subscriptions/b9d1b469-ea77-415c-beaa-75e32f204cde/resourceGroups/azr-linux-workstation-foreman/providers/Microsoft.Network/networkInterfaces/elias-wegrzyn-nic0",“properties”:{“primary”:true}}]}}}", “middlewares”: [ [ “MsRest::RetryPolicyMiddleware”, { “times”: 3, “retry”: 0.02 } ], [ “cookie_jar” ] ], “log”: null }, “response”: { “body”: “{\r\n “error”: {\r\n “code”: “InvalidParameter”,\r\n “message”: “The value of parameter imageReference.version is invalid.”,\r\n “target”: “imageReference.version”\r\n }\r\n}”, “headers”: { “Cache-Control”: “no-cache”, “Pragma”: “no-cache”, “Content-Length”: “173”, “Content-Type”: “application/json; charset=utf-8”, “Expires”: “-1”, “x-ms-ratelimit-remaining-resource”: “Microsoft.Compute/PutVM3Min;712,Microsoft.Compute/PutVM30Min;3565”, “Strict-Transport-Security”: “max-age=31536000; includeSubDomains”, “x-ms-request-id”: “5b1e2621-e80e-4c6a-a7d6-61d1599cc4dc”, “Server”: “Microsoft-HTTPAPI/2.0, Microsoft-HTTPAPI/2.0”, “x-ms-ratelimit-remaining-subscription-writes”: “1199”, “x-ms-correlation-request-id”: “d33dfb96-c527-4a2a-b7e9-7a86631a7f14”, “x-ms-routing-request-id”: “WESTUS2:20210426T172231Z:d33dfb96-c527-4a2a-b7e9-7a86631a7f14”, “X-Content-Type-Options”: “nosniff”, “Date”: “Mon, 26 Apr 2021 17:22:30 GMT” }, “status”: 400 } }
Host
Virtual Machine
Operating System
Interfaces
Puppet Classes
Parameters
Additional Information
Name *
elias-wegrzyn
This value is used also as the host’s primary interface name.
Organization *
Location *
Host Group
Deploy On
Compute profile
Environment
Puppet Master
Puppet CA

2.1.2 which has the custom image The solution was to upgrade the plugin version to functions.

1 Like

I’m not sure what happened to my post but it should have read as:

The solution was to upgrade the foreman azure plugin to 2.1.2 which has the custom image functionality.