May 10 2017 10:43 AM
I currently use the below script to connect to the S&C Center. This does not work with MFA.
I was wondering if there is an Updated Module that I could use that supports modern authentication?
$Credential = get-credential -Credential username.com
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid -Credential $Credential -Authentication Basic -AllowRedirection
Import-PSSession $Session -AllowClobber –DisableNameChecking
May 10 2017 11:35 AM
SolutionNope, not yet. It's the last of the "modules" I use to get MFA support :(
May 10 2017 11:40 AM
Thanks for the Response Vasil. Such a pain to have to turn of MFA to run a Purge!
Aug 09 2017 01:39 PM
I contacted Microsoft Support today. This the response
"I am aware of this limitation however when I checked in our RoadMap site I don’t see any mentioning of this as a coming soon feature. I also checked in our Database and it appears that unlike Exchange online security and compliance current design does not support MFA connection. The suggested work around from engineering is to create one compliance account and use it for that purpose ( do not enable MFA on that account)"
Aug 09 2017 11:18 PM
Well, the latest version of the MFA-enabled ExO PowerShell module hints that this might be coming soon(ish). Fingers crossed!
Aug 30 2017 05:17 AM - edited Aug 30 2017 05:20 AM
Hi,
You can download the latest MFA enabled Powershell from EAC. It contains the cmdlet name connect-IPPSsession which will connect to S&C.
Aug 30 2017 06:26 AM
Awesome @SATYAM GUPTA!
Aug 30 2017 10:17 AM
Does it work for you though? The cmdlet has been available for at least a month now, but every time I try to connect I get Access denied errors.
Aug 30 2017 11:32 PM
Hi Vasil,
Yup, its working. Please check the below screenshot.
Aug 31 2017 11:37 AM
Yeah, for whatever reason it's not working in my tenant, as well as in my test tenants. I tried it earlier with a DEMO tenant and it works as expected.
Just curious, do you happen to have E5 licenses?
Sep 05 2017 03:04 PM
If you launch it from the "Microsoft Exchange Online Powershell Module" it works great...
But if you do lots of PS administration of O365, it's horrible to have to launch a separate window just for this. I need to be able to have it import the commandlets from these modules into other PS consoles.
I found how to do the Exchange side (link below), but cannot figure out how to do the same for the Compliance Center.
Here is the short version for Exchange MFA...
Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName|?{$_ -notmatch "_none_"}|select -First 1) $EXOSession = New-ExoPSSession Import-PSSession $EXOSession
Any ideas on how to do the same for Compliance Center?
Sep 05 2017 11:03 PM
It uses the same module and the same cmdlet, just differnt parameters. Simply open the CreateExoPSSession.ps1 from the install dir, and you will see it.
New-EXOPSSession -ConnectionUri 'https://ps.compliance.protection.outlook.com/PowerShell-LiveId'
Sep 07 2017 04:52 AM
Awesome. That does it, which means we now have parity between PS with and without MFA!
So to connect ONLY to the CC using MFA, it looks like this:
Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName|?{$_ -notmatch "_none_"}|select -First 1) $MFCCPSSession = New-ExoPSSession -ConnectionUri 'https://ps.compliance.protection.outlook.com/PowerShell-LiveId' import-pssession $MFCCPSSession
Also note: Here is a MS Gallery script to connect to all the O365 components with MFA. It currently doesn't include the Compliance Center, but I suspect it will soon!
Thanks Vasil!
-Shawn
https://gallery.technet.microsoft.com/Office-365-Connection-47e03052
Sep 07 2017 10:35 AM
Just FYI, the deployment seems to have finallized across all datacenters/regions. The issues I had with connecting have disappeared now, and I can access the SCC cmdlets with the MFA module just fine, across all tenants.
Sep 19 2017 12:50 PM - edited Sep 19 2017 12:51 PM
Through some trial and error, I have discovered that the below script allows me to connect to Security & Compliance Center. This is modified fromt he original located at https://support.office.com/en-us/article/Search-for-and-delete-email-messages-in-your-Office-365-org...
I also got the idea from you. :)
$UserCredential = Get-Credential
$Session = New-EXOPSSession -ConnectionUri 'https://ps.compliance.protection.outlook.com/powershell-liveid'
Import-PSSession $Session -AllowClobber -DisableNameChecking
$Host.UI.RawUI.WindowTitle = $UserCredential.UserName + " (Office 365 Security & Compliance Center)"
Oct 12 2017 08:35 AM
Oct 12 2017 08:50 AM
how we can connect to MFA using regular powershell instead of connecting with module
Oct 12 2017 10:55 AM
You can't, that's the whole idea behind Microsoft releasing a new module. You can import/use it with your existing scripts however, there are examples in the thread above. Or you can get the token programmatically, but that's even more complicated.
Oct 12 2017 12:48 PM - edited Oct 13 2017 07:01 AM
The answer is Yes, the new module released for Exchange Online also includes a connection string for accessing the Security and Compliance Center.
Connect to Exchange Online PowerShell using multi-factor authentication
This will install a ClickOnce app reference to launch the console with the module pre-loaded.
When you launch the console you will see this message:
-------------------------------------------------------------------------- This PowerShell module allows you to connect to Exchange Online service. To connect, use: Connect-EXOPSSession -UserPrincipalName <your UPN> This PowerShell module allows you to connect Exchange Online Protection and Security & Compliance Center services also. To connect, use: Connect-IPPSSession -UserPrincipalName <your UPN> To get additional information, use: Get-Help Connect-EXOPSSession, or Get-Help Connect-IPPSSession --------------------------------------------------------------------------
Unfortunately, this limits the module's usefulness since we cannot run this in the ISE or on a different Powershell Console.
After some intense googling, binging I found a script that allows you to do just that.
Thanks to Vasil for pointing out that the code below is already in an earlier portion of the thread, Sorry I missed that. :)
Import-Module -Name $((Get-ChildItem -Path $($env:LOCALAPPDATA + '\Apps\2.0\') -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse).FullName | ?{ $_ -notmatch '_none_' } | Select-Object -First 1) $EXOSession = New-ExoPSSession Import-PSSession -Session $EXOSession -AllowClobber
You must first install the module as indicated in the reference above.
Let me know if you have any questions.
NOTE: I should point out that I have had issues with this method when using the ISE. When the session has timed out, the ISE locks up when it comes time to prompt for credentials to reauthenticate.
Oct 13 2017 12:46 AM
This example is from the thread above, as I said :) And you DO need the module, so it's not just "regular" PowerShell.