Search code examples
azurepowershell-cmdletazure-automation

Scheduled workbook does not recognize my cmdlet method


I imported a cmdlet module into my automation account. Everything is ok and the methods have been imported normally. In the test panel of my WorkBook everything runs normally and my cmdlet is recognized. On the other hand, when the workbook goes through a schedule, the execution throws the error ObjectNotFound on my cmdlet method.

Verification tracks:

When I create my schedule before importing the module, the scheduling workbook does not recognize newly imported methods.

After a modification in my workbook I publish the new version the schedules already present on the workbook seem to ignore my modifications.

Following this observation I destroyed and recreated all the schedules of my workbook, but without success.


Solution

  • Starting an Automation job not through a schedule always uses the latest runbook version and modules / module versions in the Automation account. However, Automation jobs started through schedules use the latest runbook version, but do not use the latest modules / module versions imported to the Automation account. Instead, they use the modules / latest module versions that existed in the Automation account at the time of association of the runbook to the schedule.

    To fix the issue you're having, re-associate the runbook with the schedule after you have updated / added any new modules needed to the Automation account.