Connect (and disconnects) to/from Microsoft 365
For full, always-up-to-date details and examples, use Get-Help <FunctionName> -Detailed or -Examples.
Connect-Nebula
One-shot helper that ensures EXO is connected, then (optionally) connects Microsoft Graph.
Syntax
Connect-Nebula [-UserPrincipalName <String>] [-GraphScopes <String[]>] [-GraphTenantId <String>]
[-GraphDeviceCode] [-AutoInstall] [-ForceReconnect] [-SkipGraph]
| Parameter | Description | Required | Default |
|---|---|---|---|
UserPrincipalName | UPN for EXO auth. | No | Auto-detected |
GraphScopes | Graph delegated scopes to request. | No | User.Read.All |
GraphTenantId | Tenant ID/domain for Graph. | No | - |
GraphDeviceCode | Use device code instead of browser for Graph. | No | False |
AutoInstall | Auto-install missing modules. | No | False |
ForceReconnect | Skip health checks and reconnect both services. | No | False |
SkipGraph | Connect only EXO, skip Graph entirely. | No | False |
Example
Connect-Nebula -GraphScopes 'User.Read.All','Directory.Read.All' -AutoInstall
Disconnect-Nebula
Disconnect EXO and/or Graph.
Syntax
Disconnect-Nebula [-ExchangeOnly] [-GraphOnly]
| Parameter | Description | Default |
|---|---|---|
ExchangeOnly | Disconnect only EXO. | False |
GraphOnly | Disconnect only Graph. | False |
Example
Disconnect-Nebula -GraphOnly # keep EXO session alive
Connect-EOL
Connect to Exchange Online (EXO V3), auto-importing the module and auto-detecting the current user when -UserPrincipalName is not supplied.
Syntax
Connect-EOL [-UserPrincipalName <String>] [-DelegatedOrganization <String>] [-PassThru]
| Parameter | Description | Required | Default |
|---|---|---|---|
UserPrincipalName | UPN/e-mail for the EXO auth prompt. | No | Current user (Find-UserConnected) |
DelegatedOrganization | Target customer tenant (delegated admin). | No | - |
PassThru | Return the Connect-ExchangeOnline session object. | No | False |
Example
Connect-EOL -UserPrincipalName 'admin@tenant.onmicrosoft.com'
Questions and answers
Which services does Connect-Nebula connect?
Exchange Online always; Microsoft Graph unless you use -SkipGraph. Default Graph scopes include User.Read.All (extend with -GraphScopes).
Can I operate across multiple tenants?
Yes. Use Connect-EOL -DelegatedOrganization for delegated tenants and Connect-Nebula -GraphTenantId for Graph. Run Disconnect-Nebula before switching contexts.