-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |