Skip to content

Commit

Permalink
doc: add azure cli usage (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
tungbq authored Mar 17, 2024
2 parents 809d0f7 + 551631f commit 3ef32ae
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/usage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
67 changes: 67 additions & 0 deletions docs/usage/azurecli_usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Use azurecli in the devops-toolkit

## Prerequisite

An Azure account

## azurecli document

Some document to help you start with azurecli

- <https://learn.microsoft.com/en-us/cli/azure/>

## 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 <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

```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)

0 comments on commit 3ef32ae

Please sign in to comment.