Dan Patrick and Chris Pietschmann both use Azure CLI on a daily basis to manage and work with Microsoft Azure resources. They both have reusable scripts for common tasks, and have the regular need to write one-off scripts to get specific tasks done. All of these tasks are recurring tasks across cloud professionals and organizations and a shared library of these scripts, as well as great tips and tricks, would not only help us, but the entire Microsoft Azure community as well.
What does Azure CLI Kung Fu mean?
Here is an example:
vmIds=$(az vm list -g $RG --query ".id" -o tsv)
The “vmIds” variable will give you a list of Virtual Machines from a Resource Group that can be used for a MILLION things. This line uses a query to get at just the data you want; which in this case is the list of VM Ids.
If you just change the VM to something else in the script, it can be used for almost anything else there is. After you have this variable populated with the list of Azure resources you want to perform an action or task on, you can then use a bash loop expression to perform repeated actions againt all the resources in the list.
This is a great starting point, and the code examples and articles you’ll find here within the Azure CLI Kung Fu project will point you in the right direction to save time, and be smarter with your Azure CLI scripting.
Check out the links below for great, task specific Azure CLI Kung Fu tips and tricks!
Azure CLI Kung Fu Articles
Welcome to Az Kung Fu, grasshopper! Scripting is the only way to ensure that your environments are the same every time and remove the risk of human error. We write scripts all the time using the Azure CLI, but it feels like we always having to figure out the same...
One of the services within Microsoft Azure for building out IoT solutions is the Azure IoT Hub Device Provisioning Service (DPS). Just as with other services in Azure, the Azure CLI (cross-platform command-line tool) includes several commands that can be used to...
Have you ever spent hours building a machine to use as an admin workstation for Azure? What about installing the Windows Subsystem for Linux? Well, have we have something for you! It's always a pain to get going with a good VM to use for admin tasks with Azure. With...
It's really easy to provision an instance of Azure IoT Hub using the Azure Portal. However, there are times when you need to automate the task. You can use the Azure CLI to create new instances of Azure IoT Hub when you need to automate the task. This can help with...
To list and set the Azure Subscription to run Azure CLI commands against is an important step in command-line scripting. To do this, there are a couple important commands used to list the Azure Subscriptions your login has access to, view which subscription the CLI is...
Get in touch
Are you unable to find a script within the Azure CLI Kung Fu project to help with your needs?
Do you have a script or tip you think would be useful to include in the project?
Do have an amazing success story of how the Azure CLI Kung Fu project helped you?
Please send us a message. We would love to hear your input!