Problem
Using the "Remote" execution mode within Terraform Cloud workspace to deploy Azure resources results in the error:
Error: Error running command 'az version': exit status 127. Output: /bin/sh: 1: az: not found
Cause
The remote execution mode is using Terraform Cloud's infrastructure. Terraform Cloud performs Terraform runs in single-use Linux virtual machines, running on an x86_64 architecture. The VMs have a minimal OS install and do not have additional tools like Azure CLI installed.
Solutions:
There is a workaround to install software on the workers on every run described here but it will not work for Azure CLI as you can only download self-contained-binaries.
If you are using self-hosting Terraform Cloud Agents you can install the Azure CLI and any other additional tools of your preference.