PowerShell for Linux makes it easier to mix clients, servers and clouds

Multiple platforms are now the norm for IT infrastructure. To address that Microsoft is bringing its key configuration tools to Linux and Mac OS to make it easier for customers and partners to handle their workloads, which also positions Operations Management Suite as the future of configuration management.

100515 microsoft linux
Credit: Microsoft

Microsoft’s key, .NET-based scripting and management framework is now open source and available for Linux (initially Ubuntu, RedHat and CentOS) and Mac OS, and both cloud and traditional infrastructure companies are stepping up to support it.

Open source, Linux and Mac OS announcements from Microsoft are becoming routine under CEO Satya Nadella, but making PowerShell fully open source and making it cross-platform is particularly significant — and not just because PowerShell for Linux is something that customers have been requesting for a long time.

Jeffrey Snover flickr/Microsoft PDC

Jeffrey Snover participates in a PDC panel discussion in 2009

What customers want is more support for the heterogeneous infrastructure that enterprises have always had, which now includes cloud services, and to be able to do what they need from whatever client they prefer to use, Jeffrey Snover, lead architect for Microsoft’s Enterprise Cloud Group tells CIO.com. “It’s in our interest to make it super easy to consume as much computing as makes sense for them and PowerShell makes easy for them to manage everything — Windows or Linux — using a single management stack and to do it from any client they want. They can manage it from Windows, they can manage it from Linux, they can manage it from Mac OS. They really can use the same tools and the same people to manage everything from everywhere.”

PowerShell creates to strange bedfellows

Azure is one of the key drivers for Microsoft’s increasing support for Linux; nearly a third of virtual machines running on Azure run Linux. But PowerShell for Linux goes a long way beyond that.

“PowerShell is a framework that management products build on top of,” Snover points out. “Chef builds on top of it, Puppet builds on top of it and we have our cloud management solution, Operations Management Suite, and OMS is going to build on top of it. The mission of OMS is to help manage customers’ workloads; any workload they have, Windows or Linux, anywhere they have it, whether it's on Azure or AWS or Google Cloud Engine or whether it's on-premises with Hyper-V or VMware. PowerShell on Linux provides the framework and the infrastructure to achieve that. PowerShell really is the way anybody who has anything to do with Windows manages their data centers and clouds, and now we hope to extend that to be everything.”

Perhaps surprisingly, VMware is a major PowerShell user and has already ported their PowerCLI tool, with over 400 PowerShell comandlets for managing and automating vSphere, vCloud, and vRealize Operations Manager, to Linux. “When Satya said go do what customers need, doing what customers need produces some strange bedfellows,” Snover jokes, but then points out “they were one of the very earliest adopters of PowerShell.”

That been somewhat polarizing for customers, says VMware product manager Alan Renouf. “For a long time now our customers have had a love-hate relationship with PowerShell. Customers love the fact we have all these commandlets that work against their environment and automate their infrastructure end-to-end. But our Mac and Linux customers have not been feeling the love; they're not able to use this, because it's been a Windows technology till now.” Renouf believes customers will welcome the server support, and the ability to do everything from a single machine. “It doesn’t matter where you write a script, you can run it anywhere now. I can write it on my Mac and run it in Linux using Docker to deploy all my virtual machines.”

AWS is another launch partner for PowerShell for Linux, porting its existing PowerShell commandlets. “Guess what? A bunch of our customers run workloads on AWS and AWS is a very active PowerShell community,” explains Snover, adding “and now Google has just announced that they've got a PowerShell project.”

Early days of PowerShell

Microsoft has been slowly bringing pieces of PowerShell to Linux for a while. Desired State Configuration for Linux and the promise of SSH support arrived in 2014 (several months before Microsoft open sourced .NET and brought .NET Core to Linux). The difference, Snover points out, is that “you had to author your scripts on the Windows platform, you had to configure things on the Windows platform and then deliver the desired configuration to a Linux box and have it be configured; now you can do all of that on Linux.”

Last year Microsoft also announced it would be supporting OpenSSH — a commitment PowerShell for Linux will deliver. “Our team is taking OpenSSH and porting both the client and server to Windows,” Snover explained. “This isn’t some arms’ length integration. We’re integrating it into the heart of PowerShell; it will be a native transport for the PowerShell remoting protocol. Customers will be able to choose; when I go to these machines, I want to talk to them over WinRM, when I go to these machines go over OpenSSH.”

PowerShell for Linux isn’t exactly the same as PowerShell for Windows, although the source code is available for both. the Linux port. There are obvious differences, like adding case sensitivity for Linux. “There’s also a whole set of commandlets that don’t make sense in the context of Linux, like event logs, so we removed those. Over time we’ll product more native Linux commandlets to support the Linux equivalents,” he explained.

The PowerShell code that’s available on GitHub is an alpha version, Snover says. “We’re in learning mode and we’re approaching this with both a great deal of confidence in our technology but also humbleness, learning what the Linux community needs and having them help us prioritize our backlog. We want people to be in no doubt that Linux will be a first-class system and we’ll be releasing PowerShell updates on both platforms simultaneously.”

To help with that, the PowerShell services that provide the PowerShell authoring support in VS Code will also support the Sublime editor on Linux. “Going forward, that technology will light up Emacs and Vim and a host of other editors.”

PowerShell will be one more tool for Linux admins, rather than an attempt to be a special, Microsoft way to work with Linux. “A pure Linux user will look at it and say, ‘It’s just another tool on my tool shelf.’ There are lots of tools and scripting languages and in general Linux people tend to be polyglot. PowerShell for Linux will be another shell. The advantage is we’re a richer scripting language than many and we have a wider dynamic range; you can start out casual and sloppy and then get very formal.”

That will be a good match for the increasing numbers of REST APIs and JSON objects arriving on Linux, he believes. “Where PowerShell shines is when you get structured data. A lot of the Linux world is not structured but it’s getting more so. More and more of Linux is available through structured objects because they're surfacing things through REST APIs and one of the great benefits of PowerShell on Linux is the ability to deal with structured objects. When that happens, PowerShell just knocks it out of the park. You get the great traditional PowerShell experience of something you can read like an English sentence, so you know what it's doing.” With so many Linux options configured by text files that are easy to make mistakes in, Snover believes PowerShell’s error checking will be appealing. “I'm optimistic they will [like this] because the ramifications of getting it wrong are so great. This makes it simple and easy to get it right.”

Taking a dependency on open source

PowerShell isn’t just the scripting tool that manages every Microsoft server product, from Windows Server to Exchange. It’s a big part of the switch to the highly automated and standardized way of running servers that Microsoft hopes to bring from the cloud to enterprise data centers with the Nano Server option in Windows Server 2016. (Whatever management tool you use on top, PowerShell remoting is the way you work with Nano Server.) Bringing PowerShell to Linux and Mac OS builds on both the work Microsoft has done bringing .NET Core to those platforms and on the PowerShell Core the Windows Server team created for Nano Server, which is the basis of the Linux port of PowerShell.

If you think about the way Windows Server 2016 supports containers, that relies on open source in an unprecedented way for Microsoft: after installing Windows Server 2016, you’ll still need to install third-party open source software from Docker to get the complete solution, but you can manage that with PowerShell for Docker, which works against Docker containers on Windows or Linux.

That’s Microsoft recognizing the reality of devops and open source in business (and applying its resources to help improve it; it’s working with the OpenSSH project to help improve the security of the protocol, for example). But one of the key beneficiaries could be Microsoft’s new cloud management service. “OMS provides high availability, graphical authoring, the full end-to-end solution on top of the platform,” explains Snover; “our mission with OMS is to be able to create, configure and manage all the workloads.”

Because OMS builds on PowerShell, this also helps position it to pick up where System Center leaves off. Microsoft already moved device management to the cloud with Intune; now server and cloud management is moving there too, and getting PowerShell everywhere is an important part of how Microsoft will make that work.

This story, "PowerShell for Linux makes it easier to mix clients, servers and clouds" was originally published by CIO.

Shop Tech Products at Amazon