This cmdlet checks for the presence of PowerShellGet v18.104.22.168 or later, the Azure AD module, and the MSAL.PS module. It installs these items if they're missing.
Note: After enabling TLS 1.2 on the server, restart the server and follow these articles to download respective updates/modules for PowerShellGet, Azure AD Module & MSAL.PS module.
Let me know if the issue still persists.
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.