Automation Account Job Schedules Suck - Or Do They?
It has become one of the staples, and frustration, in Azure ARM that you cannot reliably deploy an Automation Account, Runbook, Schedule and JobSchedule. Well to be fair you could deploy once but when it came to deploying a second time everything broke. You ended up either deploying the jobSchedule via PowerShell (or the cli) or doing pre-processing to remove the JobSchedule before you deployed the template again, neither of which was very satisfactory.
So I decided I would revisit the topic, with the idea that I could write a very generic deploymentScript to perform the pre processing and in this way have everything contained within the script. Yes I know we would have to create a UserAssignedIdentity and custom RBAC which greatly adds to the complexity but in my mind it would of been worth it. Boy was I surprised.
TLDR see https://github.com/drewkg/Azure/blob/main/ARM/Resource/AutomationAccountJobSchedule/azureDeploy.json
So I started out with a basic ARM template that could deploy all the components, remember I like to run ARM deployments in complete mode. Was I in for a surprise, after updating all the relevant API versions and ironing out the kinks I ran the deployment twice. Not because I intended to, but because I had run it once went to play with the dogs and forgot and then ran it again. There was the surprise the ARM template deployed a second time, strange I thought this this does not work.
I have basically spent a week working out that yes, with the latest API's this works, there are limitations but there are always limitations in ARM.
Posted By Keith Drew on 01/08/2021