|
| 1 | +# Use azurecli in the devops-toolkit |
| 2 | + |
| 3 | +## Prerequisite |
| 4 | + |
| 5 | +An Azure account |
| 6 | + |
| 7 | +## azurecli document |
| 8 | + |
| 9 | +Some document to help you start with azurecli |
| 10 | + |
| 11 | +- <https://learn.microsoft.com/en-us/cli/azure/> |
| 12 | + |
| 13 | +## Note |
| 14 | + |
| 15 | +To use the existing container instead of creating one, use `docker exec` command instead of `docker run` |
| 16 | + |
| 17 | +```bash |
| 18 | +docker exec -it my_devops_toolkit /bin/bash |
| 19 | +``` |
| 20 | + |
| 21 | +## Use case 1: Az login and run command |
| 22 | + |
| 23 | +```bash |
| 24 | +docker run --rm -it devops-toolkit:latest |
| 25 | +## To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code <SHOWN_IN_SCREEN> to authenticate |
| 26 | +az login |
| 27 | +# List all resource groups |
| 28 | +az group list |
| 29 | +``` |
| 30 | + |
| 31 | +## Use case 2: Using Azure config from the host |
| 32 | + |
| 33 | +Mount the `.azure` folder from host when running toolkit container |
| 34 | + |
| 35 | +```bash |
| 36 | +docker run --rm -it -v ~/.azure:/root/.azure devops-toolkit:latest |
| 37 | +############################################### |
| 38 | +# Now we are in the docker container terminal # |
| 39 | +############################################### |
| 40 | +# List all resource groups |
| 41 | +az group list |
| 42 | +``` |
| 43 | + |
| 44 | +Sample Result |
| 45 | + |
| 46 | +```bash |
| 47 | +➜ ~ docker run --rm -it -v ~/.azure:/root/.azure devops-toolkit:latest |
| 48 | +root@f097467db632:~# az group list |
| 49 | +[ |
| 50 | + { |
| 51 | + "id": "/subscriptions/xxxxxxxx-yyyy-zzzz-ttttttttt/resourceGroups/your_resource_group", |
| 52 | + "location": "centralindia", |
| 53 | + "managedBy": null, |
| 54 | + "name": "your_resource_group", |
| 55 | + "properties": { |
| 56 | + "provisioningState": "Succeeded" |
| 57 | + }, |
| 58 | + "tags": null, |
| 59 | + "type": "Microsoft.Resources/resourceGroups" |
| 60 | + }, |
| 61 | + ... |
| 62 | +] |
| 63 | +``` |
| 64 | + |
| 65 | +## Troubleshooting |
| 66 | + |
| 67 | +- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md) |
0 commit comments