Open bramvanhautte opened 1 year ago
Hi,
What happens if you install the Arcus powershell module like this:
PS> Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
PS> Install-Module -Name Arcus.Scripting.LogicApps -AllowClobber
as described in the docs ?
If the above doesn't bring a soltution, you can install the previous version of Arcus.Scripting as a temporary workaround,in your pipeline. (If you don't specify a version number, the latest version will be installed.
Install-Module Arcus.Scripting.LogicApps -MaximumVersion v0.8.0
oth, latest version of Arcus.Scripting has been released 2 weeks ago. How often do you run the pipeline ? Have you run your pipeline in the past 2 weeks without issues ?
I can indeed replicate the issue when using Install-Module -Name Arcus.Scripting.LogicApps -Scope CurrentUser -Force
.
The suggestion from @fgheysels solves the error (at least in my test 😉), if you use this to install the module then the pipeline should work correctly:
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name Arcus.Scripting.LogicApps -AllowClobber
@bramvanhautte can you validate if this indeed works for you?
Hi @fgheysels @pim-simons, thanks for the fast replies.
When using the below I did get it to work but only when using the AzurePowershell@5 YAML step to Install them.
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module -Name Arcus.Scripting.LogicApps -AllowClobber
When I use normal powershell YAML to install the modules, and then switch to AzurePowerShell@5 for another task, it fails with the same error. When I use normal powershell YAML to install the modules, and then use the same normal powershell to do a dummy 'Write-Output' it still works. But my guess is that this is because normal powershell YAML does not load up Az.Accounts before executing any commands given by the user.
For the question when this started happening: the pipeline worked fine on 22/05 and stopped working on 23/05. I will be using only AzurePowershell@5 in my specific situation, but it still looks odd to me it suddenly stopped working but since Arcus had an update 2 weeks ago already I think it might not an issue invoked by Arcus.
Thank you!
Can you re-produce the issue when you install the previous version of Arcus.Scripting instead ?
When installing the version 0.8.0 it's giving me the same issues:
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted Install-Module Arcus.Scripting.LogicApps -MaximumVersion 0.8.0 -AllowClobber
And after that, when using AzurePowershell@5 I get that same error:
From the moment I install Arcus.Scripting.{module} and I then use any AzurePowershell@5 task it wants to install the Az.Accounts module at the 2.12.3 folder path for some reason but we already have a version installed at the 2.12.2 path.
Does Arcus install automatically installs/loads Az.Accounts?
I searched through the entire codebase, the only reference I can find to Az.Accounts
is in one of the test files here.
Can we reproduce this on other devops agents (linux for instance, or what if we do not use windows-latest but specify an actual version-nr instead )?
I will do some testing on the above. Update following soon.
@bramvanhautte , any update on this?
Describe the bug Since 23/05/2023 I am facing issues after importing the Arcus.Scripting.LogicApps powershell module. From the moment I import the module, no Powershell task is still working.
I am using a Hosted agent running on windows-latest and using the powershell@5 task in my YAML file.
To Reproduce Steps to reproduce the behavior: Take a DevOps Hosted agent running on windows-latest, use a powershell task to Import Arcus.Scripting.LogicApps and after that try to run a Powershell@5 task.
Expected behavior Being able to run powershell scripts after Arcus.Scripting.LogicApps import
Additional context Let me show you what happens and what I have spotted being an issue. I know that I have AzureRM and Az warnings but I am currently only using Az in this pipeline.
1) First off, I run a Powershell@5 task which outputs the value '1' for testing purposes. This works fine. Note that the Import-Module for Az.Accounts is automatically called and using folder path 2.12.2:
- task: AzurePowerShell@5 displayName: 'Powershell task before arcus import' inputs: azureSubscription: ${{ parameters.AzureSubscription }} ScriptType: 'InlineScript' Inline: 'Write-Output 1' azurePowerShellVersion: 'LatestVersion' pwsh: true enabled: true
2) Then, I import the Arcus.Scripting.LogicApps module, which is successful:
- pwsh: Install-Module -Name Arcus.Scripting.LogicApps -Scope CurrentUser -Force displayName: 'Installing Arcus.Scripting.LogicApps Powershell module' enabled: true
3) After this, I try to run a Powershell@5 again but without success. Note how it now tries to import the Az.Accounts module from another path: 2.12.3:
- task: AzurePowerShell@5 displayName: 'Powershell task after arcus import' inputs: azureSubscription: ${{ parameters.AzureSubscription }} ScriptType: 'InlineScript' Inline: 'Write-Output 1' azurePowerShellVersion: 'LatestVersion' pwsh: true enabled: true
After the Arcus.Scripting.LogicApps import the Powershell@5 task tries to load a different Az.Account version which then conflicts with the current version it looks like.