How to set up a quick connection to the Office 365 Security & Compliance Center via Powershell

It’s a good idea to create shortcuts to the various Office 365 services, so you can quickly log on to them without having to copy and paste commands one by one.

Easily connect to the Office 365 Security & Compliance Center via Powershell

Open PowerShell as an administrator

  1. Go to Start, search for PowerShell, right click Windows Powershell and Run as Administrator
    Open PowerShell As An Administrator To Connect To Exchange Online

Create a PowerShell profile with a new function

  1. If you haven’t already configured a PowerShell Profile, run this:
    New-item –type file –force $profile

    Create A New PowerShell Profile

  2. Then this:
    notepad $profile

    Open PowerShell Profile In Notepad

  3. Now copy the following PowerShell function into the notepad document and save it:(Be sure to replace elliot@gcits.com with your username).
    Function Connect-SecurityCompliance{
    
    $credentials = Get-Credential -Credential elliot@gcits.com
    Write-Output "Getting the Security & Compliance Center cmdlets"
    
    $Session = New-PSSession -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ `
    -ConfigurationName Microsoft.Exchange -Credential $credentials `
    -Authentication Basic -AllowRedirection
    Import-PSSession $Session
    
    }

 

Use the new function to connect quickly to the Office 365 Security & Compliance Center

  1. Close PowerShell and run it again.
  2. From now on you can just type Connect-SecurityCompliance, or just type connect and press TAB until it appears.Connect-SecurityCompliance PowerShell Function
  3. Enter your password and you’re good to go. Now your computer is set up to connect to the Office 365 Security and Compliance Center without having to copy and paste multiple commands.Security and Compliance Center PowerShell Cmdlets

 

Was this article helpful?

Related Articles