Azure Automation Account - Source Control sync error

Louis Rice 0 Reputation points
2024-03-28T19:37:13.73+00:00

One of our Automation Accounts in Azure is unable to sync with our Devops source control repository. Upon manually initiating a sync, it "Completes" but has the following error:

System.Management.Automation.CommandNotFoundException: The term 'Get-AutomationVariable' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)

No runbooks from Devops are synced. I have tried deleting the Source Control connection and setting it back up, that did not change anything. I have also verified that the default AZ modules within the Automation Account are up to date.

We have other Automation Accounts that do not have this issue, and can successfully sync with the same Dev Ops repository

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,114 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Martin Therkelsen 1,405 Reputation points MVP
    2024-03-29T09:43:31.96+00:00

    Hi Louis,

    The error you are getting suggests that you are running a script that uses the "Get-AutomationVariable" command. However, if you do this in Azure DevOps, it will fail. Your description makes it a bit difficult to know how to configure the integration, but the error points to a script.