Chapter 7. Creating RHEL system image and uploading to Microsoft Azure using Red Hat Image Builder
You can create customized RHEL system images using Red Hat Image Builder, and upload those images to the Microsoft Azure cloud target environment. Then, you can create a Virtual Machine (VM) from the image you shared with the Microsoft Azure Cloud account.
7.1. Authorizing Red Hat Image Builder to push images to Microsoft Azure Cloud
Authorize Red Hat Image Builder to push images to the Microsoft Azure cloud. For that, you must:
- Configure Red Hat Image Builder as an authorized application for your tenant GUID
Give it the role of
Contributorto at least one resource group.
To authorize Red Hat Image Builder as an authorized application, follow the steps:
- You have an existing Resource Group in Microsoft Azure portal.
You have the
User Access Administratorrole rights.
Your Microsoft Azure subscription has
Microsoft.Computeas a resource provider.
Access Red Hat Image Builder on a browser.
The Red Hat Image Builder dashboard appears.
Click Create image.
The Create image dialog wizard opens.
On the Image output page, complete the following steps:
- From the Release list, select the Release that you want to use: for example, choose Red Hat Enterprise Linux (RHEL).
From the Select target environments option, select
On the Target Environment - Microsoft Azure window, to add Red Hat Image Builder as an authorized application, complete the following steps:
Insert your Tenant GUID.
Image Builder checks f your Tenant GUID is correctly formatted and the Authorize Image Builder button becomes available.
Click Authorize Image Builder to authorize Red Hat Image Builder to push images to the Microsoft Azure cloud.
This redirects you to the Microsoft Azure portal.
- Login with your credentials.
- Click Accept the Permission requested.
Confirm that Red Hat Image Builder is authorized for your tenant.
Azure Active Directoryand choose Enterprise applications, from the left menu.
- Search for Red Hat Image Builder and confirm it is authorized.
- Search for
Add the Enterprise application as a contributor to your
In the search bar, type
Resource Groupsand select the first entry under Services. This redirects you to the
- On the left menu, click Access control (IAM) to add a permission so the Red Hat Image Builder application can access your resource group.
- From the menu, click the tab Role assignments.
- Click +Add.
- From the dropdown menu, choose Add role assignment. A menu appears on the left side.
Insert the following details:
Role: Assign the
Assign access to: User, group, service principal. Add members: Click
+Select membersand type Red Hat in the search bar. Press enter.
Red Hat Image Builderapplication
- Role: Assign the
- In the search bar, type
The Red Hat Image Builder application is now authorized to push images to Microsoft Azure cloud.
Even though any user can add an application to the resources group, the application is not able to locate any resource unless the account administrator adds the shared application as a contributor under the
IAM section of the resource group. .
From the menu, click the tab Role assignments.
You can see Red Hat Image Builder set as a
Resource Groupyou selected.
7.2. Creating a customized RHEL system image for Microsoft Azure using Image Builder
After you authorize Image Builder to push images to Microsoft Azure, create customized system images using Image Builder and upload those images to Microsoft Azure. For that, follow the steps:
- You have created an Azure Storage Account.
- You have a Storage account created.
- You authorized Image Builder to push images to Microsoft Azure. See Authorizing Red Hat Image Builder to push images to Microsoft Azure Cloud.
On the Target Environment - Microsoft Azure window, complete the following steps:
- Enter your Tenant GUID: you can find your Tenant ID in the Azure Active Directory application in Microsoft Azure Portal.
- Enter your Subscription ID: you can find your Subscription ID account by accessing the Microsoft Azure console.
Enter your Resource group: is the name of your Resource Group in Microsoft Azure Portal.
On the Registration page, select the type of registration that you want to use. You can select from these options:
- Register images with Red Hat - Register and connect image instances, subscriptions and insights with Red Hat. For details on how to embed an activation key and register systems on first boot, see Chapter 3, Creating a customized system image with an embed subscription using Red Hat Image Builder.
- Register image instances only - Register and connect only image instances and subscriptions with Red Hat.
Register later - Register the system after the image creation.
- Optional: On the Packages page, add packages to your image. See Chapter 4, Adding packages during image creation by Using Red Hat Image Builder.
- On the Name image page, enter a name for your image and click Next. If you do not enter a name, you can find the image you created by its UUID.
On the Review page, review the details about the image creation and click Create image.
After you complete the steps in the Create image wizard, the Image Builder dashboard is displayed.
Red Hat Image Builder starts the compose of a RHEL Azure Disk Image image for the
x86_64architecture, uploads it to the resource group account you specified, and creates an
The Red Hat Image Builder Images dashboard opens. You can see details such as the Image UUID, the cloud target environment, the image OS release and the status of the image creation. After the status is Ready, the Azure Disk Image is shared with the specified account.
On the dashboard, you can see details such as the Image UUID, the cloud target environment, the image OS release and the status of the image creation.
- Pending: the image upload and cloud registration is being processed.
- In Progress: the image upload and cloud registration is ongoing.
- Ready: the image upload and cloud registration is completed
Failed: the image upload and cloud registration failed.Note
The image build, upload and cloud registration processes can take up to ten minutes to complete.
- Check if the image status is Ready. It means that the image upload and cloud registration completed successfully.
7.3. Accessing your customized RHEL system image from your Microsoft Azure account
After you have build and uploaded the image, and the cloud registration process status is marked as Ready, you can access the Azure Disk Image from your Microsoft Azure account.
- You have access to your Microsoft Azure dashboard.
- Access your Microsoft Azure dashboard and navigate to the Resource group page.
After you access your Microsoft Azure Account, you can see that the image successfully shared with the resource group account you specified.Note
If the image is not visible there, you may have issues with the upload process. Return to the Red Hat Image Builder dashboard and check if the image is marked as Ready.
7.4. Creating a VM from the RHEL system image shared with the Azure account
You can create a Virtual Machine (VM) from the image you shared with the Microsoft Azure Cloud account by using Red Hat Image Builder.
- You must have a Microsoft AzureStorage Account created.
- You must have uploaded the required image to the Microsoft Azure Cloud account.
- Click + Create VM. You are redirected to the Create a virtual machine dashboard.
In the Basic tab under Project Details, your Subscription and the Resource Group are pre-set.
Optional: If you want to create a new resource Group:
Click Create new.
A pop-up prompts you to create the Resource Group Name container.
Insert a name and click OK.
If you want to keep the Resource Group that is already pre-set.
Under Instance Details, insert:
- Virtual machine name
Size: Choose a VM size that better suits your needs.
Keep the remaining fields as in the default choice.
Under Administrator account, enter the following details:
- Username: the name of the account administrator.
- SSH public key source: from the drop-down menu, select Generate new key pair.
- Key pair name: insert a name for the key pair.
Under Inbound port rules:
- Public inbound ports: select Allow selected ports.
- Select inbound ports: Use the default set SSH (22).
- Click Review + Create. You are redirected to the Review + create tab. You receive a confirmation that the validation passed.
Review the details and click Create.
To change options, click Previous.
A Generates New Key Pair pop-up opens. Click Download private key and create resources.
Save the key file in the yourKey.pem file format.
After the deployment is complete, click Go to resource.
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.
Create an SSH connection to connect to the Virtual Machine you created. For that, follow the steps:
- Open a terminal.
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
.pemfile with the path to where the key file was downloaded.
# ssh -i <yourKey.pem file location> <username>@<IP_address>
- Add the user name and replace the IP address with the one from your VM.
Replace the path to the .pem file with the path to where the key file was downloaded.
# ssh -i ./Downloads/yourKey.pem email@example.com
You are required to confirm if you want to continue to connect. Type
As a result, the output image you shared with the Azure Storage account is started and ready to be provisioned.Note
The default user is
azureuserand the password is