Azure 如何使RunBook识别日期时间类型?

Azure 如何使RunBook识别日期时间类型?,azure,powershell,azure-automation,azure-runbook,powershell-workflow,Azure,Powershell,Azure Automation,Azure Runbook,Powershell Workflow,我正在Azure Automation中创建Powershell工作流。 使用函数设置日期时间类型Set AutomationVariable时, 被识别为字符串的。如果你知道怎么解决,请告诉我 workflow variabletest{ function Test-DateTime { $Now = Get-Date Set-AutomationVariable -Name 'VariableDateTime' -Value ($Now) }

我正在Azure Automation中创建Powershell工作流。 使用函数设置日期时间类型
Set AutomationVariable
时, 被识别为字符串的。如果你知道怎么解决,请告诉我

workflow variabletest{

     function Test-DateTime {
        $Now = Get-Date
       Set-AutomationVariable -Name 'VariableDateTime' -Value ($Now)
    }

     Test-DateTime

}
执行后,从Azure门户确认的
'VariableDateTime'
的值如下:

Name: VariableDateTime
Type: String
Value: 2019-12-12T06:35:23.208367+00:00
如果函数外有
Set AutomationVariable
,则已确认该变量为DateTime类型


谢谢。

我可以复制您的问题,似乎是通过命令设计的

见:

当DateTime对象通过管道发送到cmdlet(如添加需要字符串输入的内容)时,PowerShell会将该对象转换为字符串对象

需要了解管道的功能必须使用管道支持构建