289769a601
Automatic Documentation Deployment / Sync Docs to https://kb.bunny-lab.io (push) Successful in 8s
33 lines
1.2 KiB
Markdown
33 lines
1.2 KiB
Markdown
---
|
|
tags:
|
|
- Exchange Online
|
|
- PowerShell
|
|
- Scripting
|
|
---
|
|
|
|
## Purpose
|
|
Sometimes you will need to connect to Office365 via powershell in order to perform troubleshooting / automation that either is too complex to do via the website, or is not exposed / possible to do via the website.
|
|
|
|
## Update Nuget Package Manager
|
|
```powershell
|
|
Install-PackageProvider -Name NuGet -Force -ForceBootstrap
|
|
```
|
|
|
|
## Install ExchangeOnlineManagement Powershell Modules
|
|
You will need to install and import the modules for Exchange Online before you can run the commands necessary for interacting with it.
|
|
|
|
```powershell
|
|
Install-Module -Name ExchangeOnlineManagement -Force
|
|
Import-Module ExchangeOnlineManagement
|
|
```
|
|
|
|
## Connect to Exchange Online
|
|
When you run the following command, it will open a dialog box to take the username, password, and MFA code (if applicable) for an administrative account in the Exchange Online environment.
|
|
|
|
```powershell
|
|
Connect-ExchangeOnline -UserPrincipalName admin@domain.com
|
|
```
|
|
|
|
## Related Documentation
|
|
- [Related Email Documentation](<../../../../reference/Applications/Email/index.md>) — Find the connected deployments, procedures, and references for this subject.
|