As an Azure Administrator, DevOps Engineer, Developer, or Solutions Architect you write scripts on a daily basis. Reading the Azure CLI documentation gets you part of the way there, but it’s often difficult to craft that perfect script to get today’s unique job done. This is the inspiration for the “az kung fu” project.
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.
“If you love life, don’t waste time, for time is what life is made up of.”
— Bruce Lee
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 Videos
Let’s take a look at getting started with the Azure CLI using the Azure Cloud Shell with both Bash and PowerShell scripting support, persistent storage, and automatic login to your Azure Subscription!
Azure CLI Kung Fu Articles
The Azure Cloud Shell offers the ability to manage cloud resources, virtual machines, run scripts and other tasks directly from within the browser or Azure Mobile app. There are a few command-line tools for automating tasks and scripting things with Microsoft Azure....
All web applications have some kind of configurations that are set on the server. The method of storing and accessing these settings varies on different web application platforms. In ASP.NET they are normally stored within <appSettings> element of the web.config...
The Azure CLI is the command-line tool for working with Microsoft Azure resources, and grants you access to the CLI through both the Windows Command Prompt (CMD) or PowerShell command-line. You could download and install the Azure CLI using an MSI installer, but if...
Ever wish you had a Docker dev workstation in Azure? About two months ago, we introduced the Azure Kung Fu VM, and judging by the views of that article many of you gave it a try. Today, I wanted to share a different version of that VM running Docker Desktop. You can...
TLDR: Start-->Run-->ncpa.cpl Have you ever lost 6 minutes of your life trying to find a network adapter in Windows? Yeah, me too. Windows really started to mess with everyone's mind back in Windows 8 when they moved stuff around with that horrible metro UI. ...
When an application needs to authenticate with Azure AD you can't really just give it a username and password. To authenticate and authorize an application or service with the ability to connect to Azure services and other resources you need to create a Service...