Azure PowerShell Az Predicorl ListView

Written by 7:16 am PowerShell • 6 Comments

Az Predictor Module – Azure PowerShell Predictions

Azure PowerShell is one of my preferred ways to build automation and manage Microsoft Azure. However, as Damien Caro (Microsoft Program Manager) mentions, the Azure PowerShell modules has over 4,000 cmdlets and, on average, ten parameters per cmdlet. This can make it hard to find the right cmdlet and parameter for what you want to do. To make this easier, the team created the Az Predictor, an intelligent command completion module for Azure PowerShell. Az Predictor will help you with predictions when you run Azure PowerShell.

In the last couple of days and weeks, I started to try out the new PowerShell Predictive IntelliSense and Az Predictor, and together with the PSReadline version, and I wouldn’t work without it anymore. it kind of reminds me of the AI-supported Azure CLI command in az find.

Az Predictor helps our Azure developers find the cmdlet they are looking for efficiently, identify the required parameters quickly, and experience fewer errors.
We worked closely with the PowerShell team to have Az be the first module that leverages this new interface and bring suggestions to the developer’s fingertips. Az Predictor takes the context of the current session into account in its suggestions. With Az Predictor’s context-aware suggestions users will be guided through the discovery of cmdlets and will not need to go to the online help as often.

Damien Caro – Microsoft Program Manager

You can read more in the official announcement blog on Microsoft Tech Community and preview 2 here.

Az Predictior Modes for Azure PowerShell

Inline mode – Suggestions of parameters and values will appear on the rest of the command line.

Azure PowerShell Az Predicorl InlineView
Azure PowerShell Az Predicorl InlineView

Listview mode – This will show several suggestions below the command line with the complete parameter set displayed.

Azure PowerShell Az Predicorl ListView
Azure PowerShell Az Predicorl ListView

Getting started with Az Predictor

Az Predictor is currently a module in preview in the PowerShell gallery. It leverages the subsystem plugin model that is available after PowerShell 7.2 and used by PSReadline 2.2.2.

You can learn more about this in my PowerShell Deep Dive reaction video.

Requirements

Install Az Predictor

To install and get started just follow these easy steps:

  1. Install PowerShell 7.2
  2. Install PSReadline 2.2
    Install-Module PSReadline -Force
  3. Install Az.Tools.Predictor preview
    Install-Module -Name Az.Tools.Predictor
  4. Enable the plugins
    Enable-AzPredictor -AllSession
  5. Enable the list view mode (Optional)
    Set-PSReadLineOption -PredictionViewStyle ListView

If you want to load Az predictor every time you start PowerShell (and trust me you want that 😉), you can add the last three commands to your PowerShell profile.

I usually use the following in my setup:

Install-Module -Name PSReadline -force
Install-Module -Name Az.Tools.Predictor
Enable-AzPredictor -AllSession
Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -Colors @{ InlinePrediction = "$([char]0x1b)[36;7;238m"}

Conclusion and Feedback

I hope this blog provides you with an overview of this awesome new module, which allows you to predict your Azure PowerShell commands. The team is currently looking for feedback so log issues, feature requests, or design changes on GitHub, and take a moment to fill this brief survey.

If you have any questions feel free to leave a comment.

Last modified: November 18, 2022
Close Search Window
Close