One of the many appeals of administering Azure outside of a Portal that may change more often and more radically than what the average IT Pro may like is the option to leave the browser behind altogether and move to a more stable – albeit less visually appealing interface. The command line.
The command line is how we all started – “we” being the old folks amongst us who remember Novel, DOS, Unix and other technical dinosaurs. The days before PowerShell when text editors were the only choice, and Edlin was a tool we really used in production to edit batch files. Moving forward, the Unix and Linux community spawned many shells, one of which is now available on Windows 10 natively, specifically Bash.
You may be wondering if I’m heading towards cross-platform PowerShell, since PowerShell is now available in a cut down form on Linux and Mac along with its full fat experience on Windows. the Azure Powershell extensions are currently only available on Windows.You could successfully argue that Python is available across platforms, including Windows however, we’re only half way down the road to a correct solution.
Azure CLI 2.o is Python based, which is exposed in a lot of its syntactical choices. It’s incredibly easy to install within the Python environment for macOS, Linux and Windows (after downloading and installing Python 3.5 for Windows) as well as Docker.
Once installed, we can now write true cross-platform code. Once. And share it on any OS without modifications.
Code examples are generous and include the ability to
- Create a Windows virtual machine
- Create a Windows VM and run DSC configuration
- Create a Linux virtual machine
- Create a Linux VM with WordPress installed
- Bind a custom SSL certificate to a web app
- Create a single database and configure a firewall rule
Moving from examples to full syntax is made easier with a detailed reference that documents each individual Azure CLI 2.0 command.
PowerShell is still an amazing shell in its own right however, Azure management is not available in Powershell across all platforms in the short to medium term. If you or your team are looking for a portable set of scripting skills which translate across Operating Systems, have a closer look at the Azure CLI.