【发布时间】:2020-02-26 02:03:20
【问题描述】:
我一直在慢慢研究如何使用 LogParser 2.2 调用 PowerShell 脚本来转换 IIS 日志。我已决定使用 Azure 数据工厂批处理服务自定义活动来运行 PowerShell 脚本。我已经能够弄清楚如何解决在 Azure 自定义批处理活动中运行 PowerShell 时出现的许多文件路径问题,但我无法解决这个问题。
目前我只是试图通过 Write-Host 打印环境变量 AZ_BATCH_APP_PACKAGE_powershellscripts#1.0 我已经能够打印其他环境变量,但我相信这个结尾的 #1.0 让我很伤心。顺便说一句,1.0 是加载到 Azure 批处理框架中的应用程序版本。
以下所有尝试均失败:
powershell powershell Write-Host "$AZ_BATCH_APP_PACKAGE_powershellscripts#1.0"
powershell Write-Host "$AZ_BATCH_APP_PACKAGE_powershellscripts#1.0"
powershell Write-Host "$env:AZ_BATCH_APP_PACKAGE_powershellscripts#1.0"
powershell powershell Write-Host "$env:AZ_BATCH_APP_PACKAGE_powershellscripts\#1.0"
powershell powershell Write-Host "$env:AZ_BATCH_APP_PACKAGE_powershellscripts/#1.0"
powershell powershell Write-Host "$env:AZ_BATCH_APP_PACKAGE_powershellscripts"
powershell powershell Write-Host "$env:AZ_BATCH_APP_PACKAGE_powershellscripts`#1.0"
powershell powershell Write-Host "$env:AZ_BATCH_APP_PACKAGE_powershellscripts`#1`.0"
powershell powershell Write-Host "$env:AZ_BATCH_APP_PACKAGE_powershellscripts\`#1.0"
powershell powershell Write-Host "$AZ_BATCH_APP_PACKAGE_powershellscripts`#1.0"
这些有效,但要么是 cmd 窗口,要么不是我想要的变量:
powershell powershell Write-Host "$env:AZ_BATCH_TASK_DIR"
powershell powershell Write-Host "$env:AZ_BATCH_ACCOUNT_URL"
cmd /c echo %AZ_BATCH_APP_PACKAGE_powershellscripts#1.0%
那么,让它在 Azure 中运行的秘密语法糖是什么?
【问题讨论】:
-
好头韵:)
-
我必须玩得开心,否则我会因为所有失败的尝试而发疯!很高兴有人欣赏我的文字。
标签: azure powershell azure-data-factory-2