Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 1.56 KB

azurecli_usage.md

File metadata and controls

67 lines (50 loc) · 1.56 KB

Use azurecli in the devops-toolkit

Prerequisite

An Azure account

azurecli document

Some document to help you start with azurecli

Note

To use the existing container instead of creating one, use docker exec command instead of docker run

docker exec -it my_devops_toolkit /bin/bash

Use case 1: Az login and run command

docker run --rm -it devops-toolkit:latest
## To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <SHOWN_IN_SCREEN> to authenticate
az login
# List all resource groups
az group list

Use case 2: Using Azure config from the host

Mount the .azure folder from host when running toolkit container

docker run --rm -it -v ~/.azure:/root/.azure devops-toolkit:latest
###############################################
# Now we are in the docker container terminal #
###############################################
# List all resource groups
az group list

Sample Result

~ docker run --rm -it -v ~/.azure:/root/.azure devops-toolkit:latest
root@f097467db632:~# az group list
[
  {
    "id": "/subscriptions/xxxxxxxx-yyyy-zzzz-ttttttttt/resourceGroups/your_resource_group",
    "location": "centralindia",
    "managedBy": null,
    "name": "your_resource_group",
    "properties": {
      "provisioningState": "Succeeded"
    },
    "tags": null,
    "type": "Microsoft.Resources/resourceGroups"
  },
  ...
]

Troubleshooting