如何在 Azure Runbook 工作流中获取时间戳
How to get timestamp in Azure runbook workflow
我在写入输出行时试图获取时间戳。我尝试了几件事,并以:
结尾
filter timestamp {"$(Get-Date -Format G): $_"}
Write-Output "JOB START BEFORE INLINESCRIPT" | timestamp
但这给了我错误:
The 'timestamp' activity is not supported in a workflow pipeline
执行此操作的正确方法是什么?
您应该将代码放在 InlineScript 块中,如下所示:
workflow MyFirstRunbook-Workflow
{
INLINESCRIPT{
write-output "hello world"
filter timestamp {"$(Get-Date -Format G): $_"}
write-output "JOB START BEFORE INLINESCRIPT" | timestamp
}
}
测试结果:
我在写入输出行时试图获取时间戳。我尝试了几件事,并以:
结尾filter timestamp {"$(Get-Date -Format G): $_"}
Write-Output "JOB START BEFORE INLINESCRIPT" | timestamp
但这给了我错误:
The 'timestamp' activity is not supported in a workflow pipeline
执行此操作的正确方法是什么?
您应该将代码放在 InlineScript 块中,如下所示:
workflow MyFirstRunbook-Workflow
{
INLINESCRIPT{
write-output "hello world"
filter timestamp {"$(Get-Date -Format G): $_"}
write-output "JOB START BEFORE INLINESCRIPT" | timestamp
}
}
测试结果: