Connect To Exchange Online an Azure AD using Cloud Shell

In this blog post, I will show you how to connect to Office 365 Exchange Online and Azure AD using Azure Cloud Shell.

Cloud Shell

Microsoft Azure Cloud Shell is a browser and cloud-based command line utility that allows us to manage Microsoft Azure.

Cloud Shell comes with 50+ command line tools like .NET, PowerShell 6, Azure CLI, Azure AD and Exchange Online.

The standard process to connect to Azure AD and Exchange Online is to install the PowerShell module on your machine and then connect to the services.

The problem with the above approach is that sometimes you had to have your connection scripts ready and install the module.

Because Cloud Shell is a cloud service, there is no need to worry about the two points.

Get Started

To get started, I connect to Azure Cloud Shell from the Cloud Shell icon inside the Azure Portal.

Connect to Exchange Online

To connect to Exchange Online, we need to use the new Exchange Online module that also allows MFA.

The command to connect to Exchange Online is:

Connect-EXOPSSession

Before connecting to the service, I am asked to authenticate again using a web browser.

The screen below shows the login screen and code I will need to type in.

Once authenticated successfully, Cloud Shell will connect and load all the Exchange Online commands to the session.

Connect to Azure AD

The process to connect to Azure AD is almost the same.

To connect to Azure Active Directory, I will use the following command.

Connect-azuread

If you already authenticated to Exchange Online Cloud Shell will use the same session and will not ask for authentication.


Posted

in

, ,

by