An Azure service that provides an event-driven serverless compute platform.
Hi @Madhu Rao ,
Initially I have environment variable as below:
Then used blow code that works:
using namespace System.Net
param($Request, $TriggerMetadata)
Write-Host "Hello Rithwik"
$cldopsemailqrystrtdays = $env:cldopsemailqrystrtdays -as [int]
$endtime = (Get-Date).Date
$starttime = $endtime.AddDays($cldopsemailqrystrtdays)
Write-Host "Rithwik, the Start Time is $starttime"
Write-Host "Rithwik, the End Time is $endtime"
$rithout = @{
startTime = $starttime.ToString("yyyy-MM-ddTHH:mm:ssZ")
endTime = $endtime.ToString("yyyy-MM-ddTHH:mm:ssZ")
}
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
StatusCode = [HttpStatusCode]::OK
Body = $rithout | ConvertTo-Json -Depth 3
})
Output:
You can also use below code, which gives expected results:
$cldopsemailqrystrtdaysRaw = $env:cldopsemailqrystrtdays
$cldopsemailqrystrtdays = [int]$cldopsemailqrystrtdaysRaw
If this answer was helpful, please click "Accept the answer" and mark Yes, as this can help other community members.

If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.