An Azure service that is used to automate, configure, and install updates across hybrid environments.
My situation is like this, I have 7.4.20 installed on my hybrid workers. The runbooks are sync'd via source control. Source control creates a new runbook as 5.1 but I upgrade it in the Azure portal to 7.2. Source control does not change the runtime version after you change in the web portal but it still sync's the code changes.
All my runbooks are set to the 7.2 "System Generated" runtime environment. Even though this is 7.2 runtime environment, the runbook runs using PowerShell 7 version that's installed which is 7.4.20. This only happened with hybrid workers, Azure ones did not show this behavior. If I create a custom runtime environment with 7.4, the source-control-created runbook runs using PowerShell 5.1 like OP. With the non-source-control-created runbook, it stays stuck at "Queued" until it goes to "Suspended".
I set the "powershell_7_4_path" system environment variable to "C:\Program Files\PowerShell\7" and rebooted. This did not resolve the issue.
Here's how I resolved the issue:
Uninstalling the hybrid worker extension, disconnected the server from Azure Arc and deleted the resource, then uninstalled the Azure Connected Machine Agent then rebooted.
Then after reboot, I onboarded back into Azure Arc, added the hybrid worker extension, then added to the hybrid worker group. After these steps, the 7.4 runtime runbooks failed instantly. They would not run as 5.1 or get stuck at "Queued". Then I updated the "powershell_7_4_path" to "C:\Program Files\PowerShell\7\pwsh.exe" then rebooted. Now all 7.4 runbooks (created via source control and manually) run fine.