DEV Community

Cover image for What are Azure CLI Extensions?
Michael Crump for Microsoft Azure

Posted on • Updated on

What are Azure CLI Extensions?

This is Part 1 of 2. You can check out Part 2 below.

What are 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 and using an Azure CLI Extension

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>
Enter fullscreen mode Exit fullscreen mode

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>
Enter fullscreen mode Exit fullscreen mode

You can also update extensions to their latest version. You do that by using this command:

az extension update --name <extension-name>
Enter fullscreen mode Exit fullscreen mode

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>
Enter fullscreen mode Exit fullscreen mode

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.

Alt Text

(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.

Alt Text
(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 exactly what it is.

Alt Text
(Get CLI command explanation from the "Find" extension in the Azure Cloud Shell)

Conclusion

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.

Stay connected with me on various social platforms for daily software development news.

Top comments (3)

Collapse
 
prometheusrising1 profile image
PrometheusRising1

Please address basic security screening of wheels.

Collapse
 
mbcrump profile image
Michael Crump

Hey, the actual Python Wheel project doesn't offer much here except of generating signatures. Which you can see here on the official Python page - python.org/dev/peps/pep-0427/. LMK if there is something else missing especially if you are a Python dev in the security space. Let's learn together.

Collapse
 
robertplata profile image
robertplata

To what audience is CLI intended? Administrators?