Runbook can't call another runbook in the same automation account?

AJ Randazzo 20 Reputation points
2025-09-30T14:15:37.99+00:00

The runbook fails with the message "Both Az and AzureRM modules were detected on this machine..." and the following exception message is output "Failed to start runbook: Method 'get_SerializationSettings' in type 'Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient' from assembly 'Microsoft.Azure.PowerShell.Clients.ResourceManager, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation."

I've taken several looks through the entire automation account and no runbook imports AzureRM modules. Every runbook uses Powershell 5.1. I get the same error messages using both inline execution and "Start-AzAutomationRunbook" cmdlets. The only workaround I have is to start the next runbook with an HTTP POST web request. Any input is much appreciated.

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
{count} votes

Answer accepted by question author
  1. Alex Burlachenko 18,310 Reputation points Volunteer Moderator
    2025-09-30T14:56:54.6033333+00:00

    AJ Randazzo hi,

    the error happens because the automation service has some legacy azurerm components preloaded in the background. when your runbook uses a cmdlet from the newer az module, it tries to load both, and they fight over the same namespaces, causing that 'does not have an implementation' crash.

    here is what you can try to fix it.

    first, check the 'modules' gallery in your automation account. sometimes an old 'azurerm' module is listed there, even if you did not put it there. if you see any module starting with 'azurerm', delete it. only the 'az' modules should be present.

    next, in your parent runbook, try forcing the use of the az context at the very beginning. add these lines before you call start-azautomationrunbook.

    disable-azcontextautosave -scope process connect-azaccount -identity

    this tells the runbook to use the managed identity and not rely on any cached credentials that might be tied to the old modules.

    if that does not work, the most reliable solution is to use a webhook. you are already using an http post as a workaround, and that is actually a very solid pattern. it completely avoids the module conflict by starting the child runbook in a fresh, isolated sandbox. you can create a webhook for the child runbook and then have the parent runbook invoke it with invoke-restmethod. it is a bit more setup, but it is guaranteed to work.

    this kind of module conflict is not unique to azure automation. it can happen in any powershell environment where multiple versions of the same sdk are present. the webhook method is a clean way to enforce separation.

    try removing any old azurerm modules and forcing the az context. if the conflict persists, embrace the webhook method. it is a more robust long term solution anyway.

    good luck, my friend. i hope this clears up the module conflict for you.

    rgds,

    Alex

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.