Creating ActionRule from an ARM template results date format error for effectiveFrom field

KaziNad 51 Reputation points
2022-03-08T15:36:52.337+00:00

This is the excerpt from my ARM template I try to deploy, but getting the following error:

Status Message: Invalid input parameters: Wrong DateTime format of the parameter: 'effectiveFrom', with value: '2022-03-08T00:00:00Z'. Expected date time format is 'yyyy'-'MM'-'dd'T'HH':'mm':'ss'

{
  "name": "ActionRuleExample",
  "type": "Microsoft.AlertsManagement/actionRules",
  "apiVersion": "2021-08-08",
  "location": "global",
  "properties": {
    "scopes": [
      "[concat('/subscriptions/', subscription().subscriptionId)]"
    ],
    "schedule": {
      "effectiveFrom": "2022-03-08T00:00:00",
      "timeZone": "Central Europe Standard Time",
      "recurrences": [
        {
          "recurrenceType": "Daily",
          "startTime": "03:00:00",
          "endTime": "04:00:00"
        }
      ]
    },
    "conditions": [
      {
        "field": "AlertRuleName",
        "operator": "Equals",
        "values": [
          "AlertRuleExample"
        ]
      }
    ],
    "enabled": true,
    "actions": [
      {
        "actionType": "RemoveAllActionGroups"
      }
    ]
  }
}

It seems to me a product bug, because I definitely use the correct datettime format without timezone offset, but something adds it to the end of the datetime value which can be observed in the error message. If you have a workaround, please let me know. Thanks

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,863 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alistair Ross 7,101 Reputation points Microsoft Employee
    2022-03-08T22:12:24.24+00:00

    Hi @KaziNad

    I've just deployed your action rule via the portal with no problem at all, deployed first time. I've analysed the HAR file when submitting this and I cannot see any issue

    HOWEVER, you are correct that the time zone is appended to the effectiveFrom field as I can clearly see it in when running this via PowerShell. I have raised this internally, but as a temporary workaround, the portal will allow you to deploy these templates.

    kind regards

    1 person found this answer helpful.