Geek Culture
Published in

Geek Culture

Apple M1 + VS Code: ARM Template and Template Language Service

Azure Bicep is increasing popularity presently, we started adopting this new DSL for Azure ARM some months ago and we have now completely switched over to using Bicep in favour of ARM-based templates.

After installing the Azure ARM and Bicep extensions on an M1 Mac you might see the following errors:

The fix is two-fold, you need to install both the 3.1 and 5.0 dotnet runtime on your machine using a Rosetta Terminal, and you need to configure the extension to use that runtime installation

Rosetta Terminal

If you don’t have a Rosetta Terminal yet, you can make one yourself by copying the Terminal.app from the Applications/Utilities directory.

Select Terminal.app

⌘ + C

⌘ + V

After copying, rename the new Terminal.app to Rosetta Terminal.app

Right-click the Rosetta Terminal.app and select Get Info.

Select the checkbox Open using Rosetta

Close the information window.

Installing the dotnet runtimes using Rosetta Terminal

Launch the new Rosetta Terminal.app

Open an ARM template file in VS Code, you will see the following error:

Select the .NET Runtime output stream.

Select the installer command that this extension tried to execute:

Paste and run the command you selected above in your Rosetta Terminal.app.

Open a Bicep file and your should get the same error on the dotnet 5.0 runtime…

Repeat the previous steps, select the command from the output window and paste inside the Rosetta Terminal.app.

Configuring the extensions

Now we need to configure these extensions to use the correct dotnet command.

Open VS Code.

Press ⌘ + SHIFT +P and type ‘Open settings’, select the Open Settings (JSON) option:

Add the following to your settings.json file:

"dotnetAcquisitionExtension.existingDotnetPath": [    {         "extensionId": "msazurermtools.azurerm-vscode-tools",         "path": "/usr/local/share/dotnet/dotnet"    },    {        "extensionId": "ms-azuretools.vscode-bicep",        "path": "/usr/local/share/dotnet/dotnet"    }]

Save and reload, you should be able to launch the ARM Template and Bicep Language Server now!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store