You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version 2.40.0 of the az cli included this addition that replaced the previous executable with an entry script, az.ps1. Now because it's an "ExternalScript" it triggers the PSAvoidUsingPositionalParameters rule, even though they're not "PowerShell" parameters and az isn't really a "PowerShell" script in the sense that it has named and positional parameters.
Steps to reproduce
Install az cli 2.40.0
Create a file az-test.ps1 with the following line
az account management-group create --name $name--display-name $displayName--parent $parent
Run Invoke-ScriptAnalyzer against it
Invoke-ScriptAnalyzer .\az-test.ps1
Expected behavior
No output, as no issues are detected
Actual behavior
RuleName Severity ScriptName Line Message
-------- -------- ---------- ---- -------
PSAvoidUsingPositionalParameters Information az-test.ps 1 Cmdlet 'az' has positional parameter. Please use named
1 parameters instead of positional parameters when calling a
command.
I've also tested this with PS 7.2.6 and gotten the same result. This is a weird "bug" because everything is doing what it's supposed to on a surface level, it's just that all this "correct" behavior has intersected to cause overall incorrect behavior. Maybe it just shouldn't check external scripts? Or maybe the az cli is popular enough that an exception can be made directly where PSSA won't test calls to az.ps1?
The text was updated successfully, but these errors were encountered:
Opened a PR with a fix and since we are close to releasing a new version, hope to get this out very soon. In the meantime you could suppress az specifically using [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPositionalParameters', 'az')]
Version 2.40.0 of the az cli included this addition that replaced the previous executable with an entry script, az.ps1. Now because it's an "ExternalScript" it triggers the PSAvoidUsingPositionalParameters rule, even though they're not "PowerShell" parameters and az isn't really a "PowerShell" script in the sense that it has named and positional parameters.
Steps to reproduce
Install az cli 2.40.0
Create a file az-test.ps1 with the following line
Run Invoke-ScriptAnalyzer against it
Expected behavior
No output, as no issues are detected
Actual behavior
Environment data
I've also tested this with PS 7.2.6 and gotten the same result. This is a weird "bug" because everything is doing what it's supposed to on a surface level, it's just that all this "correct" behavior has intersected to cause overall incorrect behavior. Maybe it just shouldn't check external scripts? Or maybe the az cli is popular enough that an exception can be made directly where PSSA won't test calls to az.ps1?
The text was updated successfully, but these errors were encountered: