我在 Azure 数据工厂中有一个自定义活动,它尝试执行以下命令:
PowerShell.exe -Command "Write-Host 'Hello, world!'"
但是,当我从 Azure 数据工厂中调试(运行)此命令时,它运行了很长时间,最后失败了。
我猜它失败了,因为它可能找不到“PowerShell.exe”。如何确保 ADF 自定义活动可以访问 PowerShell.exe?
一些网站说要指定一个包(.zip 文件),其中包含执行 exe 所需的所有内容。但是,由于 PowerShell 来自 Microsoft,我认为压缩 PowerShell 目录并将其指定为自定义活动的包是不合适的。
请建议我如何从 Azure 数据工厂的自定义活动中执行 PowerShell 命令。谢谢!
每当我搜索“从 Azure 数据工厂中的自定义活动执行 PowerShell”时,搜索结果都会更多地讨论用于触发启动 ADF 管道的 Az PowerShell 命令。
我在 Stackoverflow.com 中看到了两个线程,其中答案只是指定使用自定义活动,而答案并不特定于来自 ADF 的 PowerShell 命令调用
这是该任务的 JSON:
{
"name": "ExecutePs1CustomActivity",
"properties": {
"activities": [
{
"name": "ExecutePSScriptCustomActivity",
"type": "Custom",
"dependsOn": [],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"command": "PowerShell.exe -Command \"Write-Host 'Hello, world!'\"",
"referenceObjects": {
"linkedServices": [],
"datasets": []
}
},
"linkedServiceName": {
"referenceName": "Ps1CustomActivityAzureBatch",
"type": "LinkedServiceReference"
}
}
],
"annotations": []
}
}
我看到“进行中”3 分钟(180 秒),然后显示为“失败”。