Fix [Errno 8] Exec format error: ‘/Users//.azure/bin/bicep’

When you run az bicep command on Mac M1, you might experience error

[Errno 8] Exec format error: '/Users/<username>/.azure/bin/bicep'

This error is because for some reason, bicep in azure cli was installed with a non-ARM version, to resolve this, do following steps

  1. Remove /Users/<username>/.azure/bin/bicep
  2. Run az bicep version, this will force Azure CLI to download bicep and refresh.
  3. If you see a message output with Successfully installed Bicep CLI to, then the bicep is repaired successfully.