I am creating a Powershell workflow in Azure Automation.
When setting DateTime type Set-AutomationVariable with function,
Recognized as a string. Please let me know if you know how to solve it.
workflow variabletest{
function Test-DateTime {
$Now = Get-Date
Set-AutomationVariable -Name 'VariableDateTime' -Value ($Now)
}
Test-DateTime
}
After execution, the value of the 'VariableDateTime' confirmed from the Azure portal is as follows:
Name: VariableDateTime
Type: String
Value: 2019-12-12T06:35:23.208367+00:00
If there is Set-AutomationVariable outside the function, it has been confirmed that it becomes DateTime type.
Thank you.
I can reproduce your issue, seems that it is by design of
Get-Datecommand.See the Outputs:
Functions that need to be aware of the pipeline must be built with pipeline support.