From 551631f96d81597cfe5f1aa38231d0b859b57585 Mon Sep 17 00:00:00 2001 From: Tung Leo Date: Sun, 17 Mar 2024 13:44:09 +0700 Subject: [PATCH] doc: add azure cli usage --- docs/usage/README.md | 6 +++- docs/usage/azurecli_usage.md | 67 ++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 docs/usage/azurecli_usage.md diff --git a/docs/usage/README.md b/docs/usage/README.md index 519e133..f84637a 100644 --- a/docs/usage/README.md +++ b/docs/usage/README.md @@ -22,10 +22,14 @@ This guide us how to use the `devops-toolkit` with serveral usecases - Check [**helm_usage**](./helm_usage.md) -## AWSCli +## AwsCLI - Check [**awscli_usage**](./awscli_usage.md) +## AzureCLI + +- Check [**azurecli_usage**](./azurecli_usage.md) + ## Troubleshooting - For any issues, check [this document](../troubleshooting/TROUBLESHOOTING.md) diff --git a/docs/usage/azurecli_usage.md b/docs/usage/azurecli_usage.md new file mode 100644 index 0000000..807eff8 --- /dev/null +++ b/docs/usage/azurecli_usage.md @@ -0,0 +1,67 @@ +# 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` + +```bash +docker exec -it my_devops_toolkit /bin/bash +``` + +## Use case 1: Az login and run command + +```bash +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 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 + +```bash +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 + +```bash +➜ ~ 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 + +- For any issues, check [this reference](../troubleshooting/TROUBLESHOOTING.md)