Este contenido no está disponible en el idioma seleccionado.

Chapter 16. Preparing and uploading VHD images to Microsoft Azure


You can create custom images and update them, either manually or automatically, on the Microsoft Azure cloud by using RHEL image builder.

16.1. Preparing to upload Microsoft Azure VHD images manually

To create a virtual hard drive (VHD) image that you can manually upload to the Microsoft Azure cloud, you can use RHEL image builder.

Prerequisites

  • You must have a Microsoft Azure resource group and storage account.
  • You have Python installed. The AZ CLI tool depends on Python.

Procedure

  1. Import the Microsoft repository key:

    $ sudo rpm --import https://packages.microsoft.com/keys/microsoft-2025.asc
  2. Create a packages-microsoft-com-prod repository:

    [azure-cli]
    name=Azure CLI
    baseurl=https://packages.microsoft.com/yumrepos/packages.microsoft.com/rhel/10/prod/
    enabled=1
    gpgcheck=1
    gpgkey=https://packages.microsoft.com/keys/microsoft.asc
  3. Install Microsoft Azure CLI. The downloaded version of the Microsoft Azure CLI package can vary depending on the currently available version.

    $ sudo dnf install azure-cli
  4. Run Microsoft Azure CLI:

    $ az login

    The terminal shows the following message: Note, we have launched a browser for you to login. For old experience with device code, use az login --use-device-code. Then, the terminal opens the Login from where you can log in.

    Note

    If you are running a remote (SSH) session, the login page link does not open in the browser. In this case, you can copy the link to a browser and log in to authenticate your remote session. To sign in, use a web browser to open the Login page and enter the device code to authenticate.

  5. List the keys for the storage account in Microsoft Azure and make note of the value key1 from the output of the previous command.

    $ az storage account keys list --resource-group <resource_group_name> --account-name <account_name>

    Replace resource-group-name with the name of your Microsoft Azure resource group and storage-account-name with the name of your Microsoft Azure storage account.

    1. To list the available resources using the following command:

      $ az resource list
  6. Create a storage container:

    $ az storage container create --account-name <storage_account_name> \
    --account-key <key1_value> --name <storage_account_name>

    Replace storage-account-name with the name of the storage account.

16.2. Manually uploading VHD images to Microsoft Azure cloud

Create your customized virtual hard disk (VHD) image, and manually upload it to the Microsoft Azure cloud. When you create a .vhd image by using the CLI, RHEL image builder writes temporary files to the /var subdirectory.

Note

The partition and filesystem configurations in your blueprint determine .vhd image size. Insufficient storage might cause a “No space left on device” error. Ensure /var has at least 15 to 20 GB of free space.

Prerequisites

  • Your system must be set up for uploading Microsoft Azure VHD images.
  • You have an Azure access key storage account.

Procedure

  1. Create a azure.toml blueprint, and add the following information to it:

    provider = "azure"
    
    [settings]
    storageAccount = "<your-storage-account-name>"
    storageAccessKey = "<storage-access-key-you-copied-in-the-Azure-portal>"
    container = "<your-storage-container-name>"
  2. Build the image, passing the following arguments:

    $ image-builder build <your-blueprint> vhd <your-image-key> azure.toml

    Replace <your-image-key> with the name of the image that you want.

  3. Push the image to Microsoft Azure and create an instance from it:

    $ az storage blob upload --account-name <account-name> --container-name <container-name> --file <image-disk>.vhd --name image-disk.vhd --type page
  4. After the upload to the Microsoft Azure Blob storage completes, create a Microsoft Azure image from it. The images that you create with RHEL image builder generate hybrid images that support V1 = BIOS and V2 = UEFI. Use --hyper-v-generation to specify instance type. V1 is the default.

    $ az image create --resource-group resource_group_name --name image-disk.vhd --os-type linux --location location \
    --source https://$account_name.blob.core.windows.net/container_name/image-disk.vhd
    - Running

Verification

  1. Create an instance either with the Microsoft Azure portal, or a command similar to the following:

    $ az vm create --resource-group resource_group_name --location location --name vm_name --image image-disk.vhd(--admin-username azure-user --generate-ssh-keys*
    - Running
  2. Use your private key by using SSH to access the resulting instance. Log in as azure-user.

By using RHEL image builder, you can create .vhd images, which are automatically uploaded to an Azure Blob Storage in the Microsoft Azure Cloud service provider.

Prerequisites

Procedure

  1. In the RHEL image builder dashboard, select your blueprint, click the Images tab, and click Create Image to create your customized .vhd image.
  2. Select Microsoft Azure (.vhd) from the Type drop-down, check Upload to Azure, enter the Image Size, and click Next.
  3. Enter your Storage account name and your Storage access key then, click Next.
  4. Review the configuration and click Create. The RHEL image builder and upload processes start.
  5. In the Microsoft Azure portal navigate to Storage accounts > Containers and verify if your .vhd is present.

Verification

  1. In the Azure portal search bar, type Images and click +Create. Configure the following details:

    • Select your resource group and enter an image name.
    • Set OS type to Linux and VM generation to Gen 2.
    • Under Storage Blob, browse to select your VHD file.
    • Choose an Account Type, for example, Standard SSD.
  2. Click Review + Create, and then Create. Wait for the image creation to complete.
  3. Click Go to resource, then click Create VM. Enter a VM name, configure the Size and Administrator account sections, then click Review + Create and Create.
  4. After the deployment finishes, retrieve the public IP address and connect by using SSH.

    $ ssh <username>@<public-IP-address>

Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2026 Red Hat
Volver arriba