第 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.
To create a 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.注意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.
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.