如何向PowerShell脚本提供azure devops git存储库中保存的JSON文件的文件路径。未找到文件获取异常

如何向PowerShell脚本提供azure devops git存储库中保存的JSON文件的文件路径。未找到文件获取异常,powershell,azure-devops,arm-template,Powershell,Azure Devops,Arm Template,我正在尝试通过azure发布管道运行此PowerShell脚本。 Azure提供json文件和PowerShell脚本来部署数据工厂的链接服务或数据集。但json文件的路径假定为本地计算机路径。但是,在通过azure Devops发布管道执行相同操作时,如何在PowerShell脚本中提供json文件路径并执行Devops发布管道 Powershell脚本- Set-AzDataFactoryV2LinkedService-DataFactoryName“DemoADF”-ResourceGro

我正在尝试通过azure发布管道运行此PowerShell脚本。 Azure提供json文件和PowerShell脚本来部署数据工厂的链接服务或数据集。但json文件的路径假定为本地计算机路径。但是,在通过azure Devops发布管道执行相同操作时,如何在PowerShell脚本中提供json文件路径并执行Devops发布管道

Powershell脚本-

Set-AzDataFactoryV2LinkedService-DataFactoryName“DemoADF”
-ResourceGroupName“DemoRG”-Name“AzureStorageLinkedService”
-定义文件“/LinkedService.json”

LinkedService.json文件-

{ “名称”:“AzureStorageLinkedService”, “财产”:{ “类型”:“AzureStorage”, “类型属性”:{ “connectionString”:“connectionString详细信息” }, “connectVia”:{ “referenceName”:“AutoResolveIntegrationRuntime”, “类型”:“IntegrationRuntimeReference” } } }

已尝试使用-$env:(System.DefaultWorkingDirectory)/LinkedService.json,但未工作

Azure DevOps发布管道错误-

2020-07-28T04:23:31.1358415Z ##[debug]Error record:
2020-07-28T04:23:31.2243264Z ##[debug]Set-AzDataFactoryV2LinkedService : ./LinkedService.json
2020-07-28T04:23:31.2263866Z ##[debug]At D:\a\r1\a\LS_adf\ykfactory\AllADFDeploymentTasks\LinkedService.ps1:1 char:1
2020-07-28T04:23:31.2280510Z ##[debug]+ Set-AzDataFactoryV2LinkedService -DataFactoryName "DataFlowADFVNet" `
2020-07-28T04:23:31.2312596Z ##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-07-28T04:23:31.2342558Z ##[debug]    + CategoryInfo          : CloseError: (:) [Set-AzDataFactoryV2LinkedService], FileNotFoundException
2020-07-28T04:23:31.2361626Z ##[debug]    + FullyQualifiedErrorId : Microsoft.Azure.Commands.DataFactoryV2.SetAzureDataFactoryLinkedServiceCommand
2020-07-28T04:23:31.2379154Z ##[debug] 
2020-07-28T04:23:31.2415190Z ##[debug]Script stack trace:
2020-07-28T04:23:31.2479403Z ##[debug]at <ScriptBlock>, D:\a\r1\a\LS_adf\ykfactory\AllADFDeploymentTasks\LinkedService.ps1: line 1
2020-07-28T04:23:31.2532900Z ##[debug]at <ScriptBlock>, D:\a\_temp\a652e51d-54ce-438d-b59a-d8b118516fe9.ps1: line 41
2020-07-28T04:23:31.2553826Z ##[debug]at <ScriptBlock>, <No file>: line 1
2020-07-28T04:23:31.2594489Z ##[debug]Exception:
**2020-07-28T04:23:31.2681432Z ##[debug]S*ystem.IO.**FileNotFoundException**: ./LinkedService.json***
2020-07-28T04:23:31.2716695Z ##[debug]   at Microsoft.Azure.Commands.DataFactoryV2.DataFactoryClient.ReadJsonFileContent(String path)
2020-07-28T04:23:31.2740090Z ##[debug]   at Microsoft.Azure.Commands.DataFactoryV2.SetAzureDataFactoryLinkedServiceCommand.ExecuteCmdlet()
2020-07-28T04:23:31.2760357Z ##[debug]   at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()
2020-07-28T04:23:31.3196351Z ##[error]./LinkedService.json
2020-07-28T04:23:31.3212488Z ##[debug]Processed: ##vso[task.logissue type=error]./LinkedService.json
2020-07-28T04:23:32.1091196Z ##[debug]Exit code: 1
2020-07-28T04:23:32.1091982Z ##[debug]Leaving Invoke-VstsTool.
2020-07-28T04:23:32.1093065Z ##[error]PowerShell exited with code '1'.
2020-07-28T04:23:32.1094438Z ##[debug]Processed: ##vso[task.logissue type=error]PowerShell exited with code '1'.
2020-07-28T04:23:32.1106224Z ##[debug]Processed: ##vso[task.complete result=Failed]Error detected
2020-07-28T04:23:32.1107726Z ##[debug]Loading module from path 'D:\a\_tasks\AzurePowerShell_72a1931b-effb-4d2e-8fd8-f8472a07cb62\5.173.0\ps_modules\VstsAzureHelpers_\VstsAzureHelpers_.psm1'.
2020-07-28T04:23:32.1108852Z ##[debug]$OVER[enter image description here][1]
2020-07-28T04:23:31.1358415Z##[debug]错误记录:
2020-07-28T04:23:31.2243264Z##[debug]Set-AzDataFactoryV2LinkedService:./LinkedService.json
2020-07-28T04:23:31.2263866Z##[debug]位于D:\a\r1\a\LS\u adf\ykfactory\AlladDeploymentTasks\LinkedService.ps1:1字符:1
2020-07-28T04:23:31.2280510Z##[debug]+Set-AzDataFactoryV2LinkedService-DataFactoryName“DataFlowADFVNet”`
2020-07-28T04:23:31.2312596Z##[调试]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-07-28T04:23:31.2342558Z###[调试]+类别信息:CloseError:(:)[Set-AzDataFactoryV2LinkedService],FileNotFoundException
2020-07-28T04:23:31.2361626Z##[debug]+完全合格的derroid:Microsoft.Azure.Commands.DataFactoryV2.setazuredatafactorylinkedservicecondrom
2020-07-28T04:23:31.2379154Z[调试]
2020-07-28T04:23:31.2415190Z##[调试]脚本堆栈跟踪:
2020-07-28T04:23:31.2479403Z###[调试]地址:D:\a\r1\a\LS\u adf\ykfactory\AlladDeploymentTasks\LinkedService.ps1:第1行
2020-07-28T04:23:31.2532900Z##[调试]地址:D:\a\\U temp\a652e51d-54ce-438d-b59a-d8b118516fe9.ps1:第41行
2020-07-28T04:23:31.2553826Z##[调试]在:第1行
2020-07-28T04:23:31.2594489Z###[调试]异常:
**2020-07-28T04:23:31.2681432Z##[debug]S*system.IO.*FileNotFoundException**:./LinkedService.json***
2020-07-28T04:23:31.2716695Z##[debug]位于Microsoft.Azure.Commands.DataFactoryV2.DataFactoryClient.ReadJsonFileContent(字符串路径)
2020-07-28T04:23:31.2740090Z###[调试]在Microsoft.Azure.Commands.DataFactoryV2.SetAzureDataFactoryLinkedServiceCommand.ExecuteCmdlet()上
2020-07-28T04:23:31.2760357Z##[debug]位于Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()上
2020-07-28T04:23:31.3196351Z##[错误]./LinkedService.json
2020-07-28T04:23:31.3212488Z###[调试]已处理:##vso[task.logissue type=error]./LinkedService.json
2020-07-28T04:23:32.1091196Z##[debug]退出代码:1
2020-07-28T04:23:32.1091982Z##[debug]离开调用VstsTool。
2020-07-28T04:23:32.1093065Z###[错误]PowerShell已退出,代码为“1”。
2020-07-28T04:23:32.1094438Z###[调试]已处理:##vso[task.logissue type=error]PowerShell已退出,代码为“1”。
2020-07-28T04:23:32.1106224Z###[调试]已处理:##vso[task.complete result=Failed]检测到错误
2020-07-28T04:23:32.1107726Z##[debug]从路径“D:\a\_tasks\AzurePowerShell\U 72a1931b-effb-4d2e-8fd8-f8472a07cb62\5.173.0\ps_modules\VstsAzureHelpers\VstsAzureHelpers\uzurehelpers.psm1”加载模块。
2020-07-28T04:23:32.1108852Z##[debug]$OVER[在此处输入图像描述][1]
最新错误- 2020-07-28T14:12:59.1777082Z##[debug]错误记录: 2020-07-28814:12:59.2606789Z##[debug]Set-AzDataFactoryV2LinkedService:D:\a\r1\a\LinkedService.json 2020-07-28014:12:59.2614645Z##[debug]位于D:\a\r1\a\LS\u adf\ykfactory\AlladDeploymentTasks\LinkedService.ps1:7字符:1 2020-07-28T14:12:59.2641183Z##[debug]+Set-AzDataFactoryV2LinkedService-DataFactoryName“DataFlowADFVNet”` 2020-07-28814:12:59.2665039Z###[调试]+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2020-07-28814:12:59.2686771Z##[debug]+类别信息:CloseError:(:)[Set-AzDataFactoryV2LinkedService],FileNotFoundException 2020-07-28814:12:59.2731339Z###[调试]+完全合格的derroid:Microsoft.Azure.Commands.DataFactoryV2.setazuredatafactorylinkedservicecondrom 2020-07-28814:12:59.2746815Z###[调试] 2020-07-28814:12:59.2791357Z##[调试]脚本堆栈跟踪: 2020-07-28814:12:59.2841187Z##[debug]在,D:\a\r1\a\LS\u adf\ykfactory\AlladDeploymentTasks\LinkedService.ps1:第7行 2020-07-28814:12:59.2894685Z##[调试]地址:D:\a_temp\773f2897-4445-4797-b8c4-62e1fbc3c46a.ps1:第41行 2020-07-28814:12:59.2915479Z###[debug]at,:第1行 2020-07-28T14:12:59.2931046Z##[debug]异常: 2020-07-28814:12:59.3013273Z##[debug]System.IO.FileNotFoundException:D:\a\r1\a\LinkedService.json 2020-07-28814:12:59.3039882Z##[debug]位于Microsoft.Azure.Commands.DataFactoryV2.DataFactoryClient.ReadJsonFileContent(字符串路径) 2020-07-28814:12:59.3062765Z##[debug]在Microsoft.Azure.Commands.DataFactoryV2.SetAzureDataFactoryLinkedServiceCommand.ExecuteCmdlet()上 2020-07-28814:12:59.3082130Z##[debug]位于Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord()上 2020-07-28T14:12:59.3469116Z##[错误]D:\a\r1\a\LinkedService.json 2020-07-28T14:12:59.3489081Z###[debug]已处理:##vso[task.logissue type=error]D:\a\r1\a\LinkedService.json 2020-07-28814:12:59.4029653Z##[debug]退出代码:1 2020-07-28T14:12:59.4104968Z##[debug]离开调用VstsTool。 2020-07-28814:12:59.4476571Z###[错误]PowerShell已退出,代码为“1”。 2020-07-28814:12:59.4477979Z###[debug]已处理:##vso[task.logissue type=error]PowerShell已退出,代码为“1”。 2020-07-28014:12:59.4575374Z###[调试]已处理:###vso[task.complete result=Failed]检测到错误 2020-
-pass $(System.DefaultWorkingDirectory)
Param(
 [String]$pass
)

Write-Host "$pass"