tooling.mdMarkdown, rendered
Tooling
Baseline
- Target modern PowerShell (
pwsh) and current stable feature set (7.5+). - Use
PSScriptAnalyzeras the required lint/static-analysis gate. - Use
PSResourceGet(Install-PSResource,Find-PSResource,Publish-PSResource) for module/script package workflows. - Treat
Microsoft.PowerShell.PSResourceGetas the modern package-management surface replacing legacy-first PowerShellGet/PackageManagement guidance.
PSScriptAnalyzer
- Run
Invoke-ScriptAnalyzer -Path <project> -Recursein CI. - Prefer settings-file driven rules (
PSScriptAnalyzerSettings.psd1) to keep policy explicit and reviewable. - Prefer explicit, scoped suppressions with justification instead of global disable patterns.
- Enforce naming and safety rules first:
PSUseApprovedVerbsPSUseShouldProcessForStateChangingFunctionsPSAvoidUsingInvokeExpressionPSAvoidUsingPlainTextForPasswordCompatibility checks (PSUseCompatibleCmdlets,PSUseCompatibleSyntax, etc.) where version portability is required.
PSResourceGet
- Prefer
Install-PSResourceover legacy-only PowerShellGet v2 workflows. - Use repository registration and trust models intentionally:
Register-PSResourceRepositorySet-PSResourceRepositoryInstall-PSResource -Repository <name> - Default install scope for local development should be
CurrentUserunless automation/system context requiresAllUsers. - Use
-WhatIf/-Confirmwhere available during automation development and high-impact package operations. - Never hardcode tokens or PAT values in scripts.
CI Pattern
- Typical quality gate order: Script/module import sanity
Invoke-ScriptAnalyzerInvoke-Pester - Fail build on analyzer warnings for critical rules in reusable modules.
- Keep PowerShell and module versions explicit in CI runners to reduce drift.