Chapter 16. Provisioning Cloud Instances on Microsoft Azure Resource Manager


Red Hat Satellite can interact with Microsoft Azure Resource Manager, including creating new virtual machines and controlling their power management states. Only image-based provisioning is supported for creating Azure hosts. This includes provisioning using Marketplace images, custom images, and shared image gallery.

For more information about Azure Resource Manager concepts, see Azure Resource Manager documentation.

Note that Satellite does not support Azure Government.

Prerequisites

  • Synchronized content repositories for Red Hat Enterprise Linux. For more information, see Synchronizing Red Hat Repositories in the Content Management Guide.
  • An activation key for host registration. For more information, see Creating An Activation Key in the Content Management guide.
  • Ensure that you have the correct permissions to create an Azure Active Directory application. For more information, see Check Azure AD permissions in the Microsoft identity platform (Azure Active Directory for developers) documentation.
  • You must create and configure an Azure Active Directory application and service principle to obtain Application or client ID, Directory or tenant ID, and Client Secret. For more information, see Use the portal to create an Azure AD application and service principal that can access resources in the Microsoft identity platform (Azure Active Directory for developers) documentation.
  • Optional: If you want to use Puppet with Azure hosts, navigate to Administer > Settings > Puppet and enable the Use UUID for certificates setting to configure Puppet to use consistent Puppet certificate IDs.
  • Based on your needs, associate a finish or user_data provisioning template with the operating system you want to use. For more information about provisioning templates, see Section 2.11, “Provisioning Templates”.
  • Optional: If you want the virtual machine to use a static private IP address, create a subnet in Satellite with the Network Address field matching the Azure subnet address.
  • Before creating RHEL BYOS images, you must accept the image terms either in the Azure CLI or Portal so that the image can be used to create and manage virtual machines for your subscription.

16.1. Adding a Microsoft Azure Resource Manager Connection to Satellite Server

Use this procedure to add Microsoft Azure Resource Manager as a compute resource in Satellite. Note that you must add a separate compute resource for each Azure Resource Manager region that you want to use.

Procedure

  1. In the Satellite web UI, navigate to Infrastructure > Compute Resources and click Create Compute Resource.
  2. In the Name field, enter a name for the compute resource.
  3. From the Provider list, select Azure Resource Manager.
  4. Optional: In the Description field, enter a description for the resource.
  5. In the Client ID field, enter the Application or client ID.
  6. In the Client Secret field, enter the client secret.
  7. In the Subscription ID field, enter the subscription ID.
  8. In the Tenant ID field, enter the Directory or tenant ID.
  9. Click Load Regions. This tests if your connection to Azure Resource Manager is successful and loads the regions available in your subscription.
  10. From the Azure Region list, select the Azure region to use.
  11. Click Submit.

For CLI Users

  • Use the hammer compute-resource create command to add an Azure compute resource to Satellite. Note that the value for the --region option must be in lowercase and must not contain special characters.

    # hammer compute-resource create --name azure_cr_name \
    --provider azurerm \
    --tenant tenant-id \
    --app-ident client-id \
    --secret-key client-secret \
    --sub-id subscription-id \
    --region 'region'

16.2. Adding Microsoft Azure Resource Manager Images to Satellite Server

To create hosts using image-based provisioning, you must add information about the image, such as access details and the image location, to your Satellite Server.

Procedure

  1. In the Satellite web UI, navigate to Infrastructure > Compute Resources and click the name of the Microsoft Azure Resource Manager connection.
  2. Click Create Image.
  3. In the Name field, enter a name for the image.
  4. From the Operating System list, select the image’s base operating system.
  5. From the Architecture list, select the operating system architecture.
  6. In the Username field, enter the SSH user name for image access. You cannot use the root user.
  7. Optional: In the Password field, enter a password to authenticate with.
  8. In the Azure Image Name field, enter an image name in the format prefix://UUID.

    • For a custom image, use the prefix custom. For example, custom://image-name.
    • For a shared gallery image, use the prefix gallery. For example, gallery://image-name.
    • For public and RHEL Bring Your Own Subscription (BYOS) images, use the prefix marketplace. For example, marketplace://OpenLogicCentOS:7.5:latest.

      For more information, see Find Linux VM images in the Azure Marketplace with the Azure CLI.

  9. Optional: Select the User Data check box if the image supports user data input, such as cloud-init data.
  10. Click Submit to save the image details.

For CLI Users

  • Create the image with the hammer compute-resource image create command. Note that the username that you enter for the image must be the same that you use when you create a host with this image. The --password option is optional when creating an image. You cannot use the root user.

    # hammer compute-resource image create \
    --name Azure_image_name \
    --compute-resource azure_cr_name \
    --uuid 'marketplace://RedHat:RHEL:7-RAW:latest' \
    --username 'azure_username' \
    --user-data no

16.3. Adding Microsoft Azure Resource Manager Details to a Compute Profile

Use this procedure to add Azure hardware settings to a compute profile. When you create a host on Azure using this compute profile, these settings are automatically populated.

Procedure

  1. In the Satellite web UI, navigate to Infrastructure > Compute Profiles.
  2. In the Compute Profiles window, click the name of an existing compute profile, or click Create Compute Profile, enter a Name, and click Submit.
  3. Click the name of the Azure compute resource.
  4. From the Resource group list, select the resource group to provision to.
  5. From the VM Size list, select a size of a virtual machine to provision.
  6. From the Platform list, select Linux. Satellite does not support provisioning virtual machines running Microsoft operating systems.
  7. In the Username field, enter a user name to authenticate with. Note that the username that you enter for compute profile must be the same that you use when creating an image.
  8. To authenticate the user, use one of the following options:

    • To authenticate using a password, enter a password in the Password field.
    • To authenticate using an SSH key, enter an SSH key in the SSH Key field.
  9. Optional: If you want the virtual machine to use a premium virtual machine disk, select the Premium OS Disk check box.
  10. From the OS Disk Caching list, select the disc caching setting.
  11. Optional: In the Custom Script Command field, enter commands to perform on the virtual machine when the virtual machine is provisioned.
  12. Optional: If you want to run custom scripts when provisioning finishes, in the Comma separated file URIs field, enter comma-separated file URIs of scripts to use. The scripts must contain sudo at the beginning because Red Hat Satellite downloads files to the /var/lib/waagent/custom-script/download/0/ directory on the host and scripts require sudo privileges to be executed.
  13. Optional: If you want to create an additional volume on the VM, click the Add Volume button, enter the Size in GB and select the Data Disk Caching method.
  14. Click Add Interface.
  15. From the Azure Subnet list, select the Azure subnet to provision to.
  16. From the Public IP list, select the public IP setting.
  17. Optional: If you want the virtual machine to use a static private IP, select the Static Private IP check box.
  18. Click Submit.

For CLI Users

  1. Create a compute profile to use with the Azure Resource Manager compute resource:

    # hammer compute-profile create --name compute_profile_name
  2. Add Azure details to the compute profile. With the username setting, enter the SSH user name for image access. Note that the username that you enter for compute profile must be the same that you use when creating an image.

    # hammer compute-profile values create \
    --compute-profile "compute_profile_name" \
    --compute-resource azure_cr_name \
    --compute-attributes="resource_group=resource_group,vm_size=Standard_B1s,username=azure_user,password=azure_password,platform=Linux,script_command=touch /var/tmp/text.txt" \
    --interface="compute_public_ip=Dynamic,compute_network=mysubnetID,compute_private_ip=false"
    --volume="disk_size_gb=5,data_disk_caching=None"

    Optional: If you want to run scripts on the virtual machine after provisioning, specify the following settings:

    • To enter the script directly, with the script_command setting, enter a command to be executed on the provisioned virtual machine.
    • To run a script from a URI, with the script_uris setting, enter comma-separated file URIs of scripts to use. The scripts must contain sudo at the beginning because Red Hat Satellite downloads files to the /var/lib/waagent/custom-script/download/0/ directory on the host and therefore scripts require sudo privileges to be executed.

16.4. Creating Image-based Hosts on Microsoft Azure Resource Manager

In Satellite, you can use Microsoft Azure Resource Manager provisioning to create hosts from an existing image. The new host entry triggers the Microsoft Azure Resource Manager server to create the instance using the pre-existing image as a basis for the new volume.

Procedure

  1. In the Satellite web UI, navigate to Hosts > Create Host.
  2. In the Name field, enter a name for the host.
  3. Click the Organization and Location tabs to ensure that the provisioning context is automatically set to the current context.
  4. From the Host Group list, select the host group that you want to use to populate the form.
  5. From the Deploy on list, select the Microsoft Azure Resource Manager connection.
  6. From the Compute Profile list, select a profile to use to automatically populate virtual machine settings.
  7. From the Lifecycle Environment list, select the environment.
  8. Click the Interfaces tab and click Edit on the host’s interface.
  9. Verify that the fields are automatically populated, particularly the following items:

    • The Name from the Host tab becomes the DNS name.
    • The MAC address field is blank. Microsoft Azure Resource Manager assigns a MAC address to the host during provisioning.
    • The Azure Subnet field is populated with the required Azure subnet.
    • The Managed, Primary, and Provision options are automatically selected for the first interface on the host. If not, select them.
  10. Optional: If you want to use a static private IP address, from the IPv4 Subnet list select the Satellite subnet with the Network Address field matching the Azure subnet address. In the IPv4 Address field, enter an IPv4 address within the range of your Azure subnet.
  11. Click the Operating System tab, and confirm that all fields automatically contain values.
  12. For Provisioning Method, ensure Image Based is selected.
  13. From the Image list, select the Azure Resource Manager image that you want to use for provisioning.
  14. In the Root Password field, enter the root password to authenticate with.
  15. Click Resolve in Provisioning templates to check the new host can identify the right provisioning templates to use.
  16. Click the Virtual Machine tab and confirm that these settings are populated with details from the host group and compute profile. Modify these settings to suit your needs.
  17. Click the Parameters tab, and ensure that a parameter exists that provides an activation key. If not, add an activation key.
  18. Click Submit to save the host entry.

For CLI Users

  • Create the host with the hammer host create command and include --provision-method image. Replace the values in the following example with the appropriate values for your environment.

    # hammer host create \
    --name="Azure_VM" \
    --organization "Your_Organization" \
    --location "Your_Location" \
    --compute-resource azure_cr_name \
    --compute-profile "compute_profile_name" \
    --provision-method 'image' \
    --image Azure_image_name \
    --domain domain_name \
    --architecture x86_64 \
    --operatingsystem "operating_system_name"

For more information about additional host creation parameters for this compute resource, enter the hammer host create --help command.

Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.