private/Connect-0365Tools.ps1

<#
.Synopsis
This powershell cmdlet establishes a connection to Office 365. It will prompt the user for credentials twice in order to authenticate the session.
  
.Description
Connect-O365Tools will connect to Office 365 and log into an active session for powershell management of your Office 365 account.
  
.Example
Connect-O365Tools
#>


Function Connect-O365Tools{
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-Module (Import-PSSession $Session -AllowClobber) -Global
Connect-MsolService
}