Azure Header Background Image

Use the Azure CLI from Linux, Mac or Windows

If you’ve been following the growth and culture changes at Microsoft lately (and we have), you’ve probably noticed a different Microsoft emerging under the new leadership. With that has come an increase in company openness and a set of tools that “play nice” with other platforms. We’ve seen the emergence of “Linux Bash on Windows,” a cross-platform, free, code editor (Visual Studio Code), the open sourcing of .NET, C# language compilers, and ASP.NET and a massive shift toward “coding in the open” on GitHub/Microsoft. Another example is the cross-platform Azure CLI (Command Line Interface).

Historically, to script controlling, modifying and automating the management of your Azure environment meant using PowerShell cmdlets from Microsoft — and PowerShell means you have to run it on Windows. The Azure CLI is different. It’s open source and built on Node.js. Which means if you already have Node installed, you can set up the CLI with this npm command:

npm install azure-cli –global

Here is the Azure CLI running side-by-side in a Windows PowerShell prompt and Mac Terminal.

image  image

You can even install the Azure CLI in a Docker container:

docker run -it microsoft/azure-cli

If you’re not sure about NPM (Node Package Manager) there are also Azure CLI installers available directly on the Azure site (for Linux, Mac and Windows).

Here are some Azure CLI commands to get you started:

[Calebs-MBP:~ calebjenkins$ azure help (the most useful command)

 

[Calebs-MBP:~ calebjenkins$ azure --version
0.10.1 (node: 4.2.4)

[Calebs-MBP:~ calebjenkins$ azure login   // without parameters, this will give you a URL and code to authenticate with in the browser, then your CLI session will be logged in.. easypeasy!
info:    Executing command login
/info:    To sign in, use a web browser to open the page https://aka.ms/devicelogin. Enter the code AXXXXXXXJ to authenticate.
info:    Added subscription Azure Free Trial
info:    Added subscription Windows Azure MSDN - Visual Studio Ultimate
info:    Added subscription Pay-As-You-Go
info:    Setting subscription "Azure Free Trial" as default
+
info:    login command OK
Calebs-MBP:~ calebjenkins$

While the breadth of what’s available via the Azure CLI doesn’t yet seem to be as robust as the PowerShell cmdlets, we like the cross-platform options and hope to see more features coming this way! (And if there’s a feature we really want, maybe we’ll just fork and add it.)

As Microsoft continues to do more and more on Azure, so are we! Be sure to watch our Azure space for more upcoming courses.

Caleb Jenkins

Caleb Jenkins is an international speaker, author and 6 time Microsoft MVP award recipient and is currently working at Linux Academy in Ft. Worth, where he is creating the best on-line learning experience for Microsoft Azure anywhere. An entertaining and informative speaker that approaches software from a fresh perspective that spans UX, Agile and enterprise customers from across the globe. He has previously led UX product design teams, coached multi team agile transformations and architected and mentored at some of the largest companies in the world. As a long time community leader and former Microsoft Developer Evangelist Caleb is well known for his engaging speaking style, depth of knowledge and creative energy. You can follow Caleb on twitter @calebjenkins or read his blog at developingUX.com

Leave a Reply

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