Office 365 Connection String
Connecting to the Office 365 PowerShell takes a few PowerShell commands. If you're supporting a number of customers who use Office 365 connecting different PowerShell sessions for each customer can be time consuming. We use a product for remotely supporting our customers that can accept PowerShell commands but they have to be on a single line. I created the PowerShell command below which can be ran as a single line in PowerShell.
$User = "[USERNAME]"; $Pass = ConvertTo-SecureString -String "[PASSWORD]" -AsPlainText -Force; $PSCred = New-Object –TypeName System.Management.Automation.PSCredential($User,$Pass); $LiveCred = Get-Credential -Credential $PSCred; $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection; Import-PSSession $Session
All you need to do is replace [USERNAME] and [PASSWORD] with your Office 365 administrator credentials and you'll connect straight to the remote PowerShell. We setup one for each customer, massive time saver.
PP











