3
votes

Till now I have been using the market place Suse SLES for SAP image to create my VMs. However now I intend to use a golden OS image that contains additional software and configuration. For that I created a VM with the market place image and configured it. Then I created an image with just the OS disk Linux image creation. It seems MS is going towards VM image instead of the earlier disk image. However I cannot find any way to use this VM image as part of ARM template deployment. Previously I was using the standard template as below:

 "osProfile": {
                "computerName": "[parameters('vmName')]",
                "adminUsername": "[parameters('vmUserName')]",
                "adminPassword": "[parameters('vmPassword')]"
            },
            "storageProfile": {
                "imageReference": {
                    "publisher": "[variables('OperatingSystemSpec').imagePublisher]",
                    "offer": "[variables('OperatingSystemSpec').imageOffer]",
                    "sku": "[variables('OperatingSystemSpec').sku]",
                    "version": "latest"
                },
                "osDisk": {
                    "name": "[concat(parameters('vmName'),'-OS')]",
                    "createOption": "FromImage",
                    "caching": "ReadWrite",
                    "managedDisk": {
                        "storageAccountType": "Premium_LRS"
                    } 
                }

How do I use the generalized golden image from my template?

The objective is that my golden image should be usable just like I am using the market place images otherwise there will be a big change in all ARM templates. Can I somehow publish my images just like the market place images (but as a private collection) so that it is usable like one of them?

Do I need to create a VHD image for this kind of usage? I see there are ARM template examples that are able to refer to VHDs stored in azure storage. How do I create a VHD for my Azure VM OS disk? I see examples that show how to create and upload VHDs but those are for on-prem VMs. Also do note I am using managed disks for my Azure VMs.

Any help much appreciated..

1

1 Answers

2
votes

How do I use the generalized golden image from my template?

You can use

"imageReference": {
                    "id":{the image resource id}
                }

in the template. This ID must be of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/images/{imageName}

Do I need to create a VHD image for this kind of usage? How do I create a VHD for my Azure VM OS disk?

It depends on you. If you want to use a VHD as an image to create other VMs with new disks, you use Sysprep to generalize the operating system contained in the file and then stop the VM. You will get the VHD uri. Refer to this document for more details.