Azure PowerShell is a very handy utility that allows you to manage Azure resources directly from the PowerShell commandline. The module currently offers over 4,000 cmdlets that users can utilize to effectively manage Azure resources, with 10 parameters being available on average per cmdlet.
To make Azure PowerShell easier to use for beginners and experts alike, Microsoft has today announced the availability of Az Predictor.
Microsoft says that people often make mistakes when experimenting with new modules due to the large number of cmdlets and parameters available, and then have to refer to the documentation to achieve their goals. To tackle this problem via a more streamlined solution, the company has announced Az Predictor, which it describes as an "intelligent command completion module", specifically for Azure PowerShell. Microsoft says:
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.
As of now, Az Predictor offers two modes: the first is inline mode which offers suggestions with a reduced level of opacity, while the second is listview mode which lists all suggestions starting with the next line.
Although Az Predictor is available for use right now, Microsoft has clarified that it is currently in preview, and depending upon feedback, it may be merged with the Az wrapper module. In order to utilize Az Predictor today, you need the following configuration:
- PowerShell 7.1+
- PSReadline 2.2.0-beta1
In order to make full use of Az Predictor, an internet connection is necessary as it makes calls to an API that returns result based on the current session's context. However, Microsoft is exploring ways to support environments which offer limited or no internet availability. The company further stated that:
Once loaded, Az Predictor will identify the value or variable used for resource group name and location and use it in the subsequent suggestions. When you start typing a command, Az Predictor will search for the cmdlet that you are the most likely to use based on the session’s context. As you type, we refine the search and display more accurate examples to use.
Az Predictor understands parametersets, required, and optional parameters and leverages the Azure PowerShell examples in the reference documentation as suggestions. The suggestions will then be adjusted based on the possible parametersets and parameters that have already been typed.
Az Predictor is open source, just like Azure PowerShell itself. Microsoft has outlined how to get started with the module in its blog post and has also encouraged users to visit the GitHub repository in case they would like to raise issues or suggest changes to the utility.