Office 365 Connection Script with Modern Auth - Supports MFA (Multi-Factor Auth)

Script with GUI based connection to all Office 365 services that support Modern Auth and MFA - Exchange Online - SharePoint Online - Skype for Business Online - Azure AD v1 - Azure AD v2 - Azure Resource Manager - Azure Rights Manager - Security and Compliance Center

 
 
 
 
 
4.8 Star
(44)
16,199 times
Add to favorites
Office 365
10/2/2017
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • For GCC High End point
    1 Posts | Last post June 12, 2019
    • Can you please modify this script for GCC high end point . Here is the link for GCC high 
      
      https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/mfa-connect-to-exchange-online-powershell?view=exchange-ps
  • Prompt to Change UPN/Tenant
    2 Posts | Last post May 18, 2019
    • We have multiple tenants and therefore different UPN's. Is there any way that a powershell true/false flag can be set to prompt for the tenant and/or UPN upon running the script? This will elevate us from needing to dive in and modify the PS variables each time we need to change the tenant we are working in.
      
      Thanks for the already invaluable script.
    • Not the MFA version that I am aware of.
      My other script that does not use MFA, you could theoretically save the script with the UPN variable, and just run that script (one for each tenant).
      
      Non-MFA Basic -https://gallery.technet.microsoft.com/Office-365-Connection-364d270b
      Non-MFA Most services - https://gallery.technet.microsoft.com/Office-365-and-Azure-e36eabeb
  • Help with your tool after domain controllers upgraded
    2 Posts | Last post May 06, 2019
    • Terry,
       Our company upgraded to 2016 domain controllers and now your tool will not allow me to connect to the account that I have listed in your tool. A pop-up box opens then closes and the red letters say
      New-ExoPSSession : User PCUser@domain.com' returned by service does not match user 'admin@domain.com' in the request 
      have you seen this before? If so, please help
    • Looks like you are using incorrect credentials.
      This is querying Office 365 / Azure AD, so you should be using an Admin account in Azure AD and not a local domain admin account.
  • New button for Teams
    2 Posts | Last post January 09, 2019
    • Hi Terry!
      Very Nice Script
      
      I added a new button for the New Teams PowerShell connection.
      This is basically the actions script those:
      
      		Write-Host "Running the script to Connect to Teams Online"
      		
      		Import-Module -name MicrosoftTeams
      		Connect-MicrosoftTeams
      
      If you want I can send you the whole script but i'm pretty sure you know much better then me how to add an extra button.
      
      
    • Thanks for that, but I wasn't going to update with Teams until the Teams PowerShell module was stable and mature.
      There still seems to be a lot of people in the community with a view that it is not stable yet.
      
      Thanks for your input.
  • Login each time required?
    2 Posts | Last post November 29, 2018
    • Hi does this let you login once with MFA and then that automatically lets you login to the other services? Or do you have to login each time for each service?   
      For example can I connect to MSOnlin with MFA and then that token will let me login to Exchange Online MFA without being prompted again? 
    • No. If you want to login once to all services, you cannot use MFA.
      Use this script to login once - https://gallery.technet.microsoft.com/Office-365-and-Azure-e36eabeb -
      
      However, it is HIGHLY recommended that admin accounts are protected with MFA.
      
  • I really tried...
    2 Posts | Last post October 18, 2018
    • Terry let me begin by thanking you and everyone else for creating this script.  To be honest I am so new to using PS scripts but I am trying to learn more about them.
      
      I followed all instructions (or I thought I did).  I keep getting the below when I try and run the script.  It keeps hanging on the Get-DlpSensitiveInformationType - to test connection.  Nothing happens.  Just sits there.  Any help anyone can provide really appreciated.
      
      PS C:\scripts> .\Connect-O365-MFA-v2-5.ps1
      Running the script to Connect to Security and Compliance Center
      WARNING: Your connection has been redirected to the following URI:
      "https://gcc01b.ps.compliance.protection.outlook.com/PowerShell-LiveId?BasicAuthToOAuthConversion=true;PSVersion=5.1.17
      134.228 "
      WARNING: The names of some imported commands from the module 'tmp_myvaqqdq.yu4' include unapproved verbs that might
      make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the
      Verbose parameter. For a list of approved verbs, type Get-Verb.
      Completed running the script to Security and Compliance Center - Run the cmdlet - Get-DlpSensitiveInformationType - to test connection
    • Don't worry (much) about that warning. The script will still ran and you are connected.
  • SfB connection broken ?
    3 Posts | Last post August 27, 2018
    • Hi Terry
      First of all thanks for this great script. Been using it for some time now.
      This morning I ran into an issue connecting to SfB Online though. The authentication part runs fine, including MFA but then it sits there for awhile and then throws a .NET Unhandled exception error.
      It states:
      The running command stopped because the preference variable 'ErrorActionPreference' or common parameter is set to stop:[admin1e.online.lync.com] Processing data from remote server admin1e.online.lync.com failed with the following error message: The request for the Windows Remote Shell with ShellID xxxxx failed because the specified ShellID is incorrect or the Shell no longer exists on the server. Provide new ShellID or create a new shell and retry.
      
      
      I have retried several times but without success. 
      
      Not sure if it's due to a .NET update in the latest Windows 10 cumul update or if MS changed something on their end...
      
      Any tips? :-)
    • Have you tried running it from another workstation at all. I know that Windows 10 plays havoc constantly after updates. The last update killed my outgoing RDP connections. Works fine if I RDP out to the same server from a different PC, but dies on my recently updated Win 10 pc.
      Try a different PC and let me know.
    • Hey Terry,
      
      In typical MS way, it worked again the next day without any changes to configuration :-) so I am again a very happy user of your script!
  • Instructions?
    2 Posts | Last post July 10, 2018
    • What server should I be running this on?  Where can I find instructions on syntax and how to run this script?  Also, is there a description somewhere that tells me what attributes this is changing and why?
    • Scroll down to the 'Resources' section of the download page and there are numerous links there about how to configure your PC or admin server as well as how to use the script.
  • SSO update
    2 Posts | Last post July 09, 2018
    • Very nice script to get into all of the MS parts.  You would think MS would have a single point of entry for all of this, but maybe some day.  Any chance you are planning a update that will allow a single entry of username/password to start all modules?
    • Hi John, to my knowledge, there is no way to enter the password once and use for logging in to multiple services with an account protected by MFA.
      My non-MFA script does handle that though and is available here - https://gallery.technet.microsoft.com/Office-365-and-Azure-e36eabeb
  • Multi sessions
    1 Posts | Last post June 05, 2018
    • Have not tried this script yet, Looks Great. Thanks for Creating it. Question: crossover Cmdlet names from Exchange to Security and Compliance. Does your script add multiple sessions in one Powershell window or are they separate? If they are together, is there any need for custom cmdlet prefixes to differentiate between exchange and Compliance Center?
1 - 10 of 29 Items