Powershell on Azure goes Linux


People still assume that Windows is Windows, Linux is Linux, and never the twain shall meet. Not true. Microsoft loves Linux. You’ll find the latest proof of this in Azure Cloud Shell, which is now PowerShell Core 6 in Linux.

Linux? Yes, Linux.

Why? Well, as Wim Coekaerts, formerly corporate vice president of Microsoft Enterprise Open Source Group, told me once, “Satya [Nadella, Microsoft’s CEO] is very customer-centric. If [our customers] run Linux, and they often do, we want to make them happy. We have to play in an open, heterogeneous world.” He added, “Microsoft actually uses a lot of Linux in-house. It’s no longer everything has to be run on Windows internally.” Besides, “we’re solving business problems and we’re very pragmatic.”

So, pragmatically speaking, the new Azure PowerShell runs within a Linux container. Within this newly remodeled shell, existing Linux commands, such as is, sort, and sleep, take precedence over their PowerShell aliases.

Indeed, there is no difference between Azure PowerShell and the default Linux Bash shell. From Bash, you can start the PowerShell experience by running “pwsh a”. From PowerShell you can start Bash by running “bash”.

The bad news is this can lead to some confusion. For example, in Windows, the file system is not case-sensitive, whereas in Linux it is case-sensitive. So, while in Windows file.txt and FILE.txt are considered to be the same file, in the new Azure PowerShell, and Linux of course, they’re different files.

Adding to the fun and games, proper casing must be used while tab completing in the file system. But, PowerShell-specific experiences, such as tab cmdlets, are not case-sensitive.

What  should a cloud-wrangler do? Except for those PowerShell specific operations, I’d switch over once-and-for-all to Linux-style file names and systems.

Underneath Azure PowerShell is the open-source PowerShell Core. This runs on top of open-source .NET Core. It’s designed to run on Windows, Mac, and Linux. With this you can blend native operating system and PowerShell commands into single, object-oriented pipeline.

But, while Azure PowerShell and PowerShell Core share some things, don’t think they’re the same. For instance, there is no Windows-based Azure Shell program. You’ll work with the Azure PowerShell via the ssh protocol. Microsoft’s logic for this move is that since most of the Cloud Shell operations happen against service endpoints there is little to no need for a Windows client.

Besides this sea-change over to a Linux-style shell, the new Azure PowerShell will boast much faster startup. Earlier versions, 5.1, were notorious for their slowness. Microsoft states, “We expect to deliver multi-fold improvements in the startup time for PowerShell experience (and also make Bash experience faster).”

In addition, besides saving your modules and scripts to Cloud Drive, with the new Azure PowerShell persistent settings for available tools, such as Git and SSH, will be automatically saved to your Cloud Drive. This will reduce the need to do additional set-up for these tools.

This is a radical change. For some cloud admins who’ve worked exclusively with Windows Server on Azure, this move won’t come easily. But, since 40 percent of all Azure Virtual Machines are running Linux, I suspect the vast majority will be more than ready to run this new Linux-style Azure PowerShell.

Speak Your Mind


This site uses Akismet to reduce spam. Learn how your comment data is processed.