Leverage existing command-line tools for more powerful automation
Microsoft recently announced the general release of PowerShell Crescendo, a new framework to rapidly develop PowerShell cmdlets for common command-line tools, regardless of platform.
Primarily, it’s a tool to help develop PowerShell cmdlets for any command-line based tool, but it’s the object-based output that will make the biggest difference for users. Yes, you can open PowerShell on your computer and launch any command-line tool, but when the output you get back isn’t a native, object-based response, it requires additional work.
One of our DevOps Engineers, Matt Allford, recently created a YouTube video about the new Azure feature. Here’s a quick wrap-up of what he found.
How Crescendo works
PowerShell, like other shells, is capable of invoking command-line tools. However, it would improve the experience if the command-line tool could participate in the PowerShell pipeline and take advantage of the parameter behaviours that are part of PowerShell.
A Crescendo-based module aims to create PowerShell cmdlets that use a command-line tool and, unlike that tool, return PowerShell objects instead of plain text.
The Crescendo framework has two main components
Let’s dig a little deeper into each of these components:
JSON configuration file
Say you are an advanced PowerShell user with command-line tools you want to integrate into PowerShell and create native PowerShell commands for.
Using Crescendo, you can:
Output handler functions
On the other hand, you might be a user who consumes modules produced by Crescendo, and you don’t necessarily need to know anything about the JSON file.
The output handler is there running PowerShell functions to do whatever you need to convert the output from the native tool into objects in PowerShell.
The modules created in Crescendo will enable you to work from PowerShell 5.1 and onwards.
Key features and benefits:
Simple key definition of cmdlets |
Ability to define cmdlets from simple key/value statements in a JSON file |
Support for modular design |
cmdlet definitions can be in one or more JSON files |
Configuration using IntelliSense and tooltips |
A JSON schema that helps you create your Crescendo configuration using IntelliSense and tooltips |
Three styles of output handling code |
Allows you to separate your code from the cmdlet definitions for easier debugging and development |
Privilege elevation mechanisms |
Privilege elevation mechanisms in Windows, Linux and macOS |
Script module for deployment |
Crescendo generates a PowerShell script module ready for deployment |
Runs on Windows PowerShell 5.1 and higher |
While Crescendo requires PowerShell 7 or higher for authoring configurations, the generated module can run on Windows PowerShell 5.1 and higher |
Example configurations |
Copy and paste for fast configuration |
Experimental Help parsers |
Provide proof-of-concept examples for auto-generating cmdlet configurations |
More powerful automation? Yes, please.
Fast-scaling SaaS companies rely on automation. PowerShell Crescendo helps by leveraging existing command-line tools and provides the opportunity to manipulate the output into an object in PowerShell that is super powerful. Most importantly, the module replaces cumbersome command-line tools with PowerShell cmdlets that are easier to use in automation and packaged to share with team members.
If you would like more information, please get in touch with the team at Parallo.