In this article we will deploy the CloudForms appliance in the Azure cloud. Red Hat provides CloudForms as an appliance. For Microsoft Hyper-V and Azure, Red Hat provides a Virtual Hard Disk (VHD) as a dynamic disk. Azure, unfortunately, does not support dynamic disks. In order to import the CloudForms appliance into Azure, we need to convert the appliance VHD to a fixed disk.
The VHD will have a fixed size of around 40GB. To prevent having to upload 40GB and only upload the actual data which is closer to 2GB, we will use several tools. You can of course use Powershell, using the Azure cmdlets, or if you are a Linux guy like me, Microsoft has provided a tool written in Go that works great for uploading disks to Azure. In addition Microsoft provides a command line (Azure CLI) similar to the functionality of Powershell, but written in Python.
Convert VHD from Dynamic to Fixed
The first question you might have is why provide a dynamic disk? Well Red Hat doesn’t want you to have to download a 40GB image so they provide a dynamic disk. In the next steps we will take that image, convert to fixed disk and upload to Azure.
First, we need to convert the image to a raw image. We can do this using qemu-tools. To do so, we need to compute the appropriate size for the new disk image and resize it. I‘ve written a quick script that will do this. You can get it here.
Upload and Run CloudForms
In order to upload the disk image to Azure and run it, you need to use the Microsoft Azure VHD tools and Azure CLI tools as I mentioned previously. They are written in Go, so you may also need to install Go as well. The steps I took in my environment are at the end of this post.
The command to upload the disk image is:
$ ./azure-vhd-utils upload --localvhdpath /home/cfme-azure-220.127.116.11-1.vhd --stgaccountname <storage account> --stgaccountkey <storage key> --containername templates --blobname cfme-azure-18.104.22.168-1.vhd --parallelism 8
You need to substitute your own values into the storage account and storage key values. Once the upload completes you can deploy the CloudForms Appliance in Azure. In order to do this we will use the Azure CLI.
The following command creates the CloudForms VM from the VHD you just uploaded.
$ azure vm image create cfme-azure-22.214.171.124-1 --blob-url https://premiumsadpdhlose2disk.blob.core.windows.net/templates/cfme-azure-126.96.36.199-1.vhd --os Linux /home/cfme-azure-188.8.131.52-1.vhd
Note that you can also use the Azure portal UI to create the CloudForms VM once the image is uploaded.
Configure CloudForms in Azure
Once the CloudForms Appliance is deployed you can access it using username/password or ssh-key, depending on what you chose when creating VM in Azure.
That‘s it! You can now configure the CloudForms appliance just as you would normally.
In this article we explored how to deploy the CloudForms appliance in the Azure cloud. CloudForms provides a single-pane for administering various cloud platforms. Having a CloudForms appliance deployed in Azure gives you more responsive management over Azure resources.
Happy Clouding in Azure!
Note: As I mentioned, the Azure VHD tools are written in Go so you need to first install Go. I installed version 1.7.4.
$ gunzip go1.7.4.linux-amd64.tar.gz $ tar xvf go1.7.4.linux-amd64.tar $ cd go
Export the environment parameters
$ mkdir $HOME/work $ export GOPATH=$HOME/work $ export PATH=$PATH:$GOPATH/bin
Then install the VHD tools
$ go get github.com/Microsoft/azure-vhd-utils
Similarly, to use the Azure CLI, you need to install Python and dependencies first. (These may already be on your system, but are provided here for completeness.)
$ sudo dnf install python $ sudo dnf install python-pip $ sudo dnf install python-devel $ sudo dnf install openssl-devel $ sudo dnf install npm
Then you can install the Azure CLI
$ sudo npm install azure-cli -g $ sudo pip install --upgrade pip $ sudo pip install azure==2.0.0rc5