@Daniel Njoku Thank you for reaching out to Microsoft Q&A.
To your initial question, refer docs: Languages for runtime version vs compatible PS version
Regarding MSOnline, it is older V1 module for Azure Active Directory and there is V2 module AzureAD which is also planned for deprecation. I would recommend you try new Microsoft Graph PowerShell for interacting with Azure AD.
If you have a specific need to use these older modules, refer this comment and try the workaround (which previously worked for MSOnline module too). Also, check other thread to validate if any module is compatible on Azure Functions with PowerShell 7.
I hope this answers your question and feel free to add if you have any questions. I would be happy to assist you. Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community.