Hello,
Thank you for posting in Microsoft Q&A.
Based on the description, I understand your question is related to Connect-MsolService Problem.
Try run below command to help fix:
Install-Module -Name MSOnline -Force
$PSVersionTable.PSVersion
Import-Module MSOnline -UseWindowsPowershell
Connect-MsolService
Remove-Item -Path "HKCU:\Software\Microsoft\Office\16.0\Common\Identity\Identities" -Recurse
Also, consider reinstall MSOnline module:
Uninstall-Module -Name MSOnline
Install-Module -Name MSOnline -Force
Have a nice day.
Best Regards,
Molly
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it