-
Notifications
You must be signed in to change notification settings - Fork 96
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
Install-PSResource fails on fresh VM: Value cannot be null. (Parameter 'path1')
#1527
Comments
This seems to be triggered by the absence of the When I SSH to the VM (after provisioning is done), then temporarily unset the pwsh -c 'Remove-Item Env:\HOME; gci env:; Install-PSResource -Name "Az.Accounts" -ErrorAction Stop -Verbose; Get-Error'
When I leave the pwsh -c 'gci env:; Install-PSResource -Name "Az.Accounts" -ErrorAction Stop -Verbose; Get-Error'
Looking at the source code (Utils.cs#L986), there seems to be some variable shadowing going on. Note that
Presumably this is the cause of the |
Presumably introduced in #1464. |
@odegroot you're correct. I was able to repro your issue on my MacOS and after removing the second declaration of I'll get a PR for that out shortly and we should have this out with our release next week. |
Prerequisites
Steps to reproduce
I have an Azure Virtual Machine Scale Set (VMSS) that provides my Azure DevOps (ADO) build agents. I use the Custom Script Extension for Linux to run a script that installs dependencies on new VM instances. One of the steps in this script is using
Install-PSResource
to install some PowerShell modules. This step fails with a weird error message.Install-PSResource
.Can you change
Install-PSResource
such that it can deal with this situation, or that it gives an error message that makes clear what it needs from the runtime environment?Expected behavior
Install-PSResource
installs the requested module without errors.-or-
Install-PSResource
fails with a helpful error message.Actual behavior
Install-PSResource
fails with the following error.Note that
path1
does not refer to any inputs forInstall-PSResource
, so it's not clear what is missing here.After this, when I SSH to the VM instance and retry the exact same
Install-PSResource
command, it installs the module just fine.It seems that when the post-deployment-script runs, the VM is not quite yet in a state that
Install-PSResource
expects.Error details
Get-Error
:Environment data
Get-Module Microsoft.PowerShell.PSResourceGet
:$PSVersionTable
:gci env:
:Visuals
No response
The text was updated successfully, but these errors were encountered: