Microsoft has announced the long-awaited (at least for me) possibility to use PowerShell to do Remote Connection to Exchange Online Protection.
I have previously blogged about doing Remote PowerShell session into Office 365 services, such as my post: How to Remote PowerShell into Exchange Online (Office 365).
Remote PowerShell is great administrative interface since it enables you to manage your Microsoft Exchange Online Protection (EOP) settings directly from PowerShell.
Examples of use could be:
- Setup and configure Connectors
- Configure Transport rules
- Add Accepted domains
How to Connect to Exchange Online Protection
You don’t need Office 365 MS Online PowerShell module for managing your Exchange Online Protection configuration with PowerShell. Just start a PowerShell session and type in following commands:
1 $Cred = Get-Credential
The above command prompts you, for your Office 365 (EOP) tenant admin credentials, it is important to enter as UPN format, such as e.g. email@example.com.
Next, we will create a new remote PowerShell session using the following cmdlet:
<strong><span style="font-size: small;">$s = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.protection.outlook.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection</span></strong>
Next, import the EOP cmdlets into your local PowerShell session, using the following command:
1 Import-PSSession $s
You are now connected to Exchange Online Protection (EOP) with you Office 365 (EOP) Tenant admin and can use Exchange Online Protection PowerShell cmdlets available.
For information about Exchange Online PowerShell cmdlets available see Reference to Available PowerShell Cmdlets in Exchange Online Protection on Technet.
To remove the PowerShell session again, run the following command:
1 Remove-PSSession $s
Remember to remove the session, when you are done.