[November 2021: Updated version of PowerShell and PowerShellGet]
Last November, we announced the first preview of Az Predictor, a PowerShell module for Azure that brings to your fingertips the entire knowledge of the Azure documentation customized to your current session.
Today we are announcing a new preview and we want to share some clarity on our plans for the next few months.
What did we learn from the first preview?
Since the release of the first preview, we listened to customer feedback and identified some challenges.
- Customers believed that the predictor was not functional. Since the service that is used to deliver the predictions did not support outages, we believe this feedback is caused by the following reasons:
- The module had to be imported manually and several customers either forgot or did not know that they had to import the module.
- The default configuration of PSReadline had to be changed to show the predications from Az Predictor.
- With an accepted suggestion, the navigation through the parameter values can be complicated especially when the list of parameters is long.
- We were not making any suggestions for several modules (for example Az.MySql).
What has changed?
The module now exposes two cmdlets ‘Enable-AzPredictor’ and ‘Disable-AzPredictor’ to automatically import the module and configure PSReadline. The cmdlet also allows users to enable the settings for future sessions by updating the user’s PowerShell profile (Microsoft.PowerShell_profile.ps1).
Az.Tools.Predictor required API changes to the PowerShell engine to improve suggestions (requiring PowerShell 7.2 preview 3 or later).
You can now use dynamic completers to easily navigate through the parameter value with the ‘Alt+A’ combination.
We are continuously improving the model that is serving the predictions displayed on your screen. This is the most important and invisible piece of software that makes the magic! The most recent update of the model now comprises the missing modules.
Getting started with preview 5
If you have installed the first preview:
- Close all your PowerShell sessions
- Remove the Az.Tools.Predictor module
To install the second preview of Az.Tools.Predictor follow these steps:
- Install PowerShell 7.2-RC1
Go to: https://github.com/PowerShell/PowerShell/releases/tag/v7.2.0-rc.1
Select the binary that corresponds to your platform in the assets list. - Launch PowerShell 7.2-RC1 and Install PSReadline 2.2 beta 4 with the following:
Install-Module -Name PSReadLine -AllowPrerelease
More details about PSReadline: https://www.powershellgallery.com/packages/PSReadLine/2.2.0-beta4 - Install Az.Tools.Predictor preview 5
Install-module -name Az.Tools.Predictor -RequiredVersion 0.5.0
More details about Az.Tools.Predictor: https://www.powershellgallery.com/packages/Az.Tools.Predictor/0.5.0 - Enable Az Predictor
Enable-AzPredictor -AllSession
This command will enable Az Predictor in all further sessions of the current user.
Note: Due to underlying API breaking changes, Az.Tools.Predictor preview 3 or newer are not compatible with PowerShell 7.2.0-preview.6 or newer. Upgrade to preview 5 of Az.Tools.Predictor to be compatible with PowerShell 7.2.0-preview.6 or newer and PS Readline 2.2.0-beta3 or newer.
Inline view mode (default)
Once enabled, the default view is the "inline view" as shown in the following screen capture:
This mode show 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 definitely 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 in the a list down your current prompt a list of possible match for the command that you are typing. It combines suggestions from the history as well as suggestions 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.
What’s next?
We are looking for feedback on this second preview.
- Open issues on GitHub: https://github.com/Azure/azure-powershell/issues
- After using the module, please fill out the survey: http://aka.ms/azpredictorsurvey
- Reach out to us on Twitter: @azureposh
We will continue to improve our predictor in the coming months. Stay tuned for our next update of the module.
Tell us about your experience. What do you like or dislike about Az Predictor? http://aka.ms/azpredictorsurvey
Further Reading
- Dynamic help: https://devblogs.microsoft.com/powershell/announcing-psreadline-2-2-beta-2-with-dynamic-help/
- Az Predictor preview 1: https://techcommunity.microsoft.com/t5/azure-tools/announcing-az-predictor/ba-p/1873104
- AI powered Azure tools: https://techcommunity.microsoft.com/t5/azure-tools/ai-powered-azure-tools/ba-p/2080799