Automation account runbook PS runtime 7.4 - hybrid worker not working

Charles Thivierge 4,176 Reputation points
2025-08-04T19:05:20.5+00:00

Hello!

I have an Automation Account and i have created a PS 7.4 runtime environment.

I have added the package i'm using, Pnp.Powershell and a custom package.

When i try to run the runbook using Azure, it works, but when i try to run using an Hybrid Worker, the job stay in "Queued" for several minutes then it get "Suspended"

In the event log (Microsoft-SMA) of the HW VM, i get the following event

Event ID 7001 - SandboxEncounteredException

[jobAction=Activate] [exceptionMessage=System.InvalidOperationException: Runbook type 'PowerShellV2' not supported.

What could cause this issue ?

The hybrid worker is a Windows Server 2019 with Powershell 7.5.2 installed with all required az modules as well as the custom.

Any hints ?

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

4 answers

Sort by: Most helpful
  1. Charles Thivierge 4,176 Reputation points
    2025-08-06T20:21:41.55+00:00

    Ok... i was able to get this working...

    Here's what i've done...

    1. I have created and published another runbook using the default PS 7.2 runtime environment.
    2. I have upgraded the runtime of my runbook to my "custom PS 7.4" runtime environment
    3. On the hybrid worker, i have added the environment variable "POWERSHELL_7_4_PATH" with the value "C:\Program Files\PowerShell\7"

    This worked.

    What i have also found is that Automation Account does not Support PS 7.4 so far. So if you create a runbook using a custom PS 7.4 runtime environment and then you switch to the "old experience", if you look in the runbooks, you will notice that the runbook you have created will be in runtime 5.1.

    Thanks all

    hth

    1 person found this answer helpful.

  2. Jose Benjamin Solis Nolasco 4,906 Reputation points
    2025-08-04T20:33:18.57+00:00

    @Charles Thivierge I hope you are doing well,

    You're trying to run a PowerShell 7.4 (PowerShell V2 runtime) runbook on a Hybrid Worker, but classic Hybrid Workers currently do not support the PowerShell V2 runtime (7.x) — only PowerShell 5.1 (Windows PowerShell).

    This is why you're seeing:

    Runbook type 'PowerShellV2' not supported Event ID 7001 - SandboxEncounteredException

    Microsoft is moving to a new extension-based hybrid worker model that does support PowerShell 7.x runbooks.

    Here's how to set it up:

    Requirements:

    • VM must be Azure Arc–enabled or an Azure VM.

    Azure Connected Machine Agent must be installed (for Arc).

    Use the Automation Hybrid Worker Extension.

    Microsoft Docs:https://learn.microsoft.com/en-us/azure/automation/automation-hybrid-runbook-worker-v2-deploy

    😊 If my answer helped you resolve your issue, please consider marking it as the correct answer. This helps others in the community find solutions more easily. Thanks!


  3. Charles Thivierge 4,176 Reputation points
    2025-08-05T14:56:53.6033333+00:00

    Thanks for quick reply,

    In the hybrid worker group, i only have 1 hybrid worker which is an azure vm with extension based v2.

    Also, the VM was a fresh install without any other version of the hybrid worker extension or agent based. The first setup was using extension based v2.

    User's image

    I also have added the variable "POWERSHELL_7_4_PATH" that point to "C:\Program Files\PowerShell\7" and restarted the VM but it still having the same error message


  4. Kendal Friesen 6 Reputation points
    2025-08-05T23:35:20.57+00:00

    I'm having the exact same experience.... I have been able to get my runbook to run twice on 7.4... and I have no clue why it ran successfully... as then it stops working and throws that error as mentioned in intial post.

    My system variable is
    powershell_7_4_path C:\Program Files\PowerShell\7\pwsh.exe

    I have tried with and without the pwsh.exe in the path.
    C:\Program Files\PowerShell\7
    C:\Program Files\PowerShell\7\pwsh.exe -
    This is when I think it worked... but then it didn't work on repeated tries.

    My extension is on latest version. 1.3.63

    I'm using a custom environment for 7.4. My runbook will run against azure... just not on hybrid worker.

    I'm using 7.4 - we did have 7.5 but uninstalled it and installed 7.4

    0 comments No comments

Your answer

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