Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions content/install-guides/azure-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ It is available for a variety of operating systems and Linux distributions and h

## How do I prepare to install the Azure CLI on Ubuntu?

[General installation information](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt) is available which covers all supported Linux distributions. Starting with version 2.46.0, Azure CLI supports Arm64 Linux distributions. The 'apt' package manager contains both x86_64 and Arm64 packages for the following linux distributions

```output
Ubuntu 20.04, Ubuntu 22.04, Ubuntu 24.04
```
[General installation information](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt) is available which covers all supported Linux distributions. Starting with version 2.46.0, Azure CLI supports Arm64 Linux distributions. The 'apt' package manager contains both x86_64 and Arm64 packages for Ubuntu 20.04, Ubuntu 22.04, and Ubuntu 24.04.

## How do I install the Azure CLI using the installation script?

Expand Down Expand Up @@ -60,8 +56,8 @@ You should see an output similar to:

```output
{
"azure-cli": "2.61.0",
"azure-cli-core": "2.61.0",
"azure-cli": "2.75.0",
"azure-cli-core": "2.75.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {}
}
Expand Down Expand Up @@ -98,8 +94,8 @@ You should see an output similar to:

```output
{
"azure-cli": "2.61.0",
"azure-cli-core": "2.61.0",
"azure-cli": "2.75.0",
"azure-cli-core": "2.75.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ learning_objectives:

prerequisites:
- A [Microsoft Azure](https://azure.microsoft.com/) account with permission to create resources, including instances using Cobalt 100 processors.
- A local Linux machine with [QEMU](https://www.qemu.org/download/) and the [Azure CLI](/install-guides/azure-cli/) installed and authenticated.
- A Linux machine with [QEMU](https://www.qemu.org/download/) and the [Azure CLI](/install-guides/azure-cli/) installed and authenticated.

author: Jason Andrews

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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.

Using QEMU, you can create a raw disk image and boot a virtual machine with the ISO to install the OS onto the disk.
Using QEMU, you can create a raw disk image and boot a virtual machine with the ISO to install the OS on the disk.

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.

Expand All @@ -20,9 +20,9 @@ Use `wget` to download the Azure Linux ISO image file.
wget https://aka.ms/azurelinux-3.0-aarch64.iso
```

Use `qemu-img` to create a 32 GB raw disk image.
Use `qemu-img` to create a 32 GB empty raw disk image to install the OS.

This step creates 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`.
You can increase the disk size by modifying the value passed to `qemu-img`.

```bash
qemu-img create -f raw azurelinux-arm64.raw 34359738368
Expand All @@ -46,7 +46,14 @@ qemu-system-aarch64 \
-device virtio-net-device,netdev=net0
```

Once the OS boots successfully, install the Azure Linux Agent for VM provisioning, and power off the VM.
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.

At the end of installation you are prompted for confirmation to reboot the system.

Once the newly installed OS boots successfully, install the Azure Linux Agent for VM provisioning, and power off the VM.

```bash
sudo dnf install WALinuxAgent -y
Expand All @@ -55,6 +62,8 @@ sudo systemctl start waagent
sudo poweroff
```

Be patient, it takes some time to install the packages and power off.

## Convert the raw disk to VHD Format

Now that the raw disk image is ready to be used, convert the image to fixed-size VHD, making it compatible with Azure.
Expand All @@ -64,7 +73,7 @@ qemu-img convert -f raw -o subformat=fixed,force_size -O vpc azurelinux-arm64.ra
```

{{% 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 helps make the final VHD size a clean, whole number in MB or GiB, which is required for Azure.
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.
{{% /notice %}}

Next, you can save the image in your Azure account.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ You should see an output similar to:

```output
{
"azure-cli": "2.61.0",
"azure-cli-core": "2.61.0",
"azure-cli": "2.75.0",
"azure-cli-core": "2.75.0",
"azure-cli-telemetry": "1.1.0",
"extensions": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ VM_SIZE="Standard_D4ps_v6"
You can modify the environment variables such as RESOURCE_GROUP, VM_NAME, and LOCATION based on your naming preferences, region, and resource requirements.
{{% /notice %}}

Make sure to login 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.

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
Expand Down Expand Up @@ -88,41 +96,41 @@ az sig create \
Create the image definition.

```bash
az sig image-definition create
--resource-group "$RESOURCE_GROUP"
--gallery-name "$GALLERY_NAME"
--gallery-image-definition "$IMAGE_DEF_NAME"
--publisher "$PUBLISHER"
--offer "$OFFER"
--sku "$SKU"
--os-type "$OS_TYPE"
--architecture "$ARCHITECTURE"
az sig image-definition create \
--resource-group "$RESOURCE_GROUP" \
--gallery-name "$GALLERY_NAME" \
--gallery-image-definition "$IMAGE_DEF_NAME" \
--publisher "$PUBLISHER" \
--offer "$OFFER" \
--sku "$SKU" \
--os-type "$OS_TYPE" \
--architecture "$ARCHITECTURE" \
--hyper-v-generation "$HYPERV_GEN"
```

Create the image version to register the VHD as a version of the custom image.

```bash
az sig image-version create
--resource-group "$RESOURCE_GROUP"
--gallery-name "$GALLERY_NAME"
--gallery-image-definition "$IMAGE_DEF_NAME"
--gallery-image-version "$IMAGE_VERSION"
--location "$LOCATION"
--os-vhd-uri "[https://${STORAGE_ACCOUNT}.blob.core.windows.net/${CONTAINER_NAME}/${VHD_NAME](https://${storage_account}.blob.core.windows.net/$%7BCONTAINER_NAME%7D/$%7BVHD_NAME)}"
--os-vhd-storage-account "$STORAGE_ACCOUNT"
az sig image-version create \
--resource-group "$RESOURCE_GROUP" \
--gallery-name "$GALLERY_NAME" \
--gallery-image-definition "$IMAGE_DEF_NAME" \
--gallery-image-version "$IMAGE_VERSION" \
--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"
```

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"
--gallery-image-version "$IMAGE_VERSION"
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.
Next, you can create a virtual machine with the new image using the image ID.
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,16 @@ Use the public IP address to SSH to the VM. Replace `<public-ip-address>` with t
ssh azureuser@<public-ip-address>
```

After you login, print the machine information.

```bash
uname -a
```

The output is similar to:

```output
Linux MyAzureLinuxARMVM 6.6.92.2-2.azl3 #1 SMP Wed Jul 2 02:43:35 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux
```

You are ready to use your Azure Linux virtual machine.