Red Hat Training

A Red Hat training course is available for RHEL 8

5.7. Pushing VHD images to Azure cloud

The ability to push the output image you create to the Azure Blob Storage is available. This section describes steps to push .vhd images you create using Image Builder to Azure Cloud service provider.

Prerequisites

  • You must have root access to the system.
  • You have opened the Image Builder interface of the RHEL 8 web console in a browser.
  • You must have a Storage Account created.
  • You must have a writable Blob Storage prepared.

Procedure

  1. Click Create blueprint to create a blueprint. See more at Creating an Image Builder blueprint in the web console interface.
  2. Select the components and packages that you want as part of the image you are creating.
  3. Click Commit to commit the changes you made to the blueprint.

    A small pop-up on the upper right side informs you of the saving progress and then the result of the changes you commited.

  4. Click blueprint name link on the left banner.
  5. Select the tab Images.
  6. Click Create Image to create your customized image.

    A pop-up window opens.

    1. From the "Type" drop-down menu list, select the Azure Disk Image (.vhd) image.
    2. Check the "Upload to Azure" check box to upload your image to the Azure Cloud and click Next.
    3. To authenticate your access to Azure, type your "Storage account" and "Storage access key" in the corresponding fields. Click Next.

      You can find your Storage account details in the Settings→Access Key menu list.

    4. Type a "Image name" to be used for the image file that will be uploaded and the Blob "Storage container" in which the image file you want to push the image into. Click Next.
    5. Review the information you provided and once you are satisfied, click Finish.

      Optionally, you can click Back to modify any incorrect detail.

  7. A small pop-up on the upper right side displays when the image creation process starts with the message: "Image creation has been added to the queue".

    Once the image process creation is complete, click the blueprint you created an image from. You can see the "Image build complete" status for the image you created within the Images tab.

  8. To access the image you pushed into Azure Cloud, access Azure Portal.
  9. On the search bar, type Images and select the first entry under Services. You are redirected to the Image dashboard.
  10. Click +Add. You are redirected to the Create an Image dashboard.

    Insert the below details:

    1. Name: Choose a name for your new image.
    2. Resource Group: Select a resource group.
    3. Location: Select the location that matches the regions assigned to your storage account. Otherwise you will not be able to select a blob.
    4. OS Type: Set the OS type to Linux.
    5. VM Generation: Keep the VM generation set on Gen 1.
    6. Storage Blob: Click Browse on the right of Storage blob input. Use the dialog to find the image you uploaded earlier.

      Keep the remaining fields as in the defaults choice.

  11. Click Create to create the image. Once the image is created, you can see the message "Successfully created image" in the upper right corner.
  12. Click Refresh to see your new image and open your newly created image.
  13. Click + Create VM. You are redirected to the Create a virtual machine dashboard.
  14. In the Basic tab, under Project Details, your *Subscription and the Resource Group are already pre-set.

    If you want to create a new resource Group

    1. Click Create new.

      A pop-up prompts you to create the Resource Group Name container.

    2. Insert a name and click OK.

      If you want to keep the Resource Group that are already pre-set.

  15. Under Instance Details, insert:

    1. Virtual machine name
    2. Region
    3. Image: The image you created is pre-selected by default.
    4. Size: Choose a VM size that better suits your needs.

      Keep the remaining fields as in the defaults choice.

  16. Under Administrator account, enter the below details:

    1. Username: the name of the account administrator.
    2. SSH public key source: from the drop-down menu, select Generate new key pair.

      You can either use the key pair you already have or you can create a new key pair. Alternatively, you can use Image Builder to add a user to the image with a preset public key. See Creating a user account with SSH key for more details.

    3. Key pair name: insert a name for the key pair.
  17. Under Inbound port rules, select:

    1. Public inbound ports: Allow selected ports.
    2. Select inbound ports: Use the default set SSH (22).
  18. Click Review + Create. You are redirected to the Review + create tab and receive a confirmation that the validation passed.
  19. Review the details and click Create.

    Optionally, you can click Previous to fix previous options selected.

  20. A pop-up generates new key pair window opens. Click Download private key and create resources.

    Save the key file as "yourKey.pem".

  21. Once the deployment is complete, click Go to resource.
  22. You are redirected to a new window with your VM details. Select the public IP address on the top right side of the page and copy it to your clipboard.

Now, to create an SSH connection with the VM to connect to the Virtual Machine.

  1. Open a terminal.
  2. At your prompt, open an SSH connection to your virtual machine. Replace the IP address with the one from your VM, and replace the path to the .pem with the path to where the key file was downloaded.

    # ssh -i ./Downloads/yourKey.pem azureuser@10.111.12.123
  3. You are required to confirm if you want to continue to connect. Type yes to continue.

As a result, the output image you pushed to the Azure Storage Blob is ready to be provisioned.