How can we improve Azure Pack?

SMA Runbook concurrency

The ability to set concurrency limits for individual runbooks would very useful (like Orchestrator).

Example use/case: Querying AD for the next free SamAccountName and creating an AD user. If two runbooks which would result in the same SamAccountName being provided are started at the same time one of them will fail. A maximum concurrency of 1 would solve this.

I've tried solving this with code in various ways, but have found no reliable way.

41 votes
Sign in
Sign in with: Microsoft
Signed in as (Sign out)
You have left! (?) (thinking…)
Tor Magnus Rakvåg shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →
under review  ·  Beth Cooper responded  · 

Thanks for the feedback on this. We can investigate adding this functionality.


Sign in
Sign in with: Microsoft
Signed in as (Sign out)
  • Anonymous commented  ·   ·  Flag as inappropriate

    I will second this. I have a runbook that is kicked off by a SQL trigger. It would be great to limit the amount of runbooks running....

  • Tor Magnus Rakvåg commented  ·   ·  Flag as inappropriate

    Thank you. That's a more reliable solution than others I've tried, but I still encounter occasional conflicts, especially when there are 15+ instances that start at about the same time (there's a semi-random sleep interval between checks of the variable, but as the number of instances increases the likelihood that two or more of them check at the same time and increment the variable).

    I'll see what I can do to make it more reliable, but I really hope this suggestion gets implemented.

  • AdminBeth Cooper (Admin, Microsoft Azure) commented  ·   ·  Flag as inappropriate

    Just wanted to add onto this. You can use an Automation variable to keep track of a runbook job count. Note that we still don't have a construct specifically for synchronization and this suggestion will be left open for our team to do further investigation.

    The following command is atomic and the results are always predictable, regardless of the order calls are made:
    Set-AutomationVariable –Name MyVariable –Increment 1
    Set-AutomationVariable –Name MyVariable –Decrement 1

Feedback and Knowledge Base