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

Entra Policy Suite scripts

Initialize-EpsMailSender

Documentation out of date

The documentation below was written for a different copy of this script than the one published now. Read the script itself before you run it, or ask support@invardia.com.

  • the .doc.json names no sha256 of the script it documents
  • the .doc.json is for version 2.0.0, the published script is 2.0.107

The published script's own summary: Sets up Entra Policy Suite's mail (framework MAIL-1): a shared mailbox the engine sends its alerts from - and the right to send as THAT mailbox only.

Purpose

Creates (or uses) a shared mailbox and gives the engine's managed identity the right to send as that mailbox and no other (Exchange RBAC for applications), removes a tenant-wide Graph Mail.Send grant on the identity, and stores the mail settings in the Entra Policy Suite database.

When to run it

Once after the install, and again to change the sender or the recipients.

Who may run it

KindRoleScopeWhy
entraRoleExchange Administrator (and Global Administrator for the Graph grant check)the tenantcreates the mailbox, the Exchange service principal, the scope and the role assignment
azureRbacContributor (or any role that may start a Container Apps job)the install's resource groupstarts the database setup job, which stores the mail settings (audited) - no database right needed (installs made since 2.0.59); an older install: the SQL server's Entra admin stores them directly

What it changes

WhereActionWhatPermission / roleScopeWhyUndo
Exchange Onlinecreatethe shared mailbox (if it does not exist; no licence)the tenantthe alerts are sent from itRemove-Mailbox
Exchange Onlinecreateservice principal for the engine identity, management scope <sender>-SendScopethe tenantExchange RBAC for applications needs bothRemove-ManagementScope, Remove-ServicePrincipal
Exchange Onlinegrantthe engine identity (id-eps-engine)Application Mail.Sendthe sender mailbox ONLY (the management scope)it sends the alertsRemove-ManagementRoleAssignment EPS-MailSend-<app id>
Entraremovea tenant-wide Graph Mail.Send app role on the engine identity, if presentMail.Sendthe tenantit would let the engine send as any mailbox, beside the scopenot wanted
SQLupdatesettings Mail.Mode, Mail.Sender, Mail.Recipients (Platform.EnvironmentName)the Entra Policy Suite databasethe engine reads themset Mail.Mode to none

What it only reads

  • Exchange: the mailbox, the organization config, the service principals, scopes and role assignments
  • Graph: the engine identity's app roles

Parameters

ParameterRequiredDefaultWhat it does
-TenantIdyesyour Entra tenant
-SubscriptionIdyesthe subscription Entra Policy Suite is installed in
-Senderyesthe shared mailbox's address
-Recipientsyeswho gets the alerts
-ResourceGroupnorg-epsthe install's resource group (an install made before 2.0.55: rg-entrapolicysuite, found by itself when it is there)
-EnvironmentNamenothe environment's name in every mail (subject and footer)

Preview with -WhatIf

Every step it would take and the settings it would store; nothing is changed.

Undo

Remove the role assignment, the scope, the Exchange service principal and (if created) the mailbox; set Mail.Mode to none.

Network

It connects to: login.microsoftonline.com, management.azure.com, graph.microsoft.com, outlook.office365.com, <server>.database.windows.net

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/eps/Initialize-EpsMailSender.ps1 -OutFile Initialize-EpsMailSender.ps1
.\Initialize-EpsMailSender.ps1 -TenantId <TenantId> -SubscriptionId <SubscriptionId> -Sender <Sender> -Recipients <Recipients>

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

SHA-256 16338c80463d598a4cccf2ff04adcd18f3ab7f03cd407e6fd55fd75121993c5f

Checksums: SHA256SUMS.txt · Version 2.0.107 · Documentation for version 2.0.0

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

Every parameter: Get-Help .\Initialize-EpsMailSender.ps1 -Full · Source: Initialize-EpsMailSender.ps1

Every script, identity and permission for your security review: Entra Policy Suite

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