【问题标题】:How to pass input parameters to Start-NewOrchestration powershell command let如何将输入参数传递给 Start-NewOrchestration powershell 命令让
【发布时间】:2022-01-23 14:04:54
【问题描述】:

我的项目工作需要使用持久功能。我们的开发堆栈是powershell,我必须从定时器触发函数中触发编排器函数。为了触发,我发现使用了 Start-NewOrchestration 命令,但我需要将输入传递给它。我无法找到此命令的文档。有人可以帮忙吗?

【问题讨论】:

  • get-help Start-NewOrchestration 有什么有意义的输出吗?
  • 我收到命令未找到错误,请您帮忙
  • 你导入Microsoft.Azure.Functions.PowerShellWorker模块了吗?

标签: azure powershell azure-functions azure-powershell azure-durable-functions


【解决方案1】:

尝试使用以下 PowerShell Cmdlet:

# Client Function - DurableFunctionsTimerTrigger/HttpStart
using namespace System.Net

param($Request, $TriggerMetadata)

$FunctionName = $Request.Params.FunctionName
$InstanceId = Start-NewOrchestration -FunctionName $FunctionName
Write-Host "Started orchestration with ID = '$InstanceId'"

$Response = New-OrchestrationCheckStatusResponse -Request $Request -InstanceId $InstanceId
Push-OutputBinding -Name Response -Value $Response

或者

$OrchestratorInput = @{
    'TriggeringTime' = Set-Date '2021-01-01'
}
$InstanceId = Start-NewOrchestration -FunctionName $FunctionName -InputObject $OrchestratorInput

请参阅Azure Durable Functions with PowerShell 博客和GitHub article 了解更多详细信息。

How to pass a POST parameter to a Durable Function and then pass this param to a Timer Triggered function

【讨论】:

  • 谢谢你得到了预期的结果。为了从上下文中获取协调器的价值,我使用了 $value=ConvertFrom-Json $Context.Input.tostring()
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-03
  • 2010-11-20
  • 2017-10-08
  • 1970-01-01
  • 1970-01-01
  • 2022-01-25
相关资源
最近更新 更多