Home > Back-end >  "An error occurred while creating the pipeline." when running powershell script in Azure p
"An error occurred while creating the pipeline." when running powershell script in Azure p

Time:10-21

When I run simple powershell with only ls command in it through Azure pipeline self-hosted agent I see error:

An error occurred while creating the pipeline.
  CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
  FullyQualifiedErrorId : RuntimeException

The same script runs fine locally in the same folder on the same machine (when no Azure agent is involved). The pipeline has not been changed in months. The execution policy is set to "Unrestricted". There is no difference whether the agent is run with admin permissions. I checked and the files in the folders of the agent do not look blocked or read-only. We run tests through powershell scripts and they started to fail last week, without any obvious reason. The only thing that I have installed on the same machine, is Visual Studio 2022 Preview 5, but I have restarted the machine immediately after the installation has passed successfully and the next day the tests have passed.

I had a look through similar errors here, in stackoverflow, but they were not useful, including this one PowerShell "an error occurred while creating the pipeline" #Requires -Version 3.0

Do you have an idea what can cause this?

CodePudding user response:

The PowerShell scripts started passing when I changed the Azure Powershell pipeline task version from 1* to 2* (the latest available for our pipelines). I do not know why this fixed the issue, as I think the difference between these 2 version is that version 2* can be executed on agents that have operating system that is not Windows.

  • Related