💡 Learn more : Extensions with Azure CLI.
📺 Watch the video : How to take advantage of Azure CLI Extensions.
The Azure CLI is a powerful command-line interface that you can use to manage your Azure resources. It comes loaded with lots of commands that you can use to create resources like VMs and Web Apps and do almost anything with them that you can imagine, like swap a deployment slot.
Sometimes, the commands that the Azure CLI offers aren't enough. Or maybe you want to use them differently than they allow you to. For these cases, you can use Azure CLI Extensions. Azure CLI extensions are additions to the CLI that are built by Microsoft and the community and provide you with additional functionality. The extensions are Python wheels that you can run as CLI commands. Python wheel is a built-package format for Python code that allows small code packages to be installed and uninstalled in client applications easily.
You can view a list of all of the CLI extensions here. And you can also see the list when you type the command az extension list-available --output table in the Azure CLI.
Installing Azure CLI extensions is very easy. First, open up an instance of the Azure CLI. You can open a local instance on your computer (make sure that you are running the latest version of the CLI) or open it in the Azure Cloud Shell (https://shell.azure.com).
Once you are in the Azure CLI, you can install extensions with this command:
az extension add --name <extension-name>
You can use the name of any extension that is listed in the az extension list-available list. If you want to use an extension that's not in the list, for instance an extension that you've built yourself, you can add it by using the URL or the local path to it. Just make sure that your CLI instance has access to the extension that you are trying to install. In the case of an external extension that you need to add with a URL or local path, you should use his command:
az extension add --source <URL-or-path>
You can also update extensions to their latest version. You do that by using this command:
az extension update --name <extension-name>
And you can also uninstall extensions when you are done with them. Use this command to remove an extension:
az extension remove --name <extension-name>
Here is an example of installing the Azure CLI Extension called "Find". This extension talks to a Microsoft AI-powered API, called Azure Aladdin, that helps to make using Azure easier. The extension is currently in preview. By the time you read this post, the find extension might have changed or might have become a part of the Azure CLI.
(Installing the "Find" extension in the Azure Cloud Shell)
The help extension is really cool. You can for instance use it to get explanations about Azure CLI commands.
(Get CLI command explanations from the "Find" extension in the Azure Cloud Shell)
You can also use the extension to find commands. This is really useful when you know that there should be a CLI command for something but don't not exactly what it is.
(Get CLI command explanation from the "Find" extension in the Azure Cloud Shell)
The Azure CLI is a very powerful tool and CLI extensions make it even more powerful and useful. Check out the list of extensions to see if there are any in there that can help you.