diff --git a/content/learning-paths/servers-and-cloud-computing/azure-vm/_index.md b/content/learning-paths/servers-and-cloud-computing/azure-vm/_index.md index 357a8bdcd5..3ee259c09d 100644 --- a/content/learning-paths/servers-and-cloud-computing/azure-vm/_index.md +++ b/content/learning-paths/servers-and-cloud-computing/azure-vm/_index.md @@ -1,23 +1,22 @@ --- title: Create an Azure Linux 3.0 virtual machine with Cobalt 100 processors -draft: true -cascade: - draft: true +minutes_to_complete: 120 -minutes_to_complete: 120 - -who_is_this_for: This Learning Path explains how to create a virtual machine on Azure running Azure Linux 3.0 on Cobalt 100 processors. +who_is_this_for: This is an advanced topic for developers who want to run Azure Linux 3.0 on Arm-based Cobalt 100 processors in a custom virtual machine. learning_objectives: - - Use QEMU to create a raw disk image, boot a VM using an Aarch64 ISO, install the OS, and convert the raw disk image to VHD format. - - Upload the VHD file to Azure and use the Azure Shared Image Gallery (SIG) to create a custom image. - - Use the Azure CLI to create an Azure Linux 3.0 VM for Arm, using the custom image from the Azure SIG. + - Use QEMU to create a raw disk image + - Boot a virtual machine using an AArch64 ISO and install Azure Linux 3.0 + - Convert the raw disk image to VHD format + - Upload the VHD file to Azure + - Use Azure Shared Image Gallery (SIG) to create a custom image + - Create an Azure Linux 3.0 virtual machine on Arm using the Azure CLI and the custom image prerequisites: - - A [Microsoft Azure](https://azure.microsoft.com/) account with permission to create resources, including instances using Cobalt 100 processors. - - A Linux machine with [QEMU](https://www.qemu.org/download/) and the [Azure CLI](/install-guides/azure-cli/) installed and authenticated. + - A [Microsoft Azure](https://azure.microsoft.com/) account with permission to create resources, including instances using Cobalt 100 processors + - A Linux machine with [QEMU](https://www.qemu.org/download/) and the [Azure CLI](/install-guides/azure-cli/) installed and authenticated author: Jason Andrews @@ -38,19 +37,19 @@ operatingsystems: further_reading: - resource: - title: Azure Virtual Machines documentation + title: Virtual machines in Azure link: https://learn.microsoft.com/en-us/azure/virtual-machines/ type: documentation - resource: - title: Azure Shared Image Gallery documentation + title: Store and share images in an Azure Compute Gallery link: https://learn.microsoft.com/en-us/azure/virtual-machines/shared-image-galleries type: documentation - resource: - title: QEMU User Documentation + title: QEMU Documentation link: https://wiki.qemu.org/Documentation type: documentation - resource: - title: Upload a VHD to Azure and create an image + title: Upload a VHD to Azure or copy a managed disk to another region - Azure CLI link: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/upload-vhd type: documentation diff --git a/content/learning-paths/servers-and-cloud-computing/azure-vm/azure-vm.md b/content/learning-paths/servers-and-cloud-computing/azure-vm/azure-vm.md index 0159ccae7d..58b6f28d74 100644 --- a/content/learning-paths/servers-and-cloud-computing/azure-vm/azure-vm.md +++ b/content/learning-paths/servers-and-cloud-computing/azure-vm/azure-vm.md @@ -6,74 +6,74 @@ weight: 3 layout: learningpathall --- -You can view the Azure Linux 3.0 project on [GitHub](https://github.com/microsoft/azurelinux). There are links to the ISO downloads in the project README. +## How do I create an Azure Linux image for Arm? -Using QEMU, you can create a raw disk image and boot a virtual machine with the ISO to install the OS on the disk. +You can view the Azure Linux 3.0 project on [GitHub](https://github.com/microsoft/azurelinux). The project README includes links to ISO downloads. -Once the installation is complete, you can convert the raw disk to a fixed-size VHD, upload it to Azure Blob Storage, and then use the Azure CLI to create a custom Arm image. +Using [QEMU](https://www.qemu.org/), you can create a raw disk image, boot a virtual machine with the ISO, and install the operating system. After installation is complete, you'll convert the image to a fixed-size VHD, upload it to Azure Blob Storage, and use the Azure CLI to create a custom Arm image. -## Download and create a virtual disk file +## How do I download the Azure Linux ISO and create a raw disk image? -Use `wget` to download the Azure Linux ISO image file. +Use `wget` to download the Azure Linux ISO image file: ```bash wget https://aka.ms/azurelinux-3.0-aarch64.iso ``` -Use `qemu-img` to create a 32 GB empty raw disk image to install the OS. - -You can increase the disk size by modifying the value passed to `qemu-img`. +Create a 32 GB empty raw disk image to install the OS: ```bash qemu-img create -f raw azurelinux-arm64.raw 34359738368 ``` -## Boot and install the OS +{{% notice Note %}} +You can change the disk size by adjusting the value passed to `qemu-img`. Ensure it meets the minimum disk size requirements for Azure (typically at least 30 GB). +{{% /notice %}} + + +## How do I install Azure Linux on a raw disk image using QEMU? Use QEMU to boot the operating system in an emulated Arm VM. ```bash -qemu-system-aarch64 \ - -machine virt \ - -cpu cortex-a72 \ - -m 4096 \ - -nographic \ - -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \ - -drive if=none,file=azurelinux-arm64.raw,format=raw,id=hd0 \ - -device virtio-blk-device,drive=hd0 \ - -cdrom azurelinux-3.0-aarch64.iso \ - -netdev user,id=net0 \ +qemu-system-aarch64 \ + -machine virt \ + -cpu cortex-a72 \ + -m 4096 \ + -nographic \ + -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd \ + -drive if=none,file=azurelinux-arm64.raw,format=raw,id=hd0 \ + -device virtio-blk-device,drive=hd0 \ + -cdrom azurelinux-3.0-aarch64.iso \ + -netdev user,id=net0 \ -device virtio-net-device,netdev=net0 ``` -Navigate through the installer by entering the hostname, username, and password for the custom image. -You should use the username of `azureuser` if you want match the instructions on the following pages. - -Be patient, it takes some time to complete the full installation. +Follow the installer prompts to enter the hostname, username, and password. Use `azureuser` as the username to ensure compatibility with later steps. -At the end of installation you are prompted for confirmation to reboot the system. +{{% notice Note %}}The installation process takes several minutes.{{% /notice %}} -Once the newly installed OS boots successfully, install the Azure Linux Agent for VM provisioning, and power off the VM. +At the end of installation, confirm the reboot prompt. After rebooting into the newly-installed OS, install and enable the Azure Linux Agent: ```bash -sudo dnf install WALinuxAgent -y -sudo systemctl enable waagent -sudo systemctl start waagent +sudo dnf install WALinuxAgent -y +sudo systemctl enable waagent +sudo systemctl start waagent sudo poweroff ``` -Be patient, it takes some time to install the packages and power off. +{{% notice Note %}} It can take a few minutes to install the agent and power off the VM.{{% /notice %}} -## Convert the raw disk to VHD Format +## How do I convert a raw disk image to a fixed-size VHD for Azure? -Now that the raw disk image is ready to be used, convert the image to fixed-size VHD, making it compatible with Azure. +Now that the raw disk image is ready for you to use, convert it to fixed-size VHD, which makes it compatible with Azure. ```bash qemu-img convert -f raw -o subformat=fixed,force_size -O vpc azurelinux-arm64.raw azurelinux-arm64.vhd ``` {{% notice Note %}} -VHD files have 512 bytes of footer attached at the end. The `force_size` flag ensures that the exact virtual size specified is used for the final VHD file. Without this, QEMU may round the size or adjust for footer overhead (especially when converting from raw to VHD). The `force_size` flag forces the final image to match the original size. This flag makes the final VHD size a whole number in MB or GB, which is required for Azure. +VHD files include a 512-byte footer at the end. The `force_size` flag ensures the final image size matches the requested virtual size. Without this, QEMU might round the size or adjust for footer overhead (especially when converting from raw to VHD). The `force_size` flag forces the final image to match the original size. This is required for Azure compatibility, as it avoids rounding errors and ensures the VHD ends at a whole MB or GB boundary. {{% /notice %}} -Next, you can save the image in your Azure account. +In the next step, you'll upload the VHD image to Azure and register it as a custom image for use with Arm-based virtual machines. diff --git a/content/learning-paths/servers-and-cloud-computing/azure-vm/background.md b/content/learning-paths/servers-and-cloud-computing/azure-vm/background.md index fa9b4854f7..65b0b4c00e 100644 --- a/content/learning-paths/servers-and-cloud-computing/azure-vm/background.md +++ b/content/learning-paths/servers-and-cloud-computing/azure-vm/background.md @@ -1,38 +1,56 @@ --- -title: "About Azure Linux" +title: "Build and run Azure Linux 3.0 on an Arm-based Azure virtual machine" weight: 2 layout: "learningpathall" --- -## What is Azure Linux 3.0? +## What is Azure Linux 3.0 and how can I use it? -Azure Linux 3.0 is a Linux distribution developed and maintained by Microsoft, specifically designed for use on the Azure cloud platform. It is optimized for running cloud-native workloads, such as containers, microservices, and Kubernetes clusters, and emphasizes performance, security, and reliability. Azure Linux 3.0 provides native support for the Arm (AArch64) architecture, enabling efficient, scalable, and cost-effective deployments on Arm-based infrastructure within Azure. +Azure Linux 3.0 is a Microsoft-developed Linux distribution designed for cloud-native workloads on the Azure platform. It is optimized for running containers, microservices, and Kubernetes clusters, with a focus on performance, security, and reliability. -Currently, Azure Linux 3.0 is not available as a ready-made virtual machine image for Arm-based VMs in the Azure Marketplace. Only x86_64 images, published by Ntegral Inc., are offered. This means you cannot directly create an Azure Linux 3.0 VM for Arm from the Azure portal or CLI. +Azure Linux 3.0 includes native support for the Arm architecture (AArch64), enabling efficient, scalable, and cost-effective deployments on Arm-based Azure infrastructure. -However, you can still run Azure Linux 3.0 on Arm-based Azure VMs by creating your own disk image. Using QEMU, an open-source machine emulator and virtualizer, you can build a custom Azure Linux 3.0 Arm image locally. After building the image, you can upload it to your Azure account as a managed disk or custom image. This process allows you to deploy and manage Azure Linux 3.0 VMs on Arm infrastructure, even before official images are available. +## Can I run Azure Linux 3.0 on Arm-based Azure virtual machines? -This Learning Path guides you through the steps to build an Azure Linux 3.0 disk image with QEMU, upload it to Azure, and prepare it for use in creating virtual machines. +At the time of writing, Azure Linux 3.0 isn't available as a prebuilt virtual machine image for Arm-based VMs in the Azure Marketplace. Only x86_64 images (published by Ntegral Inc.) are available. This means you can't directly create an Azure Linux 3.0 VM for Arm from the Azure portal or CLI. -Following this process, you'll be able to create and run Azure Linux 3.0 VMs on Arm-based Azure infrastructure. +## How can I create and use a custom Azure Linux image for Arm? -To get started install the dependencies on your local Linux machine. The instructions work for both Arm or x86 running Ubuntu. +To run Azure Linux 3.0 on an Arm-based VM, you'll need to build a custom image manually. Using [QEMU](https://www.qemu.org/), an open-source machine emulator and virtualizer, you can build the image locally. After the build completes, upload the resulting image to your Azure account as either a managed disk or a custom image resource. This process lets you deploy and manage Azure Linux 3.0 VMs on Arm-based Azure infrastructure, even before official images are published in the Marketplace. This gives you full control over image configuration and early access to Arm-native workloads. + +This Learning Path guides you through the steps to: + +- Build an Azure Linux 3.0 disk image with QEMU +- Upload the image to Azure +- Create a virtual machine from the custom image + +By the end of this process, you'll be able to run Azure Linux 3.0 VMs on Arm-based Azure infrastructure. + +## What tools do I need to build the Azure Linux image locally? + +You can build the image on either an Arm or x86 Ubuntu system. First, install the required tools: + +Install QEMU and related tools: ```bash sudo apt update && sudo apt install qemu-system-arm qemu-system-aarch64 qemu-efi-aarch64 qemu-utils ovmf -y ``` -You also need to install the Azure CLI. Refer to [How to install the Azure CLI](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest). You can also use the [Azure CLI install guide](/install-guides/azure-cli/) for Arm Linux systems. +You'll also need the Azure CLI. To install it, follow the [Azure CLI install guide](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest). + +If you're using an Arm Linux machine, see the [Azure CLI install guide](/install-guides/azure-cli/). + +## How do I verify the Azure CLI installation? -Make sure the CLI is working by running the version command and confirm the version is printed. +After installing the CLI, verify it's working by running the following command: ```bash az version ``` -You should see an output similar to: +You should see an output similar to the following: ```output { @@ -43,4 +61,4 @@ You should see an output similar to: } ``` -Continue to learn how to prepare the Azure Linux disk image. \ No newline at end of file +In the next section, you'll learn how to build the Azure Linux 3.0 disk image using QEMU. \ No newline at end of file diff --git a/content/learning-paths/servers-and-cloud-computing/azure-vm/save-image.md b/content/learning-paths/servers-and-cloud-computing/azure-vm/save-image.md index ab66336077..8bae3a4507 100644 --- a/content/learning-paths/servers-and-cloud-computing/azure-vm/save-image.md +++ b/content/learning-paths/servers-and-cloud-computing/azure-vm/save-image.md @@ -6,94 +6,109 @@ weight: 4 layout: learningpathall --- -You can now use the Azure CLI to create a disk image in Azure and copy the local image to Azure. +## How do I upload and register a VHD image in Azure? -## Prepare Azure resources for the image +You're now ready to use the Azure CLI to create and upload a custom disk image to Azure. In this section, you'll configure environment variables, provision the necessary Azure resources, and upload a `.vhd` file. Then, you'll use the Shared Image Gallery to register the image for use with custom virtual machines. -Before uploading the VHD file to Azure storage, set the environment variables for the Azure CLI. +## How do I set up environment variables for the Azure CLI? + +Before uploading your VHD file, set the environment variables for the Azure CLI: ```bash -RESOURCE_GROUP="MyCustomARM64Group" -LOCATION="centralindia" -STORAGE_ACCOUNT="mycustomarm64storage" -CONTAINER_NAME="mycustomarm64container" -VHD_NAME="azurelinux-arm64.vhd" -GALLERY_NAME="MyCustomARM64Gallery" -IMAGE_DEF_NAME="MyAzureLinuxARM64Def" -IMAGE_VERSION="1.0.0" -PUBLISHER="custom" -OFFER="custom-offer" -SKU="custom-sku" -OS_TYPE="Linux" -ARCHITECTURE="Arm64" -HYPERV_GEN="V2" -STORAGE_ACCOUNT_TYPE="Standard_LRS" -VM_NAME="MyAzureLinuxARMVM" -ADMIN_USER="azureuser" +RESOURCE_GROUP="MyCustomARM64Group" +LOCATION="centralindia" +STORAGE_ACCOUNT="mycustomarm64storage" +CONTAINER_NAME="mycustomarm64container" +VHD_NAME="azurelinux-arm64.vhd" +GALLERY_NAME="MyCustomARM64Gallery" +IMAGE_DEF_NAME="MyAzureLinuxARM64Def" +IMAGE_VERSION="1.0.0" +PUBLISHER="custom" +OFFER="custom-offer" +SKU="custom-sku" +OS_TYPE="Linux" +ARCHITECTURE="Arm64" +HYPERV_GEN="V2" +STORAGE_ACCOUNT_TYPE="Standard_LRS" +VM_NAME="MyAzureLinuxARMVM" +ADMIN_USER="azureuser" VM_SIZE="Standard_D4ps_v6" ``` {{% notice Note %}} -You can modify the environment variables such as RESOURCE_GROUP, VM_NAME, and LOCATION based on your naming preferences, region, and resource requirements. +Modify the environment variables such as RESOURCE_GROUP, VM_NAME, and LOCATION to suit your naming preferences, region, and resource requirements. {{% /notice %}} -Make sure to login to Azure using the CLI. +## How do I log in and create Azure resources? + +First, log in to Azure using the CLI: ```bash az login ``` -If a link is printed, open it in a browser and enter the provided code to authenticate. +If prompted, open the browser link and enter the verification code to authenticate. -Create a new resource group. If you are using an existing resource group for the RESOURCE_GROUP environment variable you can skip this step. +Then, create a new resource group. If you are using an existing resource group for the RESOURCE_GROUP environment variable, you can skip this step: ```bash az group create --name "$RESOURCE_GROUP" --location "$LOCATION" ``` -Create Azure blob storage. +Create a new storage account to store your image: ```bash -az storage account create \ - --name "$STORAGE_ACCOUNT" \ - --resource-group "$RESOURCE_GROUP" \ - --location "$LOCATION" \ - --sku Standard_LRS \ +az storage account create \ + --name "$STORAGE_ACCOUNT" \ + --resource-group "$RESOURCE_GROUP" \ + --location "$LOCATION" \ + --sku Standard_LRS \ --kind StorageV2 ``` -Create a blob container in the blob storage account. +Next, create a blob container in the storage account: ```bash -az storage container create \ - --name "$CONTAINER_NAME" \ +az storage container create \ + --name "$CONTAINER_NAME" \ --account-name "$STORAGE_ACCOUNT" ``` -## Upload and save the image in Azure +## How do I upload a VHD image to Azure Blob Storage? + +First, retrieve the storage account key: + +```bash +STORAGE_KEY=$(az storage account keys list \ + --resource-group "$RESOURCE_GROUP" \ + --account-name "$STORAGE_ACCOUNT" \ + --query '[0].value' --output tsv) +``` -Upload the VHD file to Azure. +Then upload your VHD file to Azure Blob Storage: ```bash -az storage blob upload \ - --account-name "$STORAGE_ACCOUNT" \ - --container-name "$CONTAINER_NAME" \ - --name "$VHD_NAME" \ +az storage blob upload \ + --account-name "$STORAGE_ACCOUNT" \ + --container-name "$CONTAINER_NAME" \ + --name "$VHD_NAME" \ --file ./azurelinux-arm64.vhd ``` -You can now use the Azure console to see the image in your Azure account. +You can now use the Azure console to view the image in your Azure account. -Next, create a custom VM image from this VHD, using Azure Shared Image Gallery (SIG). +## How do I register a custom image in the Azure Shared Image Gallery? + +Create a custom VM image from the VHD, using the Azure Shared Image Gallery (SIG): ```bash -az sig create \ - --resource-group "$RESOURCE_GROUP" \ - --gallery-name "$GALLERY_NAME" \ +az sig create \ + --resource-group "$RESOURCE_GROUP" \ + --gallery-name "$GALLERY_NAME" \ --location "$LOCATION" ``` -Create the image definition. +Create the image definition: ```bash az sig image-definition create \ @@ -108,7 +123,7 @@ az sig image-definition create \ --hyper-v-generation "$HYPERV_GEN" ``` -Create the image version to register the VHD as a version of the custom image. +Create the image version from the uploaded VHD: ```bash az sig image-version create \ @@ -119,18 +134,22 @@ az sig image-version create \ --location "$LOCATION" \ --os-vhd-uri "https://${STORAGE_ACCOUNT}.blob.core.windows.net/${CONTAINER_NAME}/${VHD_NAME}" \ --os-vhd-storage-account "$STORAGE_ACCOUNT" \ - --storage-account-type "$STORAGE_ACCOUNT_TYPE" + --storage-account-type "$STORAGE_ACCOUNT_TYPE" ``` -Once the image has been versioned, you can retrieve the unique image ID for use in VM creation. +## How do I retrieve the image ID for VM creation? + +Once the image has been versioned, you can retrieve the unique image ID for use in VM creation: ```bash -IMAGE_ID=$(az sig image-version show \ - --resource-group "$RESOURCE_GROUP" \ - --gallery-name "$GALLERY_NAME" \ - --gallery-image-definition "$IMAGE_DEF_NAME" \ +IMAGE_ID=$(az sig image-version show \ + --resource-group "$RESOURCE_GROUP" \ + --gallery-name "$GALLERY_NAME" \ + --gallery-image-definition "$IMAGE_DEF_NAME" \ --gallery-image-version "$IMAGE_VERSION" \ --query "id" -o tsv) ``` -Next, you can create a virtual machine with the new image using the image ID. \ No newline at end of file +You'll use this ID to deploy a new virtual machine based on your custom image. + +You've successfully uploaded and registered a custom Arm64 VM image in Azure. In the next section, you'll learn how to create a virtual machine using this image. \ No newline at end of file diff --git a/content/learning-paths/servers-and-cloud-computing/azure-vm/start-vm.md b/content/learning-paths/servers-and-cloud-computing/azure-vm/start-vm.md index c8592c1f96..67d19f2655 100644 --- a/content/learning-paths/servers-and-cloud-computing/azure-vm/start-vm.md +++ b/content/learning-paths/servers-and-cloud-computing/azure-vm/start-vm.md @@ -6,29 +6,33 @@ weight: 5 layout: learningpathall --- -## Create a virtual machine using the new image +## How do I launch a virtual machine using my custom Azure image? -You can now use the newly created Azure Linux image to create a virtual machine in Azure with Cobalt 100 processors. Confirm the VM is created by looking in your Azure account in the “Virtual Machines” section. +Now that your image is registered, you can launch a new VM using the Azure CLI and the custom image ID. This example creates a Linux VM on Cobalt 100 Arm-based processors using the custom image you created earlier. + +## How do I create a virtual machine in Azure using a custom image? + +Use the following command to create a virtual machine using your custom image: ```bash -az vm create \ - --resource-group "$RESOURCE_GROUP" \ - --name "$VM_NAME" \ - --image "$IMAGE_ID" \ - --size "$VM_SIZE" \ - --admin-username "$ADMIN_USER" \ - --generate-ssh-keys \ +az vm create \ + --resource-group "$RESOURCE_GROUP" \ + --name "$VM_NAME" \ + --image "$IMAGE_ID" \ + --size "$VM_SIZE" \ + --admin-username "$ADMIN_USER" \ + --generate-ssh-keys \ --public-ip-sku Standard ``` After the VM is successfully created, retrieve the public IP address. ```bash -az vm show \ - --resource-group "$RESOURCE_GROUP" \ - --name "$VM_NAME" \ - --show-details \ - --query "publicIps" \ +az vm show \ + --resource-group "$RESOURCE_GROUP" \ + --name "$VM_NAME" \ + --show-details \ + --query "publicIps" \ -o tsv ``` @@ -38,7 +42,7 @@ Use the public IP address to SSH to the VM. Replace `` with t ssh azureuser@ ``` -After you login, print the machine information. +After connecting, print the machine information: ```bash uname -a