Facebook LinkedIn Instagram Vimeo WeChat WhatsApp YouTube
Back to Blog

More powerful automation? Yes, please.

-

Crescendo adds more energy to PowerShell

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

  • A JSON configuration filethe Crescendo module provides cmdlets to help you create the JSON configurations and build a module containing the cmdlets you define.
  • Output handler functions – you must write your own output handler functions that return PowerShell objects

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:

  • Use cmdlets inside the module to create a JSON file from a schema.
  • Output handler functions – you must write your own output handler functions that return PowerShell objects
  • You could also use a JSON file from an online example or a previous one that you’ve used.
  • From there, you need to configure it to run an underlying command-line tool, to create PowerShell modules that wrap around it and transform the output.
  • Then, use another command in the Crescendo module to read back the JSON file to create a custom PowerShell module including the cmdlets you’ve created and defined.

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 WindowsLinux 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.

Related Topics