@BartDecker-8243 Summarizing the discussion for benefit of community.
Supported versions of PowerShell within Azure Automation PowerShell 7.2 (GA) and PowerShell 5.1 (GA). Since PowerShell 7.1 is no longer supported by parent product PowerShell, we recommend you create runbooks in long term supported version PowerShell 7.2.
why 5.1 is still supported when 7.1 is already not supported. Windows PowerShell 5.1 is a component of the Windows operating system. Components receive the same support as their parent product or platform. PowerShell 5.1 is supported as a part of each OS it is a component of, so it's EOL is whatever that EOL is for the underlying OS that it is running on.
Kindly "Accept as Answer" if the provided solution is helpful.