3.11. Launching and connecting to a RHEL VM in Azure


You need to create a managed disk Azure VM from the image.

Prerequisites

Procedure

  1. Create the VM:

    $ az vm create \
        -g <resource_group> -l <azure_region> -n <vm_name> \
        --vnet-name <vnet_name> --subnet <subnet_name> --size Standard_A2 \
        --os-disk-name <simple_name> --admin-username <administrator_name> \
        --generate-ssh-keys --image <path_to_image>

    Example:

    $ az vm create \
    -g azrhelclirsgrp2 -l southcentralus -n rhel-azure-vm-1 \ 
    1
    
    --vnet-name azrhelclivnet1 --subnet azrhelclisubnet1 --size Standard_A2 \
    --os-disk-name vm-1-osdisk --admin-username clouduser \ 
    2
    
    --generate-ssh-keys --image rhel10
    
    {
      "fqdns": "",
      "id": "/subscriptions//resourceGroups/azrhelclirsgrp/providers/Microsoft.Compute/virtualMachines/rhel-azure-vm-1",
      "location": "southcentralus",
      "macAddress": "",
      "powerState": "VM running",
      "privateIpAddress": "10.0.0.4",
      "publicIpAddress": "<public_ip_address>",
      "resourceGroup": "azrhelclirsgrp2"
    }
    • --generate-ssh-keys option creates a private and public key pair files in the ~/.ssh directory.
    • The public key is added to the authorized_keys file on the VM for the user specified by the --admin-username option.

      For details, see Types of SSH authentication methods. Note the publicIpAddress, which you will need to log in to the VM in the following step.

  2. Start an SSH session and log in to the Azure VM:

    [clouduser@localhost]$ ssh -i /home/clouduser/.ssh/id_rsa clouduser@<public_ip_address>
    
    The authenticity of host '<public_ip_address>' can't be established.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added '<public_ip_address>' (ECDSA) to the list of known hosts.

Verification

Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部