Running Python Azure Functions Locally on an M1/M2 Mac

Michael Sharpe
5 min readMay 24, 2023

Python-based Azure functions are a powerful tool for executing pieces of code or ‘functions’ in response to specific events. However, for developers who are using the latest M1 and M2 Mac machines, running Azure functions locally has posed a challenge due to the shift from Intel to ARM architectures. The latest Azure Function Core Tools still do not support the ARM architecture (Azure Function Core Tools v4).

It is not too easy to find a solution by googling and even Azure forums do not help much. Three solutions have been identified,

  1. Use a virtual machine environment that has the capability of emulating an x86/amd64 machine and running an x86/amd64 VM. This is not ideal as currently, Parallels does not support x86/amd64 emulation. This leaves users with less popular options on MacOS like QEMU.
  2. Install Homebrew twice. It is possible to run the MacOS terminal and some other terminals under Rosetta 2 emulation. This allows an x86/amd64 version of Homebrew to be installed. Then homebrew can be used to install an x86/amd64 version of the Azure Function Core Tools. Again, not the cleanest solution, especially if Homebrew is used for ARM also. Fortunately, x86/amd64 and ARM Homebrew installs are in different places. Some specific settings will be required to pick up the right version of the tools for development. A very good write-up on this method can be found at http://issamben.com/running-python-azure-function-locally-on-an-m1-m2/.
  3. Use Docker with Rosetta 2 emulation. This appears to be the cleanest solution. This is especially true if docker is already familiar. The rest of this article focuses on this approach.

Install and Configure Docker Desktop

Docker Desktop for MacOS can be obtained from www.docker.com and installed normally using guidance on the same site. Once installed a couple of settings need to be applied. These settings are done in the Docker Desktop UI.

Go to the docker settings and check the “Use Virtualization framework” option on the “General Tab”

Virtualization framework Setting

Then select the “Features in development” tab and select the “Use Rosetta for x86/amd64 emulation on Apple Silicon” option.

--

--

Michael Sharpe

Senior Software Architect located in Houston, Texas