Typos or module not installed? Azure PowerShell now provides in tool assistance
Starting with Az v8.2.0 we are providing suggestions when PowerShell cannot find a command, as shown in the animated GIF. We not only detect typos, but also many other use cases such as when the required module is not installed.
Azure PowerShell gives a suggestion against a typo in the command name.
Use cases
Typo
For typos, Azure PowerShell tries to find commands that are similar to the input. If any are found, the candidates will be displayed as recommendations.
To do this, we maintain a static table of mappings from all the commands to modules. The table ships with each release of Az.Accounts module. Because of this, no network requests are involved in the recommendation process. The file to store the mappings takes around 300 KB of disk space after installation. But the size of the package is increased by merely 60 KB.
Module not Installed or Outdated
One of the biggest reason a command cannot be found is that the corresponding module is not installed. It could be the module is in preview, so it is not included in the Az rollup module. Or the modules were installed separately rather than via the rollup module.
A similar case is that an older version of the module is installed but the command is introduced in a newer version.
In both cases, Azure PowerShell tries to figure out which Az module needs to be installed or updated. Suggestions are displayed accordingly.
Azure PowerShell suggests user to install the module when a command is not recognized.
Command Deprecation
Breaking changes are sometimes inevitable. To reduce the effort of upgrading, Azure PowerShell displays warning messages for the upcoming breaking changes. We also created migration guides for each major release. Now, leveraging this feature, we have added real-time inline suggestions for deprecated commands.
In such case, Azure PowerShell displays a message to explain the reason and guide user to the migration documents.
Azure PowerShell warns about deprecated commands.
Note that the message is only for commands that have been deprecated. There is another system to preannounce upcoming breaking changes, and that will not be affected.
Advantages
- Quick response. In our test, the worst-case end-to-end time is no longer than 150 milliseconds. The latency introduced by intelligent recommendation was not noticeable.
- Compatibility. Both PowerShell 7 and Windows PowerShell are supported.
Limitations
- The intelligent recommendation system is triggered only when the command matches Azure PowerShell pattern (“*-Az*”) due to performance considerations.
- To enable the feature, the Az.Accounts module needs to be imported.
Feedback
This feature is already available. Feel free to share your experience in the comments below or GitHub discussions. We welcome your feedbacks!
Published on:
Learn moreRelated posts
Unlocking the Best of Azure with AzureRM and AzAPI Providers
With the recent release of AzAPI 2.0, Azure offers two powerful Terraform providers to meet your infrastructure needs: AzureRM and AzAPI. The ...
Announcing AzAPI 2.0
The AzAPI provider, designed to expedite the integration of new Azure services with HashiCorp Terraform, has now released 2.0. This updated ve...
Azure CLI docker container base Linux image is now Azure Linux
Starting from the version 2.64.0 of Azure CLI, the base Linux distribution of Azure CLI is now Azure Linux. Impact of the change ...
Mastering the Shorthand Syntax in your daily workflow
Introduction In this tech blog, we'll unravel the magic behind Azure CLI shorthand syntax and discover how it can elevate your command-line ex...
Azure Verified Modules - Monthly Update [June]
AVM Module Summary The AVM team are excited that our community have been busy building AVM Modules. As of June 17th, the AVM Footprint curren...
Azure Verified Modules - Monthly Update [May]
Quarterly Community Call This month we held our first community call. Thank you to everyone that attended & contributed. It was amazing t...
Azure CLI and PowerShell Tools Build 2024 Announcement
Microsoft has announced several new capabilities for Azure CLI and Azure PowerShell at the Microsoft Build 2024. The priority remains to provi...
Terraform on Azure May 2024 Update
Welcome to our April 2024 update! These blogposts will be covering everything we've gotten up to recently with Terraform on Azu...
Azure Verified Modules - Monthly Update [April]
In the April edition of the Azure Verified Modules update, the AVM team announces their upcoming quarterly community call scheduled for 21st M...
Announcing AzAPI Dynamic Properties
It’s been almost two years since the announcement of AzAPI, and the provider has eclipsed 20M+ downloads thanks to all of you. We’re ex...