This article is contributed. See the original author and article here.

On November 10, 2020, we announced the first preview of Az.Tools.Predictor, a PowerShell module suggesting the Azure cmdlet to use with parameters and suggested values.



Today, we are announcing the general availability of Az.Tools.Predictor.


 


How it all started


During a study about a new module for Azure, I was surprised to see how difficult it was for the participant to find the correct cmdlet to use. Later, I was summarizing the learnings of the study, and though it would be great if we could have a solution that could help people finding the right cmdlet to use.


 


At the same time, we were starting to work on Predictive IntelliSense in PowerShell and after a couple of meetings with Jason Helmick, it became clear that this would be a great mechanism to address the challenge I had seen few days before by providing, in the command line, suggestions about cmdlet to use.



We quickly thought that some form of AI could help providing accurate recommendations so we involved Roshanak, Yevhen and Maoliang from our data science team to work with us on how we could build an engine that would provide recommendations for PowerShell cmdlets based on the user’s context.


 


Behind the scenes


Once a functional prototype was built, we wanted to confirm its usability before considering any public previews.
For our team usability is important, over time certain key combinations became a reflex and we knew that we had to fit in the existing memory muscle and become intuitive for PowerShell. For predictors to be successful, we organized several usability studies with prototypes of Az Predictors and addressed several improvements, like the color of the suggested text or the key combination to use to accept or navigate amongst predictions.



One of our initial prototypes was using the color scheme below, we wanted to have a clear color-based differentiation between typed characters and suggestions hoping this would help user navigate the suggestion. We worked with our design team to address the issue and evolve our design towards the current design.


 


AzPredictor-proto1.jpg


We also evaluated if the information provided in the suggestions is helpful. Below is another of our early designs. By listening to our customers and observing how they are using the tool, we learned that showing cmdlets first then parameters and associated value samples was not as useful as showing the full line and not using more space in the terminal which is our current design.


AzPredictor-proto2.jpg


During the last months we have done a few previews (read about preview 5) to stabilize the module as PowerShell and PS Readline which we depend on became stable. We have also improved our model based on the feedback we have collected and addressed issues reported.


 


Getting started


We would like to invite you to try the stable version of Az.Tools.Predictor.
To get started, follows these steps:



  1. Install or upgrade PowerShell v7.2
    https://docs.microsoft.com/powershell/scripting/install/installing-powershell

  2. Install or upgrade PSReadline 2.2
    Install-Module -Name PSReadLine -Force


  3. Install or upgrade Az.Tools.Predictor
    Install-module -name Az.Tools.Predictor -Force


  4. Enable Az Predictor
    Enable-AzPredictor -AllSession



 


Once installed, it is recommended that you restart your PowerShell sessions.


For more details, visit the Az Predictor documentation page: https://docs.microsoft.com/powershell/azure/az-predictor


 


Inline view mode (default)


Once enabled, the default view is the “inline view” as shown in the following screen capture:


InlineView-1.jpgInlineView-2.jpg


This mode shows only one suggestion at a time. The suggestion can be accepted by pressing the right arrow or you can continue to type. The suggestion will dynamically adjust based on the text that you have typed.
You can accept the suggestion at any time then come back and edit the command that is on your prompt.


 


List view mode


This is my favorite mode!


Switch to this view either by using the “F2” function key on your keyboard or run the following command:


Set-PSReadLineOption -PredictionViewStyle ListView

This mode shows from your current prompt a list of possible matches for the command that you are typing. It combines suggestions from your local history and from Az Predictor.


Select a suggestion and then navigate through the parameter values with “Alt + A” to quickly fill replace the proposed values with yours.


ListView-1.jpg


 


Next steps


This is just the beginning of our journey to improving the usability of Azure PowerShell!


We will be carefully listening to every feedback that you send us: 



We will share soon more about how we plan to expand this experience to other environments.


 


Credits


“It takes a village to raise a child” Az.Tools.Predictor is the result of the close collaboration of several teams distributed across continents and time zones working hard during the pandemic.


 

Brought to you by Dr. Ware, Microsoft Office 365 Silver Partner, Charleston SC.