I;m trying to configure a powershell windows so that when it opens it will automatically run a script to connect to the o365 tenant. But I want it to auto populate my ID and password so I don't have to every time.
I have configured a powershell profile to use these commands, but how do add in my user Id and password?
$O365Cred = Get-Credential
$O365Session = New-PSSession –ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell
-Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session -AllowClobber
Connect-MsolService –Credential $O365Cred