Connect to Office 365 / Exchange Online

Sharing is caring!

<div dir&equals;"ltr" style&equals;"text-align&colon; left&semi;">&NewLine;<h3>&nbsp&semi;<&sol;h3>&NewLine;<h3>The Windows PowerShell cmdlets for Office 365 management and deployment have to be installed on your local machine&comma; if you want to manage e&period;g&period; Office 365 licences&period; <&sol;h3>&NewLine;<ol>&NewLine;<li>Download the appropriate version of the Microsoft Online Services Sign-in Assistant depending on your operating system version&colon; http&colon;&sol;&sol;technet&period;microsoft&period;com&sol;en-us&sol;library&sol;hh974317&period;aspx&period; <&sol;li>&NewLine;<p><&sol;p>&NewLine;<li>Install the downloaded software on your local machine&period;<&sol;li>&NewLine;<&sol;ol>&NewLine;<h3>&nbsp&semi;<&sol;h3>&NewLine;<h3>&nbsp&semi;Connect to Office 365 &sol; Exchange Online<&sol;h3>&NewLine;<ol>&NewLine;<li>Open the Windows PowerShell&period;<&sol;li>&NewLine;<p><&sol;p>&NewLine;<li>Execute the follwoing command if the Microsoft Online Services Sign-in Assistant has been installed&colon; <code>Import-Module MSOnline<&sol;code><&sol;li>&NewLine;<p><&sol;p>&NewLine;<li>Execute the following command <code>&dollar;LiveCred &equals; Get-Credential<&sol;code> and enter the admin credentials in the popup dialog&period;<&sol;li>&NewLine;<p><&sol;p>&NewLine;<li>Execute the following commands&colon;<br &sol;><code>&dollar;Session &equals; New-PSSession -ConfigurationName Microsoft&period;Exchange -ConnectionUri https&colon;&sol;&sol;ps&period;outlook&period;com&sol;powershell&sol; -Credential &dollar;LiveCred -Authentication Basic -AllowRedirection<br &sol;>Import-PSSession &dollar;Session <&sol;code> <&sol;li>&NewLine;<p><&sol;p>&NewLine;<li>You are connected now&period; If the Microsoft Online Services Sign-in Assistant has been installed&comma; execute the following command&colon; <br &sol;><code>Connect-MsolService –Credential &dollar;LiveCred<&sol;code><&sol;li>&NewLine;<&sol;ol>&NewLine;<p><&sol;p>&NewLine;<h3>Enter credentials without popup dialog<&sol;h3>&NewLine;<p>You can enter the credentials directly in the script without using a popup dialog&period; This method may be used to automate PowerShell commands&period;<&sol;p>&NewLine;<ol>&NewLine;<li>Use the following commands instead of <code>&dollar;LiveCred &equals; Get-Credential<&sol;code> and replace the credentials&colon;<br &sol;> <code>&dollar;Username &equals; "admin&commat;yourdomain&period;edu"<br &sol;>&dollar;Password &equals; ConvertTo-SecureString &OpenCurlyQuote;YourPassword’ -AsPlainText -Force<br &sol;>&dollar;LiveCred &equals; New-Object System&period;Management&period;Automation&period;PSCredential &dollar;Username&comma; &dollar;Password&nbsp&semi;&nbsp&semi;<&sol;code><&sol;li>&NewLine;<&sol;ol>&NewLine;<p><code><span style&equals;"font-family&colon; Arial&comma;Helvetica&comma;sans-serif&semi;"><span style&equals;"font-size&colon; small&semi;"><b>Can write Following code in powershell to establish connection&nbsp&semi; <&sol;b><&sol;span><&sol;span><&sol;code><&sol;p>&NewLine;<p><code><code><br &sol;>Set-ExecutionPolicy Unrestricted<br &sol;>Import-Module MSOnline<br &sol;>&dollar;O365Cred &equals; Get-Credential<br &sol;>&dollar;O365Session &equals; New-PSSession –ConfigurationName Microsoft&period;Exchange -ConnectionUri https&colon;&sol;&sol;ps&period;outlook&period;com&sol;powershell -Credential &dollar;O365Cred -Authentication Basic -AllowRedirection<br &sol;>Import-PSSession &dollar;O365Session<br &sol;>Connect-MsolService –Credential &dollar;O365Cred<br &sol;><code>&nbsp&semi;<&sol;code> <&sol;code><&sol;code><&sol;p>&NewLine;<ol><&sol;ol>&NewLine;<&sol;div>&NewLine;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.