Skip to content
InvardiaInvardia
Why InvardiaProductsFeaturesPricingCommunity
Docs
All documentation
Product documentationPIM ManagerSecurityInsight
SettingsPIM Manager settingsSecurityInsight settingsEntra Policy Suite settings
ScriptsPIM Manager scriptsSecurityInsight scriptsEntra Policy Suite scriptsInvardia scripts
Error codesPIM Manager error codesSecurityInsight error codes
API and MCPPIM Manager APIPIM Manager MCP toolsSecurityInsight APISecurityInsight MCP tools
SecurityPIM Manager security packSecurityInsight security packEntra Policy Suite security pack
Network and designPIM Manager network guidesPIM Manager command wizardNetwork egressDesign your installationCalculate your cost
SupportSetup scriptsRemote support access
Search the docs
SupportAboutContactBook a demoCustomer portalDesign your installationFree Pro trial

SecurityInsight scripts

Set-SIMail

Set up how SecurityInsight sends mail

Purpose

Sets up how SecurityInsight sends mail: an Office 365 shared mailbox (created if asked; Mail.Send scoped to that mailbox only through Exchange RBAC for Applications, then verified) or your own SMTP relay. Plan by default; -Apply changes.

When to run it

When mail is set up, or the sender / relay changes. For your Exchange administrator.

Who may run it

KindRoleScopeWhy
exchangeExchange Administrator (narrowest: Mail Recipient Creation + Role Management)Exchange Onlineto create the mailbox, the scope and the role assignment
entraRolePrivileged Role Administrator or Cloud Application Administratorthe tenantto remove a tenant-wide Microsoft Graph Mail.Send (needs AppRoleAssignment.ReadWrite.All)

What it changes

WhereActionWhatPermission / roleScopeWhyUndo
Exchange Onlinecreatethe shared mailbox (-CreateMailbox, on by default)Exchange OnlineSecurityInsight sends as one mailboxremove the mailbox
Exchange Onlinecreateservice principals for SecurityInsight's identities (New-ServicePrincipal)Exchange OnlineExchange RBAC for Applications needs themRemove-ServicePrincipal
Exchange Onlinecreatemanagement scope SecurityInsight-Sender (only that mailbox)Exchange Onlinelimit the send right to one mailboxRemove-ManagementScope
Exchange Onlinegrantper identity: Application Mail.Send on that scopeApplication Mail.Sendthe scope (one mailbox)SecurityInsight sends its mailRemove-ManagementRoleAssignment
Entra application permissionsremovea tenant-wide Microsoft Graph Mail.Send on those identitiesMail.Sendthe tenanta tenant-wide right would let them send as every mailboxgrant it again (not recommended)
Key Vault secret (smtp mode)updateSI-Smtp-Passwordthe SecurityInsight Key Vaultthe relay password never goes into configurationrestore the previous version

What it only reads

  • identities and their Graph permissions (Application.Read.All)
  • mailboxes, scopes and role assignments

Parameters

ParameterRequiredDefaultWhat it does
-Modeno'sharedMailbox'
-TenantIdno
-SharedMailboxnosharedMailbox: the address SecurityInsight sends as. Empty = <MailboxName>@<MailDomain>, and without -MailDomain <MailboxName>@<the tenant's initial domain>. The company names the mailbox (its own naming): -MailboxName, -MailDomain and -DisplayName; the defaults are only defaults.
-MailboxNameno'SecurityInsight'
-MailDomainno
-DisplayNameno'SecurityInsight'
-CreateMailboxno$true
-ScopeNameno''The Exchange management scope. Empty = a scope that already filters exactly this mailbox is ADOPTED, else '<MailboxName>-Sender'. The role assignments are named '<MailboxName>-MailSend-<app id>'.
-IdentityObjectIdno@()SecurityInsight's sending identities: service principal OBJECT ids. Or resolved from -SubscriptionId + -ResourceGroup: every user-assigned identity there, and the system-assigned identity of every container app, container apps job and web app there.
-SubscriptionIdno
-ResourceGroupno
-ExcludeIdentityPatternno'(?i)tagging|mcp'identities in -ResourceGroup that never send mail (asset tagging, the MCP server) are left out
-ProbeMailboxnoA mailbox OUTSIDE the scope, to prove the restriction. Empty = the signed-in person (when it has a mailbox).
-SmtpServernosmtp
-SmtpPortno587
-SmtpUseSslno
-SmtpUserno
-SmtpPasswordno
-Fromno
-KeyVaultNameno
-SmtpPasswordSecretNameno'SI-Smtp-Password'
-TestTono@()
-UseSignedInAccountnosign-in: setup's own REST sign-in (a person in Cloud Shell / the browser, or the Invardia support session) -- no az CLI
-ActivateExchangeAdminnoan app sign-in (the Invardia Support app): activate its own Exchange Administrator role through Entra PIM, time-bound
-ExchangeAdminHoursno2
-Applyno
-OutFileno
-TimeoutSecondsno900#564: how long one Exchange action (and the scope check) may wait for Exchange; 0 = no waiting at all (the guided install passes a short value and defers the rest to Get Started -- a slow Exchange never holds an install)
-LoadFunctionsOnlynotests: define the functions and stop

Preview with -WhatIf

The plan: what would be created, granted and removed, with the commands; nothing is changed (same as without -Apply).

Undo

Remove the role assignments, the scope and the service principals in Exchange; remove the mailbox if it was created.

Network

It connects to: *.blob.core.windows.net, *.queue.core.windows.net, *.table.core.windows.net, *.vault.azure.net, 169.254.169.254, api.loganalytics, api.loganalytics.io, api.msrc.microsoft.com, api.security.microsoft.com, api.securitycenter.microsoft.com, api.securityplatform.microsoft.com, database.windows.net, entra.microsoft.com, graph.microsoft.com, invardia.com, licenses.nuget.org, login.microsoftonline.com, management.azure.com, monitor.azure.com, nvd.nist.gov, outlook.office.com, outlook.office365.com, portal.invardia.com, storage.azure.com, vault.azure.net, www.powershellgallery.com

Download and run

Run these lines in PowerShell: the first downloads the script into the current folder, the second runs it.

Invoke-WebRequest https://invardia.com/support/si/Set-SIMail.ps1 -OutFile Set-SIMail.ps1
.\Set-SIMail.ps1

To check the download first, compare its SHA-256 with the published one:

SHA-256 4c2ed24e8a8c1632827b444381a9bbb68c017aa13b5610389200f63684212923

Checksums: SHA256SUMS.txt · Version 3.0.79

Before you run it, compare the file's SHA-256 with its line in SHA256SUMS.txt.

Every parameter: Get-Help .\Set-SIMail.ps1 -Full · Source: Set-SIMail.ps1

Every script, identity and permission for your security review: SecurityInsight

InvardiaInvardia

See the risk. Control the access.

Products

PIM ManagerSecurityInsightEntra Policy SuiteAll featuresPricingFree 60-day Pro trialBook a demoWhy Invardia

Docs

DocumentationSearch the docsPIM Manager settingsSecurityInsight settingsPIM network guidesCommand wizardNetwork egressPIM Manager design configuratorSecurityInsight design configuratorDesign your installationCalculate your cost

Company

AboutContactCustomer portalSupportHow support worksHow updates reach youSupport in numbersSetup scriptsRemote support accessContact: info@invardia.com

Legal

Terms of saleLicence termsData processingPrivacyCookiesCompany information
© 2026 Invardia – a brand of 2LINKIT, founded and owned by Morten Knudsen · Strandvejen 21A, 6000 Kolding, Denmark · VAT DK39208032 · Contact: info@invardia.com