Forum Discussion
Powershell error related to 'Raw' parameter during Build pipeline execution
hiSatyam569,
1.while running the pipeline check the version of powershell, "Raw" parameter can be used for version3 (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-content?view=powershell-7.4#-raw ).
2.If in case powershell version is older then instead of Raw, you can use join or else update powershell version.
3. In my case what I did is as follows,
i) Instead of writing get content command in file, write a one more mailto:powershell@2 task , type of inline script .
- task: PowerShell@2
inputs:
targetType: 'inline'
script: |
$FilePath = "path to file/jsoncontentfile.json" # Path
$figJson = (Get-Content $FilePath -Raw) | ConvertFrom-Json
name: 'ConvertJSON'
displayName: 'Convert Json '
ii) define the variables in above script from json>can pass variable between tasks in same job>so pass those as arguments for file type mailto:powershell@2 task, as already it is there. and remove the get content code from script.ps1 file.
I hope this is helpful 🙂