Skip to content

Commit 3ef32ae

Browse files
authored
doc: add azure cli usage (#121)
2 parents 809d0f7 + 551631f commit 3ef32ae

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

docs/usage/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,14 @@ This guide us how to use the `devops-toolkit` with serveral usecases
2222

2323
- Check [**helm_usage**](./helm_usage.md)
2424

25-
## AWSCli
25+
## AwsCLI
2626

2727
- Check [**awscli_usage**](./awscli_usage.md)
2828

29+
## AzureCLI
30+
31+
- Check [**azurecli_usage**](./azurecli_usage.md)
32+
2933
## Troubleshooting
3034

3135
- For any issues, check [this document](../troubleshooting/TROUBLESHOOTING.md)

docs/usage/azurecli_usage.md

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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

Comments
 (0)