Latest

1. Installing ManageIQ

ManageIQ can be installed and ready to configure in a few quick steps. After downloading ManageIQ as a virtual machine image template from the Red Hat Customer Portal, the following process takes you through the steps of uploading the ManageIQ appliance to Microsoft Azure.

After uploading the ManageIQ appliance, you must configure the database for ManageIQ; see Configuring a Database for ManageIQ.

1.1. Obtaining the ManageIQ Virtual Appliance

  1. In a browser, navigate to manageiq.org/download.

  2. Select Microsoft Azure from the --Choose your platform-- list.

  3. Select Stable from the --Choose a release-- list.

  4. Follow the instructions to download the appliance.

1.2. Uploading the ManageIQ Virtual Appliance to Microsoft Azure

You can upload the appliance to an Azure environment using the following two methods.

  • Using Azure PowerShell script

  • Using Azure Command-Line Interface (Azure CLI)

To upload the ManageIQ appliance file to Microsoft Azure, ensure the following requirements are met:

Azure requires that the uploaded Virtual Hard Disk (VHD) files are in a fixed format. The ManageIQ virtual appliance image .vhd file is dynamic by default. Currently, the Azure Powershell script and Azure CLI do not automatically convert the dynamic .vhd file to fixed during upload. To upload using either method, the ManageIQ virtual appliance image .vhd file must be first converted from dynamic to fixed, and properly aligned to the nearest 1 MB boundary. Once converted and properly aligned, you can then upload the appliance virtual image .vhd file using either the Azure PowerShell or Azure CLI method.

1.2.1. Converting and Aligning the ManageIQ Virtual Appliance Image

Complete the following procedure to ensure the ManageIQ dynamic .vhd file is properly aligned to the nearest 1 MB boundary, and is in a fixed-size VHD format.

  1. Convert the dynamic .vhd file you downloaded in Obtaining the ManageIQ Virtual Appliance to RAW format.

    $ qemu-img convert -f vpc -O raw <image-name.vhd> <image-name.raw>
    
    Example:
    
    $ qemu-img convert -f vpc -O raw cfme-azure-5.8.2.3-1.x86_64.vhd cfme-azure-5.8.2.3-1.x86_64.raw
  2. Copy and paste the script below into a new bash shell script file, for example, aligned-size.sh. Change rawdisk="image-name" to the image name for your file. This script will calculate the rounded file size to the nearest 1 MB boundary.

    #!/bin/bash
    rawdisk="cfme-azure-5.8.2.3-1.x86_64.raw"
    MB=$((1024 * 1024))
    size=$(qemu-img info -f raw --output json "$rawdisk" | gawk 'match($0, /"virtual-size": ([0-9]+),/, val) {print val[1]}')
    rounded_size=$((($size/$MB + 1) * $MB))
    echo "rounded size = $rounded_size"
    export rounded_size
  3. Run the shell script. The file name aligned-size.sh is used in this example.

    $ sh aligned-size.sh
    
    rounded size = 34361835520
  4. Resize the virtual appliance image using the rounded size.

    $ qemu-img resize -f raw <image-name.raw> <rounded_size>
    
    Example:
    
    $ qemu-img resize -f raw cfme-azure-5.8.2.3-1.x86_64.raw 34361835520
    
    Image resized.
  5. Convert the appliance image to a fixed-size .vhd file.

    $ qemu-img convert -f raw -o subformat=fixed,force_size -O vpc <image-name.raw> <image-name.vhd>
    
    Example:
    
    qemu-img convert -f raw -o subformat=fixed,force_size -O vpc cfme-azure-5.8.2.3-1.x86_64.raw cfme-azure-5.8.2.3-1.x86_64.vhd
  6. Get the virtual size for the .vhd file.

    $ qemu-img info --output=json -f vpc <path-to-image>
    
    Example:
    
    $ qemu-img info --output=json -f vpc cfme-azure-5.8.2.3-1.x86_64.vhd
    
    {
      "virtual-size": 34361835520,
      "filename": "cfme-azure-5.8.2.3-1.x86_64.vhd",
      "format": "vpc",
      "actual-size": 3158839296,
      "dirty-flag": false
    }
  7. Divide the virtual-size value by 1024, twice. If the result is a whole number, the .vhd file is aligned properly. The example below shows that the file is properly aligned.

    34361835520 / 1024 / 1024 = 32770

qemu-img version 2.7.1 is used in this procedure. Check the qemu-img version using the command: yum info qemu-img. If the version is lower than 2.2.1, remove the option force_size from the conversion command, for example, subformat=fixed.

The ManageIQ Azure virtual appliance image is ready for uploading and provisioning in Microsoft Azure.

1.2.2. Uploading the ManageIQ Virtual Appliance Using Azure Powershell Script

Complete the following steps to upload the ManageIQ virtual appliance image you converted to a fixed-size VHD format and properly aligned per requirement using the procedure in Converting and Aligning the ManageIQ Virtual Appliance Image.

Make sure Azure Resource Manager cmdlets are available. See To install the cmdlets section in Azure Resource Manager Cmdlets.

  1. Log in to Azure Resource Manager using the cmdlet:

    ## Customize for Your Environment
    $SubscriptionName = "my subscription"
    
    Login-AzureRmAccount
    Select-AzureRmSubscription -SubscriptionName $SubscriptionName

    When prompted, enter your user name and password for the Azure Portal.

  2. Upload the .vhd file to a storage account. As shown in the example script below, you will first create a Resource Group through the Portal UI or Powershell. Additionally, create the storage container defined in "BlobDestinationContainer" in advance.

    Example Script:
    
    ## Customize for Your Environment
    $SubscriptionName = "my subscription"
    
    $ResourceGroupName = "test"
    $StorageAccountName = "test"
    
    $BlobNameSource = "cfme-test.vhd"
    $BlobSourceContainer = "templates"
    $LocalImagePath = "C:\tmp\$BlobNameSource"
    
    ##
    
    # Upload VHD to a "templates" directory. You can pass a few arguments, such as `NumberOfUploaderThreads 8`. The default number of uploader threads is `8`. See https://msdn.microsoft.com/en-us/library/mt603554.aspx
    
    Add-AzureRmVhd -ResourceGroupName $ResourceGroupName -Destination https://$StorageAccountName.blob.core.windows.net/$BlobSourceContainer/$BlobNameSource -LocalFilePath $LocalImagePath -NumberOfUploaderThreads 8
  3. Create a virtual machine. Then, define your VM and VHD name, your system/deployment name and size. Next, you will set the appropriate Storage, Network and Configuration options for your environment.

    Example Script:
    
    ## Customize for Your Environment
    
    $BlobNameDest = "cfme-test.vhd"
    $BlobDestinationContainer = "vhds"
    $VMName = "cfme-test"
    $DeploySize= "Standard_A3"
    $vmUserName = "user1"
    
    $InterfaceName = "test-nic"
    $VNetName = "test-vnet"
    $PublicIPName = "test-public-ip"
    
    $SSHKey = <your ssh public key>
    
    ##
    
    $StorageAccount = Get-AzureRmStorageAccount -ResourceGroup $ResourceGroupName -Name $StorageAccountName
    
    $SourceImageUri = "https://$StorageAccountName.blob.core.windows.net/templates/$BlobNameSource"
    $Location = $StorageAccount.Location
    $OSDiskName = $VMName
    
    # Network
    $Subnet1Name = "default"
    $VNetAddressPrefix = "10.1.0.0/16"
    $VNetSubnetAddressPrefix = "10.1.0.0/24"
    $PIp = New-AzureRmPublicIpAddress -Name $PublicIPName -ResourceGroupName $ResourceGroupName -Location $Location -AllocationMethod Dynamic -Force
    $SubnetConfig = New-AzureRmVirtualNetworkSubnetConfig -Name $Subnet1Name -AddressPrefix $VNetSubnetAddressPrefix
    $VNet = New-AzureRmVirtualNetwork -Name $VNetName -ResourceGroupName $ResourceGroupName -Location $Location -AddressPrefix $VNetAddressPrefix -Subnet $SubnetConfig -Force
    $Interface = New-AzureRmNetworkInterface -Name $InterfaceName -ResourceGroupName $ResourceGroupName -Location $Location -SubnetId $VNet.Subnets[0].Id -PublicIpAddressId $PIp.Id -Force
    
    # Specify the VM Name and Size
    $VirtualMachine = New-AzureRmVMConfig -VMName $VMName -VMSize $DeploySize
    
    # Add User
    $cred = Get-Credential -UserName $VMUserName -Message "Setting user credential - use blank password"
    $VirtualMachine = Set-AzureRmVMOperatingSystem -VM $VirtualMachine -Linux -ComputerName $VMName -Credential $cred
    
    # Add NIC
    $VirtualMachine = Add-AzureRmVMNetworkInterface -VM $VirtualMachine -Id $Interface.Id
    
    # Add Disk
    $OSDiskUri = $StorageAccount.PrimaryEndpoints.Blob.ToString() + $BlobDestinationContainer + "/" + $BlobNameDest
    
    $VirtualMachine = Set-AzureRmVMOSDisk -VM $VirtualMachine -Name $OSDiskName -VhdUri $OSDiskUri -CreateOption fromImage -SourceImageUri $SourceImageUri -Linux
    
    # Set SSH key
    Add-AzureRmVMSshPublicKey -VM $VirtualMachine -Path “/home/$VMUserName/.ssh/authorized_keys” -KeyData $SSHKey
    
    # Create the VM
    New-AzureRmVM -ResourceGroupName $ResourceGroupName -Location $Location -VM $VirtualMachine

These are the procedural steps as of the time of writing. For more information, see the following Azure documentation.

The steps covered in the following article are for a Windows machine, however, most of the items are common between Windows and Linux.

1.2.3. Uploading and Provisioning the ManageIQ Virtual Appliance Using Azure Command-Line Interface

You can upload the appliance to an Azure environment using the Azure Command-Line Interface (Azure CLI) following the process below.

Install Azure CLI 2.0:

Complete the steps below to install Azure CLI 2.0 using curl. See https://docs.microsoft.com/en-us/cli/azure/install-azure-cli for other installation methods.

  1. Make sure Python is updated and install the prerequisite packages.

    $ sudo yum update
    $ sudo yum install -y gcc libffi-devel python-devel openssl-devel
  2. Install Azure CLI 2.0.

    $ curl -L https://aka.ms/InstallAzureCli | bash
  3. Export Azure environment variables.

    $ export AZURE_STORAGE_ACCOUNT=<azure-storage-account-name>
    $ export AZURE_STORAGE_KEY="<azure-storage-account-key>"
    
    Example:
    
    $ export AZURE_STORAGE_ACCOUNT=xyzgroup9401
    $ export AZURE_STORAGE_KEY="zG7Dc29I7ysKik/Xiqk3tQN43CtLpObmJom+Hze6ko/ZiwXhdElknABzUbZ/zie5vW1XyTlGsgbaVf0fUijf2w=="
Upload and Provision the ManageIQ Virtual Appliance Using Azure CLI:

Complete the following steps to upload and provision the ManageIQ virtual appliance you converted to a fixed-size VHD format and properly aligned per requirement using the procedure in Converting and Aligning the ManageIQ Virtual Appliance Image.

  1. Upload the image to the storage container. It may take several minutes. Note: Enter az storage container list to get the list of storage containers.

    $ az storage blob upload --account-name <storage-account-name> --container-name <container-name> --type page --file <path-to-vhd> --name <image-name>.vhd
    
    Example:
    
    $ az storage blob upload --account-name azrhelclistact --container-name azrhelclistcont --type page --file cfme-azure-5.8.2.3-1.x86_64.vhd --name cfme-azure-5.8.2.3-1.x86_64.vhd
    
    Finished[#############################################################]  100.0000%
  2. Get the URL for the uploaded .vhd file using the following command. You will need to use this URL in the next step.

    $ az storage blob url -c <container-name> -n <image-name>.vhd
    
    Example:
    
    $ az storage blob url -c azrhelclistcont -n cfme-azure-5.8.2.3-1.x86_64.vhd
    
    "https://azrhelclistact.blob.core.windows.net/azrhelclistcont/cfme-azure-5.8.2.3-1.x86_64.vhd"
  3. Log in to Azure.

    $ az login
    
    Example:
    
    To sign in, use a web browser to open the page https://aka.ms/devicelogin and enter the code GJP8Y33XY to authenticate.
    
    [
      {
        "cloudName": "AzureCloud",
        "id": "528c646b-83jb-4527-1a04-10d294fd0cc2",
        "isDefault": true,
        "name": "Demo Azure account",
        "state": "Enabled",
        "tenantId": "7e7cfe6b-cff0-e4d8-a446-57a76c9b4958",
        "user": {
          "name": "clouduser",
          "type": "user"
        }
      }
    ]
  4. Create the virtual machine. Note that the following command uses --generate-ssh-keys. In this example, the private/public key pair /home/clouduser/.ssh/id_rsa and /home/clouduser/.ssh/id_rsa.pub are created.

    $ az vm create --resource-group <resource-group> --location <azure-region> --use-unmanaged-disk --name <vm-name> --storage-account <storage-account-name> --os-type linux --admin-username <administrator-name> --generate-ssh-keys --image <URL>
    
    Example:
    
    az vm create --resource-group azrhelclirsgrp --location southcentralus --use-unmanaged-disk --name cfme-appliance-1 --storage-account azrhelclistact --os-type linux --admin-username clouduser --generate-ssh-keys --image https://azrhelclistact.blob.core.windows.net/azrhelclistcont/cfme-azure-5.8.2.3-1.x86_64.vhd
    
    {
      "fqdns": "",
      "id": "/subscriptions//resourceGroups/azrhelclirsgrp/providers/Microsoft.Compute/virtualMachines/cfme-appliance-1",
      "location": "southcentralus",
      "macAddress": "00-0X-XX-XX-XX-XX",
      "powerState": "VM running",
      "privateIpAddress": "10.0.0.4",
      "publicIpAddress": "12.84.121.147",
      "resourceGroup": "azrhelclirsgrp"
    }

    Make a note of the public IP address. You will need this to log in to the virtual machine in the next step.

  5. Start an SSH session and log in to the appliance.

    $ ssh -i <path-to-ssh-key> <admin-username@public-IP-address>
    
    Example:
    
    $ ssh  -i /home/clouduser/.ssh/id_rsa clouduser@12.84.121.147
    The authenticity of host '12.84.121.147' can't be established.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '12.84.121.147' (ECDSA) to the list of known hosts.
    
    Welcome to the Appliance Console
    
    For a menu, please type: appliance_console
  6. Enter sudo appliance_console at the prompt. The summary screen appears.

You have successfully provisioned a ManageIQ virtual appliance in Microsoft Azure.

The exported storage connection string does not persist after a system reboot. If any of the commands in the above steps fail, export the storage connection string again using the following commands:

  1. Get the storage account connection string.

    $ az storage account show-connection-string -n <storage-account-name> -g <resource-group>
    
    Example:
    
    $ az storage account show-connection-string -n azrhelclistact -g azrhelclirsgrp
    {
      "connectionString": "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=azrhelclistact;AccountKey=NreGk...=="
    }
  2. Export the connection string. Copy the connection string and paste it into the following command. This connects your system to the storage account.

    $ export AZURE_STORAGE_CONNECTION_STRING="<storage-connection-string>"
    
    Example:
    
    $ export AZURE_STORAGE_CONNECTION_STRING="DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=azrhelclistact;AccountKey=NreGk...=="