Script: Connect to Office 365 PowerShell modalities at once by using Credential Manager for authentication

Recently I’ve found myself connecting to a lot of my customers online environments and even mine by using PowerShell with the annoying habit of searching Google/Bing for the following phrases:

  • Connect to Exchange online using PowerShell
  • Connect to Lync online using PowerShell
  • Connect to Office 365 using PowerShell

Though it’s relatively not a complicated task to do or remember, it’s still a 3-steps process that also includes providing credentials every time for every modality.

In order to solve this extremely awful situation Smile, I’ve decided to write a script which allows the following major options:

  • Being able to use an existing credential out of the credential manager instead of typing the credential every time.
  • Being able to connect to all modalities at once instead of doing it one at a time by just specifying the required parameters.
  • Being able to connect to Exchange online by using IE Proxy settings for companies who uses proxy servers to connect

Usage:

Connect to Office 365 Only:

  • .Get-MeOnline.ps1 -TenantCredentialKey -Office365Online

Connect to all modalities at once:

  • Get-MeOnline.ps1 -TenantCredentialKey -Office365Online -ExchangeOnline -LyneOnline

Connect to Exchange Online:

  • .Get-MeOnline.ps1 -TenantCredentialKey -ExchangeOnline

Connect to Exchange online while you have Proxy setting configured in your IE:

  • .Get-MeOnline.ps1 -TenantCredentialKey -ExchangeOnlineWithProxy

Connect to Lync / Skype for Business Online:

  • .Get-MeOnline.ps1 -TenantCredentialKey -LyneOnline

Prerequisites:

There are few prerequisites in order for the script to work:

  1. Creating a Generic Credential under the Credential Manager > Windows Credentials. The name appears in the “Internet or network address” is the name of the parameter.
  2. Making sure all Online modules are installed (Azure Module, Skype for Business Online connector)

Download:

The script can be download from: TechNet Gallery | OneDrive

Please provide any feedback or suggestions if you have any.

1 Comment

  1. henrikborjesson

    Reblogged this on Henrik Börjesson's UC-Blog and commented:
    very good initiative from Gut Bachar

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *