Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Az modules not added to $env:PSModulePath as part of Install-PowershellAzModules.ps1 #11764

Open
2 of 15 tasks
ChrisGibson1982 opened this issue Mar 10, 2025 · 3 comments
Open
2 of 15 tasks

Comments

@ChrisGibson1982
Copy link

Description

The script "images/windows/scripts/build/Install-PowershellAzModules.ps1" downloads the powershell Az modules to c:\modules. At the end of the script, it should add c:\modules to the psmodulepath. This doesn't happen and the modules are not available to powershell. If you try and find them in a pipeline (Get-module az* -listavailable) or use them, it doesn't find them.

Platforms affected

  • Azure DevOps
  • GitHub Actions - Standard Runners
  • GitHub Actions - Larger Runners

Runner images affected

  • Ubuntu 20.04
  • Ubuntu 22.04
  • Ubuntu 24.04
  • macOS 13
  • macOS 13 Arm64
  • macOS 14
  • macOS 14 Arm64
  • macOS 15
  • macOS 15 Arm64
  • Windows Server 2019
  • Windows Server 2022
  • Windows Server 2025

Image version and build link

Built from git tag : win25/20250303.1

Starting: Initialize job
Agent name: 'Agent1'
Agent machine name: 'Server1'
Current agent version: '4.251.0'
Current image version: 'dev'
Agent running as: 'Server1$'
Prepare build directory.
Set build variables.
Download all required tasks.
Checking job knob settings.
Knob: DockerActionRetries = true Source: $(VSTSAGENT_DOCKER_ACTION_RETRIES)
Knob: AgentToolsDirectory = C:\hostedtoolcache\windows Source: ${AGENT_TOOLSDIRECTORY}
Knob: UseGitLongPaths = true Source: $(USE_GIT_LONG_PATHS)
Knob: EnableIssueSourceValidation = true Source: $(ENABLE_ISSUE_SOURCE_VALIDATION)
Knob: AgentEnablePipelineArtifactLargeChunkSize = true Source: $(AGENT_ENABLE_PIPELINEARTIFACT_LARGE_CHUNK_SIZE)
Knob: ContinueAfterCancelProcessTreeKillAttempt = true Source: $(VSTSAGENT_CONTINUE_AFTER_CANCEL_PROCESSTREEKILL_ATTEMPT)
Knob: ProcessHandlerSecureArguments = false Source: $(AZP_75787_ENABLE_NEW_LOGIC)
Knob: ProcessHandlerSecureArguments = false Source: $(AZP_75787_ENABLE_NEW_LOGIC_LOG)
Knob: ProcessHandlerTelemetry = true Source: $(AZP_75787_ENABLE_COLLECT)
Knob: UseNewNodeHandlerTelemetry = True Source: $(DistributedTask.Agent.USENEWNODEHANDLERTELEMETRY)
Knob: ProcessHandlerEnableNewLogic = true Source: $(AZP_75787_ENABLE_NEW_PH_LOGIC)
Knob: EnableResourceMonitorDebugOutput = true Source: $(AZP_ENABLE_RESOURCE_MONITOR_DEBUG_OUTPUT)
Knob: EnableResourceUtilizationWarnings = true Source: $(AZP_ENABLE_RESOURCE_UTILIZATION_WARNINGS)
Knob: IgnoreVSTSTaskLib = true Source: $(AZP_AGENT_IGNORE_VSTSTASKLIB)
Knob: FailJobWhenAgentDies = true Source: $(FAIL_JOB_WHEN_AGENT_DIES)
Knob: CheckForTaskDeprecation = true Source: $(AZP_AGENT_CHECK_FOR_TASK_DEPRECATION)
Knob: CheckIfTaskNodeRunnerIsDeprecated246 = True Source: $(DistributedTask.Agent.CheckIfTaskNodeRunnerIsDeprecated246)
Knob: UseNode20ToStartContainer = True Source: $(DistributedTask.Agent.UseNode20ToStartContainer)
Knob: LogTaskNameInUserAgent = true Source: $(AZP_AGENT_LOG_TASKNAME_IN_USERAGENT)
Knob: UseFetchFilterInCheckoutTask = true Source: $(AGENT_USE_FETCH_FILTER_IN_CHECKOUT_TASK)
Knob: Rosetta2Warning = true Source: $(ROSETTA2_WARNING)
Knob: AddForceCredentialsToGitCheckout = True Source: $(DistributedTask.Agent.AddForceCredentialsToGitCheckout)
Finished checking job knob settings.
Start tracking orphan processes.
Finishing: Initialize job

Is it regression?

i don't know

Expected behavior

The Az Modules in c:\modules should be added to the psmodulespath at the machine scope

Actual behavior

The Az Modules in c:\modules are not added to the psmodulespath at the machine scope

Repro steps

Create a build agent image from the the git tag win25/20250303.1
Deploy the image as a vm
try and access the Az modules natively in powershell

@ChrisGibson1982
Copy link
Author

Also the tests don't cover checking if this path gets added to $env:psmodulepath succcesfully

@ChrisGibson1982
Copy link
Author

Actually looking at this, it only adds it to the path if it has something specified "default" in the toolset json. So how do these get added to the path? 🤷‍♂️ I can't see any files that reference "C:\Modules" that are not related to either saving the Az module to this folder or testing that they are there.

@RaviAkshintala
Copy link
Contributor

Hi @ChrisGibson1982 Thank you for bringing this issue to our attention. We will look into this issue and will update you after investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants