$Cred = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection Import-PSSession $Session -DisableNameChecking
If you are using MFA (Multi-Factor Authentication) then you can’t use the Get-Credential method.