Windows ARM installing Azure CLI

This is for Powershell Core, Windows Powershell works with Win32 version through emulation.

Another quick tip for those developers out there with their shiny new Surface Laptop 7 or similar with Windows on ARM on it. Tried installing Azure CLI already, and everything went fine, but trying to run it didn’t work? You are not alone, as the official support at the time of writing (July 2024) is still lacking.

I managed to get around this, and here are the steps for you not to waste time and pull hair out in frustration, when chatGPT or Claude AI won’t tell you how to fix this.

Notice that this is a bit of a hacky thing, we create a virtual environment where we run it, but hey, if it works… right?

Prereq is to install Build tools through Visual Studio 2022 Free https://visualstudio.microsoft.com/downloads/ and select Desktop development with C++ and install all ARM related things. You also need to install Rust from https://forge.rust-lang.org/infra/other-installation-methods.html and select aarch64-pc-windows-msvc version.Install the Cargo folder to your path, something like “C:\users\USER\.rustup\toolchains\stable-aarch64-pc-windows-msvc\bin\”.

  • Make sure you have the latest PowerShell Core:
  • winget install --id Microsoft.Powershell --source winget

  • Enable running installers by running this command on Powershell
  • set-executionpolicy remotesigned

  • Next install from the Powershell latest Python (3.12 for time of writing).
  • curl https://www.python.org/ftp/python/3.12.0/python-3.12.0-arm64.exe -O python-3.12.0-arm64.exe

    Now we have prerequisites in place, and it’s time for some Powershell magic:

    # Create a virtual environment
    python3 -m venv azure-cli-env
    # Update pip
    azure-cli-env/scripts/python -m pip install --upgrade pip
    # Install azure-cli
    azure-cli-env/scripts/python -m pip install azure-cli
    azure-cli-env/scripts/python -m pip install setuptools

    and after that, run this:

    notepad $profile

    Add to your profile file the following:

    Set-Alias -Name az -Value "C:\azure-cli-env\Scripts\az.bat"

    Restart your powershell, and running az should work now. Goes without saying, make sure the virtual environment path matches the location in the Set-Alias command.

    This entry was posted in WindowsARM and tagged , . Bookmark the permalink.

    One Response to Windows ARM installing Azure CLI

    1. Pingback: Dew Drop – July 15, 2024 (#4227) – Morning Dew by Alvin Ashcraft

    Comments are closed.