DEV Community

Nelson Hernández
Nelson Hernández

Posted on

3 2

How to run Azure CLI with Docker

To run the Azure CLI in a Docker container, you can use the following command:

Azure CLI

docker run -it --rm -v ${PWD}:/work -w /work --entrypoint /bin/sh mcr.microsoft.com/azure-cli:latest
Enter fullscreen mode Exit fullscreen mode

Login to Azure

az login
az account list
Enter fullscreen mode Exit fullscreen mode

Output

[
  {
    "cloudName": "AzureCloud",
    "id": "00000000-0000-0000-0000-000000000000",
    "isDefault": true,
    "name": "PAYG Subscription",
    "state": "Enabled",
    "tenantId": "00000000-0000-0000-0000-000000000000",
    "user": {
      "name": "user@example.com",
      "type": "user"
    }
  }
]
Enter fullscreen mode Exit fullscreen mode

Set suscription

az account set --subscription="00000000-0000-0000-0000-000000000000"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay