Connecting to Office 365 with Remote PowerShell – PowerShell Nuggets 5/5 (1) 2 min read

Using remote PowerShell to connect Office 365

In this article, we will learn how to use remote PowerShell for connecting to Office 365 (Windows Azure Active Directory).

This article is tagged under “PowerShell Nuggets”, meaning the style is KIS (Keep It Simple!) In case that you want to read more detailed explanation, use the following link: How to use Remote PowerShell for managing Office 365

Step 1: Download and install required components

Before we can start the remote PowerShell session to Office 365, we need to download the required cmdlets. Additional pre-requirement is to: install the: Office 365 sign in assistant.

You can find the required software components using the following links:

1. Microsoft Online Services Sign-In Assistant

You can download the Microsoft Online Services Sign-In Assistant by using the following link:
Microsoft Online Services Sign-In Assistant for IT Professionals RTW

2. Office 365 Powershell cmdlets

You can download the windows Azure Active Directory Module for Windows PowerShell by using the following link:
Windows Azure Active Directory Module for Windows PowerShell

Step 2: Run as Administrator

To be able to change the PowerShell Execution Policy, we need to run PowerShell console, by using the option: Run as administrator.

Run as administrator-01

Right click on the Microsoft Online Services Module for Windows PowerShell icon and chose the option: Run as administrator.
Run as administrator-02

Step 3: Setting the PowerShell Execution Policy

PowerShell security policy (“Execution policy”) can be defined by using one of the following options (modes): Restricted, AllSigned, RemoteSigned, and Unrestricted.
(The default mode is: Restricted).

To change the Execution policy open the Microsoft Online Services Module for Windows PowerShell and type the command:

Set-ExecutionPolicy Unrestricted

Set-ExecutionPolicy RemoteSigned-04

Step 4: Connect to Office 365 by using Remote PowerShell

Open the Microsoft Online Services Module for Windows PowerShell and Type (or copy and paste) the following command:


A pop out windows will appear. Type your credentials by using the UPN (user Principal name) format. For example [email protected]


Note – the username should have global administrator rights in the Office 365 environment.

Congratulations! You are now connected to the Office 365.

PowerShell Interface is a little bit “stingy” in providing Indication such as: “you are now connected”. In the PowerShell environment, the fact that we did not get any error message indicates that “everything is O.K” (most of the times).

Step 5: Verifying the remote connection

Q: How can we know if the remote session was successfully created?

A: To verify that we are connected, we can use the most basic Office 365 cmdlets:


Verifying the remote connection-06

Watch the Video: Connect to Office 365 by – using Remote PowerShell

Using Remote PowerShell to manage Office 365 | Article series index

Now it’s Your Turn!
We really want to know what you think about the article

Related Post

Please rate this

Eyal Doron on EmailEyal Doron on FacebookEyal Doron on GoogleEyal Doron on LinkedinEyal Doron on PinterestEyal Doron on RssEyal Doron on TwitterEyal Doron on WordpressEyal Doron on Youtube
Eyal Doron
Share your knowledge.
It’s a way to achieve immortality.
Dalai Lama

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.