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 Copiar enlaceEnlace copiado en el portapapeles!
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 CLItool depends on Python.
Procedure
Import the Microsoft repository key:
$ sudo rpm --import https://packages.microsoft.com/keys/microsoft-2025.ascCreate a
packages-microsoft-com-prodrepository:[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.ascInstall Microsoft Azure CLI. The downloaded version of the Microsoft Azure CLI package can vary depending on the currently available version.
$ sudo dnf install azure-cliRun Microsoft Azure CLI:
$ az loginThe 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.NoteIf 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.
List the keys for the storage account in Microsoft Azure and make note of the value
key1from the output of the previous command.$ az storage account keys list --resource-group <resource_group_name> --account-name <account_name>Replace
resource-group-namewith the name of your Microsoft Azure resource group andstorage-account-namewith the name of your Microsoft Azure storage account.To list the available resources using the following command:
$ az resource list
Create a storage container:
$ az storage container create --account-name <storage_account_name> \ --account-key <key1_value> --name <storage_account_name>Replace
storage-account-namewith the name of the storage account.
16.2. Manually uploading VHD images to Microsoft Azure cloud Copiar enlaceEnlace copiado en el portapapeles!
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.
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
Create a
azure.tomlblueprint, 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>"Build the image, passing the following arguments:
$ image-builder build <your-blueprint> vhd <your-image-key> azure.tomlReplace <your-image-key> with the name of the image that you want.
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 pageAfter 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 = BIOSandV2 = UEFI. Use--hyper-v-generationto specify instance type.V1is 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
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-
Use your private key by using SSH to access the resulting instance. Log in as
azure-user.
16.3. Creating and automatically uploading VHD images to Microsoft Azure cloud Copiar enlaceEnlace copiado en el portapapeles!
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
- You have root access to the system.
- You have access to the RHEL image builder interface of the RHEL web console.
- You created a blueprint. See Creating a RHEL image builder blueprint in the web console interface.
- You have a Microsoft Storage Account created.
- You have a writable Blob Storage prepared.
Procedure
-
In the RHEL image builder dashboard, select your blueprint, click the Images tab, and click Create Image to create your customized
.vhdimage. -
Select
Microsoft Azure (.vhd)from the Type drop-down, check Upload to Azure, enter the Image Size, and click Next. - Enter your Storage account name and your Storage access key then, click Next.
- Review the configuration and click Create. The RHEL image builder and upload processes start.
-
In the Microsoft Azure portal navigate to Storage accounts > Containers and verify if your
.vhdis present.
Verification
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.
- Click Review + Create, and then Create. Wait for the image creation to complete.
- 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.
After the deployment finishes, retrieve the public IP address and connect by using SSH.
$ ssh <username>@<public-IP-address>