Hi @Glenn Maxwell ,
the reason for this error might be the retirement of the MSOnline PowerShell module:
Action required: MSOnline and AzureAD PowerShell retirement - 2025 info and resources
Instead of using the MSOnline PowerShell module it's recommended to use the Microsoft Graph PowerShell SDK: Install the Microsoft Graph PowerShell SDK
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten