Installing aws-azure-login on Apple M1

Aws-azure-login is a command-line utility for organisations using Azure Active Directory to authenticate users to the AWS console. It lets you use an Azure AD login (including MFA) from a command line to create a federated AWS session and places the temporary credentials in the proper place for the AWS CLI and SDKs.

Under the hood, the utility drives a Chromium browser using Puppeteer to automate the Azure AD login.

Unfortunately, aws-azure-login doesn’t install on Apple M1 using npm install -g aws-azure-login.

To workaround, you need to install Chromium manually:

brew install --cask chromium

Next, we need to set some environment variables to tell Puppeteer where it can find Chromium by adding the following lines to .zshrc

export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
export PUPPETEER_EXECUTABLE_PATH=`which chromium`

Next, we install aws-azure-login as usual.

npm install -g aws-azure-login

And now for the ugly part. Brew installs Chromium to /usr/local/homebrew/bin/chromium. Puppeteer, however, is hardcoded to look for Chromium at /usr/bin/chromium-browser if the architecture is ARM.

The Apple system integrity check prevents you from creating a symlink in /usr/bin, so our only option to get things working is to update Puppeteer source code to reference the location of the M1 Chromium binary. Be warned if you reinstall or update the aws-azure-login module, the changes below will be lost.

vi /usr/local/Homebrew/lib/node_modules/aws-azure-login/node_modules/puppeteer/lib/cjs/puppeteer/node/Launcher.js

Find the following block of code.

    if (!executablePath) {
            if (os.arch() === 'arm64') {
                chromiumExecutable = '/usr/bin/chromium-browser'

Change the chromiumExecutable constant to:

		chromiumExecutable = '/usr/local/homebrew/bin/chromium'

2022

Remote Development With Codespaces

9 minute read

Are you tired of spending hours setting up your local machine so you can work with a new repository? Is Docker hogging CPU and memory, killing the promise of...

Back to Top ↑

2021

How To Use Spark Partitions With Postgres

3 minute read

In the post, we will explore how we can use partitions to reduce job execution time by increasing parallelism. Specifically, we will focus on building Spark ...

Installing aws-azure-login on Apple M1

1 minute read

Aws-azure-login is a command-line utility for organisations using Azure Active Directory to authenticate users to the AWS console. It lets you use an Azure A...

Back to Top ↑

2020

Back to Top ↑

2016

Back to Top ↑

2013

Back to Top ↑