A formatted string in Date-Time in ISO-8601 format without time zone suffix is automatically converted to ISO-8601 format with time zone #15697
Labels
intermediate language
Related to the intermediate language
Needs: Upvote
This issue requires more votes to be considered
Bicep version
0.31.92
Describe the bug
A formatted string in Date-Time in ISO-8601 format without time zone suffix is automatically converted to ISO-8601 format with time zone suffix: dateTimeAdd(dateTime, 'P1D', 'yyyy-MM-ddTHH:mm:ss') is automatically converted to "2024-11-29T21:09:59Z".
The issue is that not all ARM properties take Date-Time in ISO-8601 format with time zone. For example,
Microsoft.AlertsManagement/actionRules has a property called effectiveFrom that requires a Date-Time in ISO-8601 format without timezone suffix. and a property for the time zone itself. The deployment fails if I pass 2024-11-29T21:09:59Z to effectiveFrom.
https://learn.microsoft.com/en-us/azure/templates/microsoft.alertsmanagement/actionrules?pivots=deployment-language-bicep#schedule
To Reproduce
Additional context
In the case of Action Rules, it is fair to require the current UTC time + X Hours/Minutes to suppress Alerts as part of a maintenance. For this reason, the effective start time must be dynamically generated.
Potential Workaround
I was not able to get rid of the Z at the end of the string. I tried many different ways like substring, replace, concat, format, etc... but the bicep engine seems to detect the date format and automatically convert to Date-Time in ISO-8601 format with time zone
The text was updated successfully, but these errors were encountered: