I created a script to connect to my Office 365 tenant:
$cred = Get-Credential
Connect-MsolService -Credential $cred
$session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/
-Credential $cred -Authentication Basic -AllowRedirection
Import-PSSession $session -AllowClobber
When I run this script a prompt appears and after I enter my credentials, it advises [see attached].
I do not understand why it says 'credential' not recognized, can anyone help.