In today’s post, we’ll quickly discuss how to configure automatic updates of Azure CLI.
If you don’t know what Azure CLI is, then for simplicity understand that it is a commandline interface to interact with Azure resources. It’s awesome and easy to understand! It’s heavily used in scripting and highly recommended to use when have to write long and easily understandable scripts.
If you wish to read more on this, the please visit: https://docs.microsoft.com/en-us/cli/azure/

The official documentation says,
The Azure command-line interface (Azure CLI) is a set of commands used to create and manage Azure resources. The Azure CLI is available across Azure services and is designed to get you working quickly with Azure, with an emphasis on automation.

If you manually want to update your CLI, the open the PowerShell or bash and hit the following command:

az upgrade

For automation, the things change a little. We hit the following command:

az config set auto-upgrade.enable=yes

What the above command does is, azure cli would regularly check for new versions and prompt you to upgrade.
An important aspect to note here is that the above command would only enable auto checking of versions. It won’t update your CLI! Instead, it would prompt you! So, now we want to automate that too. We don’t want Azure CLI to prompt us, we simply want it to get automatically updated. For this purpose, we’ll hit an additional command that would set the prompt to no and would set the CLI to be automatic update.

az config set auto-upgrade.prompt=no

Gotchas!!

There might be a case when you would only want the CLI to be updated and not the extensions that you might have installed. So for that case, you’ll need to pass an additional command:

az config set auto-upgrade.all=no

To disable automatic update of CLI, use the following command:

az config set auto-upgrade.enable=no

You might want to disable it in your Production build and deployment servers where the scripts are already running fine and an update might break the whole setup! Test out the upgrade in lower environments and then roll it out on systems like production!

Defaults!!

  • By default, auto-upgrade for Azure CLI is disabled.
  • By default, all installed extensions are also updated when Azure CLI is updated.

You may read more about this in detail at: https://docs.microsoft.com/en-us/cli/azure/update-azure-cli

error: Content is protected !!
%d bloggers like this: