Skip to main content

Email Setup

Create the email app registration and connect the mailbox StratoLens sends from. Open Settings > General and click the Email Notifications card to expand it. The card header shows whether email is configured and which sending method is active.

Webhook-only? Skip this page

Webhook destinations don't need email. If you only want Slack, Teams or webhook delivery, go to Webhook Destinations.

The Email Notifications card in General Settings before setup.

Prerequisites

StratoLens
View Settings to see the card, get the setup script and load the PowerShell commands. Modify Settings to link, configure, unlink and send test emails.
Entra ID
Application Administrator or Global Administrator to run the setup script and grant admin consent.
Exchange Online
Exchange RBAC only: Exchange Administrator or Global Administrator.
Sender mailbox
A shared mailbox is recommended and needs no license. A regular licensed user mailbox also works.

Step 1: Run the Setup Script

StratoLens sends email through a dedicated Entra ID app registration, separate from the app you sign in with. You create it once with a PowerShell script. Until the email app is detected, the card shows Copy Script and Download Script (it downloads as StratoLens-Email-Setup.ps1).

The person running it needs PowerShell 7 or later (or Azure Cloud Shell) and the Azure CLI, signed in with az login. The script:

  • Creates a dedicated email app registration with the delegated Microsoft Graph permissions User.Read, Mail.Send and offline_access.
  • Prints an Azure portal link. Open it and click Grant admin consent for the tenant. This step is manual.
  • Creates a client secret and stores the app's client ID and secret in the StratoLens Key Vault.

StratoLens detects the new credentials within a few minutes. No restart is needed. The Mailbox Connection section then appears on the card.

Save the secret from the script output

To store the credentials itself, the script needs Key Vault Secrets Officer on the StratoLens Key Vault. Without it, the app registration is created but the card warns that the credentials were not stored in Key Vault. A Key Vault admin then runs the az keyvault secret set commands the script printed, using the client ID and secret from its output. The secret can't be retrieved later, so keep it until this is done.

Step 2: Choose a Sending Method

The Mailbox Connection section has two tabs. Only one method can be active at a time.

OAuth Sign-In

Sign in as the mailbox to authorize sending. Simpler to set up, but you re-link if the authorization is invalidated. The mailbox needs sign-in enabled with a password.

Exchange RBAC

Grant application-level send permission scoped to one mailbox with PowerShell. More steps, but no token expiration. The mailbox doesn't need sign-in or a password.

Switching tabs changes nothing on its own. Clicking Link Mailbox or Configure Mailbox on the other tab replaces the current configuration.

Option A: OAuth Sign-In

  1. On the OAuth Sign-In tab, click Link Mailbox. A Microsoft sign-in popup opens.
  2. Sign in as the sending mailbox, not as yourself.
  3. Accept the permissions prompt. The popup closes on its own, and the card shows the linked mailbox, its display name, and when and by whom it was linked.

Sign in as the mailbox, not yourself

Whoever signs in becomes the sender of every StratoLens email. If you sign in with your own account, all notifications come from you.

The authorization stays valid as long as StratoLens sends at least one email every 90 days. Tenant-level actions such as conditional access policy changes, password resets or admin token revocation can invalidate it at any time. When that happens, unlink and link the mailbox again.

Option B: Exchange RBAC

  1. On the Exchange RBAC tab, enter the sender mailbox address and click Configure Mailbox. Only letters, digits and . - _ @ + are accepted, because the address goes into PowerShell commands.
  2. The Exchange RBAC PowerShell Commands panel appears with pre-filled steps, each with a Copy button. Review each command before you run it.
  3. As an Exchange Administrator or Global Administrator, run the steps in order in Exchange Online PowerShell: connect to Exchange Online, register the service principal, create the management scope, assign the Mail.Send role, then verify authorization. If the service principal already exists, you can skip that step's error.
  4. Wait for propagation. Exchange RBAC permissions typically take 30 minutes to 2 hours to take effect, and test emails can fail with a permission error until then.
  5. Send a test email.
The generated PowerShell commands, pre-filled with your app IDs and mailbox. Run them in order with the per-step Copy buttons.

Configured doesn't mean working

The card shows Configured (Exchange RBAC) as soon as you click Configure Mailbox, before any command has run. Only a successful test email proves the setup works.

The configured state appears as soon as the mailbox address is saved, before the commands have run.
  • The management scope limits sending to this one mailbox, matched by its alias (the part before the @). The scope and role assignment are named after your StratoLens instance, so several installs in one tenant don't collide.
  • If StratoLens couldn't look up the app's service principal, an extra first step, Find Service Principal Object ID, appears to run in Azure PowerShell. The other commands then contain YOUR-SP-OBJECT-ID, which you replace by hand.
  • After a page reload, click Load Commands to show the commands again.
  • List / Remove Commands opens a dialog with commands to verify the setup (list the service principal, scope and role assignment, and test authorization) or remove it. Removing the service principal from Exchange doesn't delete the Entra ID app registration.
Verify commands are read-only checks. The Remove group tears the configuration down in dependency order.

Send a Test Email

Once a mailbox is configured, enter one address and click Send Test Email. A banner shows the result, with a hint for the current sending method if it failed, and a line below the section records the last test's result, time and address. If sending couldn't start at all (no mailbox linked, or the OAuth authorization is missing or expired), the banner shows the error but the last-test line doesn't change.

Unlink Mailbox asks for confirmation, then stops all email until a new mailbox is linked. It also clears the last test result.

  • OAuth: StratoLens discards its stored authorization. Nothing is revoked on the Microsoft side.
  • Exchange RBAC: the Exchange permissions stay in place. Run the remove commands from List / Remove Commands to clean them up.

Troubleshooting

The card still says to run the setup script

Answer

Detection takes a few minutes after the script finishes. If the card shows the partial-setup warning instead, the credentials never reached Key Vault. Have a Key Vault admin run the az keyvault secret set commands the script printed.

The sign-in popup didn't open

Answer

The browser blocked it, and the card asks you to allow popups. Allow popups for your StratoLens address and click Link Mailbox again.

Test email fails with a Mail.Send permission error

Answer

OAuth mode: admin consent wasn't granted. The error reads "Mail.Send permission not granted. Ensure admin consent was completed during setup and the mailbox account authorized StratoLens." Open the admin consent link from the setup script output, grant consent, then retry.

Test email fails with "Exchange RBAC not configured"

Answer

The PowerShell commands haven't been run yet, or the permissions are still propagating, which can take up to 2 hours. Run the verify commands from List / Remove Commands to check.

Email authorization has expired

Answer

OAuth mode: the error reads "Email authorization has expired. Please re-link the mailbox in Settings." Click Unlink Mailbox, then Link Mailbox again, signing in as the mailbox.

Mailbox not found

Answer

Check the address and that the mailbox exists in Exchange Online. For OAuth, also check that sign-in is enabled for it with a password.

Notifications appear to come from me

Answer

Someone linked OAuth while signed in as their own account. Unlink, then link again signing in as the shared mailbox.

Buttons are disabled with a tooltip about Modify Settings

Answer

You have View Settings only. Ask an admin to grant Modify Settings on Settings > Users.

Was this page helpful?

Last updated October 25, 2026