Skip to main content

Documentation Index

Fetch the complete documentation index at: https://tally.wharflab.com/llms.txt

Use this file to discover all available pages before exploring further.

powershell/PSAvoidGlobalAliases is a PSScriptAnalyzer diagnostic emitted by tally for PowerShell snippets embedded in Dockerfiles.
PropertyValue
SeverityWarning
CategoryPSScriptAnalyzer
Auto-fixNo

Description

Globally scoped aliases override existing aliases in the session with matching names, which can cause difficult-to-debug issues for consumers of modules and scripts. To understand more about scoping, see Get-Help about_Scopes. NOTE This rule is not available in PowerShell version 3 or 4 because it uses the StaticParameterBinder.BindCommand API.

How

Use other scope modifiers for new aliases.

Examples

Problematic code

New-Alias -Name Name -Value Value -Scope Global

Correct code

New-Alias -Name Name1 -Value Value

Source

This rule documentation is adapted from Microsoft’s PSScriptAnalyzer documentation for AvoidGlobalAliases, licensed under CC BY 4.0.