Skip to content

fix(ci): copilot-setup-steps PS module install fails on unelevated agent runner #2239

Description

@katriendg

The Install PowerShell modules step in .github/workflows/copilot-setup-steps.yml installs modules with -Scope AllUsers, which targets /usr/local/share/powershell/Modules and requires root. The Copilot cloud coding-agent runner executes setup steps unelevated, so PowerShell-Yaml fails:

Administrator rights are required to install modules in '/usr/local/share/powershell/Modules'

Run: https://github.com/microsoft/hve-core/actions/runs/28358970351/job/84008736477

The retry/backoff added in #2134 does not help — it targets transient PSGallery outages, but this is a fixed permissions error, so all 3 attempts fail identically.

Root cause

PR #2134 intentionally kept copilot-setup-steps.yml calling Install-PSModules.ps1 directly with -Scope AllUsers (bypassing the composite action, whose cache restores only to the CurrentUser path). That assumed an elevated runner; the coding-agent runner is not elevated.

Fix

Switch the call to -Scope CurrentUser, which installs to ~/.local/share/powershell/Modules (no admin needed) and is on the same runner user PSModulePath the agent reads. Update .github/copilot-instructions.md to document the rationale.

Acceptance

  • copilot-setup-steps workflow completes the module install step on the cloud agent
  • No AllUsers/admin-rights errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingciContinuous integration

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions