0

I am new to powershell. I want to deploy CI/CD pipelines in Azure DevOps for Azure Data Factory. I am following this pre and post deployment powershell script documentation. The pre deployment stop trigger runs smoothly, however, I am facing error in the post deployment restart trigger part. I am getting this error

2022-10-20T12:13:56.6253765Z ConvertFrom-Json : A parameter cannot be found that matches parameter name 'Depth'.
2022-10-20T12:13:56.6255217Z At D:\a\r1\a\_masterBranch_source\triggerRestarter.ps1:659 char:26
2022-10-20T12:13:56.6256045Z +     } | ConvertFrom-Json -Depth 10
2022-10-20T12:13:56.6257011Z +                          ~~~~~~
2022-10-20T12:13:56.6257821Z     + CategoryInfo          : InvalidArgument: (:) [ConvertFrom-Json], ParameterBindingException
2022-10-20T12:13:56.6258767Z     + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.ConvertFromJsonCommand

This is my powershell script.

  • The linked duplicate explains the problem in detail, but in short: [`ConvertFrom-Json`](https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertfrom-json) (as opposed to `Convert-ToJson`) only has a `-Depth` parameter in _PowerShell (Core) 7+_, not in _Windows PowerShell_ (versions up to v5.1). Fortunately, use of `-Depth` with `ConvertFrom-Json` is rarely needed (as opposed to with `ConvertTo-Json`, where it is frequently needed). – mklement0 Oct 20 '22 at 14:27
  • If I can't update my PowerShell version, and want to update the script instead, how can I do that? Removing -Depth parameter from line 659 in [this](https://github.com/Azure/Azure-DataFactory/blob/main/SamplesV2/ContinuousIntegrationAndDelivery/PrePostDeploymentScript.Ver2.ps1) script is not fixing the issue – Pragya Agrawal Oct 22 '22 at 09:58
  • There's another `ConvertFrom-Json -Depth 10` call on line 189 – mklement0 Oct 22 '22 at 14:02

0 Answers0