Video: Install Azure CLI and Azure Functions CLI

If you are familiar with Microsoft Azure, you know it is a cloud platform for creating and running apps, websites, databases, and much more. Microsoft Azure is a competitor to other popular cloud services like Amazon’s AWS and Google’s Google Cloud Platform. In preparing for another article in my Cloudifying my app series, I wanted to get the Azure command-line interface (CLI) and Functions CLI running. As a Windows-centric person, I was thrust into a number of technologies that are brand new to me, so I will share with you how to get up and running with the Azure CLI in this article and related video.

[tg_youtube video_id=”pLvvl9D7l3c”]

Note: The first portion of the video covers installing the Azure CLI. Fast forward to 09:20:00 to watch how to install the Azure Functions CLI.

What is Azure CLI?

Azure is the umbrella name for all of Microsoft’s cloud computing services. You can use Azure to build databases and applications in the cloud. Of course, your app may be widely available to anyone in the world or it could be secured so only people in your company can run it.

If you are managing Azure, you can certainly do almost anything you want via the Azure portal. As you can see in the following image, the portal is a robust solution for creating and managing virtual machines, functions, databases, app services, and much more.

Azure CLI

While the portal is very handy, there are a lot of clicks involved to get what you want. For example, if you want to create a new virtual machine in Azure, you need to login to the portal, select the virtual machine type, select various options in different screens, and then finally create the VM.

Of course, that process is not bad, but if you compare it to the following command, using the portal is downright onerous:

az vm create -n MyLinuxVM -g MyResourceGroup –image UbuntuLTS –data-disk-sizes-gb 10 20

If you are familiar with using Microsoft’s PowerShell, then you will be very comfortable working with the Azure CLI. As a matter of fact, Microsoft does have support for PowerShell, but I am not too familiar with this product.

Azure Functions CLI

Azure Functions are an element of Microsoft’s push toward serverless computing, and specifically microservices. Functions are fairly new in terms of the overall Azure stack. That means there are still some quirks. For example, Visual Studio 2017 does not have the ability to create Functions. Instead, you have to create a class and then add functionality that allows the class to act as a function. Confusing? Don’t worry as I cover this in another article (and video).

The Functions CLI is a useful command-line utility that allows you to create and test Azure Functions locally on your computer. The CLI offers a host of other features, so I suggest you check out their GitHub project for more details. As of this writing, the Azure Functions CLI is only available on Windows, where the Azure CLI is cross-platform.

Installing Azure CLI on Windows 10 Anniversary Update

The Azure CLI runs in a UNIX shell called Bash. There are a number of ways to run Bash on your Windows computer, but Microsoft focuses on using Bash on Ubuntu on Windows, where Ubuntu is a Linux operating system.

To the best of my knowledge, the only way to get this special version of Bash that Microsoft supports is by using Windows 10 Anniversary Update (or greater).

Install Azure CLI

Follow these instructions to install Bash and the Azure CLI on Windows 10 Anniversary Edition (or greater):

    1. Select the Windows Start icon, type Settings, and then press the Enter key on your keyboard.
    2. The Windows Settings dialog appears. Select the Update & security item.
    3. The Update Status dialog appears. Select the For developers menu link on the left side of the dialog.
    4. The Use Developer Features dialog appears. Select the Developer Mode item.
    5. When complete, restart your computer.
    6. After you log back in to your computer, select the Windows Start icon, type the words control panel, and then press the enter key on your keyboard.
    7. The Adjust your computers settings dialog appears. Select the Programs link.
    8. The Programs dialog appears. Select the Turn windows features on or off item.
    9. Select Windows subsystem for Linux (beta) item.
    10. Select the OK button.
    11. Restart your computer.
    12. After you log back in to your computer, click the Windows Start icon, type the word bash.exe, and then press the enter key on your keyboard.
    13. Follow the instructions to install Bash (the video provides more detail). TIP: Keep your username to one word (for example, I used Bill instead of Bill Raymond). Your username does not have to be the same as your Windows username.
    14. Restart your computer.
    15. After you log back into your computer, click the Windows Start icon and type Bash. Select the Bash on Ubuntu on Windows item.
    16. The Bash window appears showing your name as the logged in user. Type the following commands one at a time, pressing the enter key on your keyboard each time:

echo “deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ wheezy main” | \sudo tee /etc/apt/sources.list.d/azure-cli.listsudo apt-key adv –keyserver packages.microsoft.com –recv-keys 417A0893

sudo apt-get install apt-transport-https

sudo apt-get update && sudo apt-get install azure-cli

Optional: Install the az component function:

sudo apt-get update && sudo apt-get install azure-cli

    • To make sure the Azure CLI runs, type the following command and then press the enter key on your keyboard:

az

Click here to learn more about installing and using the Azure CLI.

Install Azure Functions CLI on Windows

As of this writing, the Azure Functions CLI only runs on Windows and does not use Bash. You will run the Azure Functions CLI using Node.js. Follow these steps to install the Azure Functions CLI on Windows:

    1. Go to the Node.js website. Download and run the Windows Installer. Follow the steps, leaving the defaults as they are.
    2. Click the Windows Start icon, type node, and then select the Node.js command prompt item. Important: You must use the command prompt, not the desktop app.
    3. The Node.js command prompt window appears. Type the following command, and then press the enter key on your keyboard:

npm i -g azure-functions-cli

  1. Once the installation is complete, type Exit and then press the enter key on your keyboard.

After the installation is complete, you can run the Node.js desktop application to make use of the Azure Functions CLI.

Click here to learn more about installing and using the Azure Functions CLI.

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top