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

PIM Manager scripts

Invoke-PimMspBuild

Build a managing or managed tenant (MSP build)

Part of the PIM Manager release - not a standalone download; it runs via the product's own install command or the updater.

Purpose

Build a managing tenant (an MSP's own PIM Manager that publishes a signed baseline) or a managed tenant (a customer's PIM Manager that pulls it) end to end from one configuration file of ids and names. Without -Apply it only prints the plan.

When to run it

When an MSP sets up its managing tenant, and when a managed tenant is set up (the guided install runs it for a managed tenant with an enrollment key). Order: build the managing tenant, build the managed tenant (it prints its subnet id), add that id to the managing tenant's config and re-run -From network-<n>. Run it without -Apply (or with -WhatIf) first.

Who may run it

KindRoleScopeWhy
azureRbacOwnerthe target subscriptionThe hosting step creates the resources and assigns Azure roles to the identities (Contributor + User Access Administrator is the equivalent).
entraRolePrivileged Role AdministratortenantMicrosoft Graph application permissions for the tick, Manager, publish and pull identities; members of the role-assignable SQL admin group. Global Administrator also works.
entraRoleApplication AdministratortenantThe Manager's sign-in app registration and the Invardia Support app's ownerships (Application.ReadWrite.OwnedBy).
entraRoleGroups AdministratortenantThe SQL admin group and the Manager's members group.
exchangeExchange AdministratorExchange Online (optional)Only when the mail sender is provisioned by this build.
otherSigned in to az as yourself (no deployIdentity in the config), or the certificate deploy identity named in the configthe tenant and subscription in the configThe build refuses another tenant, another subscription, a signed-in service principal, and any variable that would make a step authenticate as somebody else. The config may hold no secret.

What it changes

WhereActionWhatPermission / roleScopeWhyUndo
Invardiacreatethe enrollment of this managed tenant (only with an enrollment key; step enroll)Invardia creates the environment, signs the licence, issues an install key and returns the managing tenant's bundle address and signing key ids.Ask the managing company / Invardia support to remove the environment.
Azurecreatethe whole hosting (step hosting = Invoke-PimDeployAll.ps1 -Scenario S3 or S6): resource group, network, registry, Log Analytics, SQL, Container Apps environment, the Manager, the tick / bootstrap / updater jobs, the sign-in app, the SQL admin group, schema, mail sender, codeEach tenant runs its own PIM Manager in its own subscription.Delete the resource group; see https://invardia.com/docs/pim/scripts/Invoke-PimDeployAll/ for every object.
Azurecreatetenant Key Vault + the bootstrap identity's read grant (step keyvault, only when keyVaultName + bootstrapAppId are set)The managing tenant's own vault.Delete the vault (soft-delete applies).
Entra IDgrantthe build's own identity: the certificate application in certificate mode, the signed-in administrator in signed-in mode (step sqlgroup; Initialize-PimSqlAdminGroup.ps1). The Invardia Support app is never added as the Support app; the tick and the Manager use their own least-privilege database usersmember of grp-pim-sql-admins (members/$ref)the SQL admin groupThe build's store steps (access, scenario, licence, registry and the end-of-install check) run as that identity.Remove it from the group. Certificate mode: the build's last step (sqlgrouprelease) removes its own membership and reads it back; on by default (the config's releaseOwnBuildMembership = false keeps it).
Microsoft Graphgrantthe tick identity (engine set) and the Manager identity (read-only set) (step access; Initialize-PimHostingAccess.ps1)Microsoft Graph application permissions: the engine set incl. RoleManagement.ReadWrite.Directory, AppRoleAssignment.ReadWrite.All, Application.Read.All, RoleManagement.ReadWrite.Defender, DeviceManagementRBAC.ReadWrite.All, AccessReview.Read.All (appRoleAssignments); the read-only set for the Manager; never a tenant-wide Mail.SendtenantThe engine applies access; the Manager reads.Remove the app role assignments.
Azure RBACgrantthe Manager identityContainer Apps Jobs Operatorthe tick jobThe Manager may start the engine (Run now / commit).Remove the role assignment.
Azure RBACgrantthe Manager identity (step access; Initialize-PimHostingAccess.ps1; verified and repaired by the end-of-install check)Readerthe PIM resource group onlyThe Environment report reads the installation's own architecture (apps, jobs, registry, SQL, Key Vault, network).Remove the role assignment (the Environment report then shows the architecture as not readable).
Azure RBACgrantthe tick identityReader (+ User Access Administrator only when opted in)tenant root management groupAzure discovery across subscriptions.Remove the role assignment.
Azure SQLupdatepim.Settings SchedulerTickJobId, the scenario, the licence + install key (steps access, scenario, licence; Set-PimScenario.ps1, Set-PimLicense.ps1)The environment knows its engine job, its role in the MSP pair and its licence.Change them in Settings.
Azure SQLgrantthe Invardia Support app (step supportaccess when support.appId is set; Grant-PimSupportAccess.ps1)a contained database user (CREATE USER) in the read role pim_support_read only, at every level; setup: also admin rights (db_owner) inside an open support session only, at most 8 hours. No SQL admin group membership and no owner entry on PIM's app registrations or groupsthe PIM databaseInvardia support can help (and at 'setup' repair inside a support session).Grant-PimSupportAccess.ps1 -Remove.
Azure SQLcreatemanaging tenant registry schema: platform.Tenants, pim.CentralAdmins, targeting columns; one row per managed tenant with its ring and tags (steps registry, register-<n>; Initialize-PimMasterRegistry.ps1, Register-PimManagedTenant.ps1)Which tenants the managing tenant publishes to.Remove the tenant rows in the Manager.
Azurecreatemanaging tenant: storage service endpoint on its subnet, the signed-baseline storage account + container (anonymous blob read; its own subnet allowed, then firewall Deny), a storage network rule per managed tenant subnet (steps publishnetwork, storage, network-<n>; New-PimBaselineStorage.ps1, Set-PimBaselineNetworkAccess.ps1)Public-but-signed: managed tenants read the bundle over a network the firewall names; trust is the signature.Delete the storage account; remove the network rules.
Azure RBACgrantthe publish job's managed identity (and the signed-in builder for the first upload)Storage Blob Data Contributorthe baseline containerThe publish job writes the signed bundle.Remove the role assignment.
Azurecreatea non-exportable RSA signing key in Key Vault (step signingkey; New-PimBaselineSigningKey.ps1); the key id is printed for the managed tenants to pinThe bundle is signed; managed tenants refuse a bundle that does not verify.Disable / delete the key (managed tenants then refuse new bundles).
Azure RBACgrantthe publish job's managed identity (and the builder to read the key)Key Vault Crypto User (Key Vault Reader for the builder; Key Vault Administrator or Key Vault Crypto Officer are what the person needs to create the key)the signing key / vaultThe publish job signs with the key; nobody can export it.Remove the role assignments.
Azurecreatethe publish job ca-pim-publish (daily + on demand, system identity) and its first run (steps publishjob, publish; Deploy-PimBaselinePublishJob.ps1, Start-PimBaselinePublish.ps1)The managing tenant publishes the signed baseline in the cloud, no signing host.Delete the job.
Azure SQLgrantthe publish job's identitya database user with db_datareader (db_datawriter / db_ddladmin / db_owner are refused for it)the managing tenant's PIM databaseIt reads what to publish, nothing else.DROP USER for the publish job.
Azurecreatemanaged tenant: storage service endpoint on its subnet (the subnet id is printed for the managing tenant), the pull job (plain blob URL, signature-verified, system identity) with AcrPull on the registry (steps pullnetwork, downlink; Initialize-PimBaselinePullNetwork.ps1, Deploy-PimDownlinkJob.ps1)The managed tenant pulls the bundle; retraction is report-only.Delete the pull job; remove the service endpoint.
Microsoft Graphgrantthe pull job's managed identitythe engine set of Microsoft Graph application permissions (incl. RoleManagement.ReadWrite.Directory) + member of grp-pim-sql-adminstenant / the SQL admin groupIt applies the managing tenant's baseline in this tenant.Remove the app role assignments and the membership.
Azurecreateprivate networking options (only when configured): the SQL build window AllowSetupHost (opened and closed by the build), a private endpoint for the bundle store, privatelink DNS (Set-PimSqlBuildWindow.ps1, Set-PimBaselinePrivateEndpoint.ps1, Initialize-PimBaselinePrivateDns.ps1, Close-PimSqlSetupHostRule.ps1)Private stores are reached only while the build needs them.Remove the private endpoint / DNS records; the firewall rule is removed by the build's last step.
Invardiaupdateself-service managed tenants: the bundle facts (address, signing key ids) and a managed tenant's pull subnet id (steps enrollment, enrollreport; Publish-PimEnrollmentFacts.ps1)Invardia hands them to the other side of the pair.Ask Invardia support.

What it only reads

  • The config (validated: no key or value may look like a credential), the plan (engine/msp/PIM-MspBuild.ps1), the signed-in identity (az account show, a token's tenant and user-ness), the managed identities' object ids when a step needs them, the running Manager image on a resume.
  • Directory roles named only to say who must run a step it cannot: Global Administrator, Privileged Role Administrator, Application Administrator, Groups Administrator, Exchange Administrator.
  • The end-of-install check (Confirm-PimInstall.ps1) reads every result back; a required line that would fail ends the build with its fix.

Parameters

ParameterRequiredDefaultWhat it does
-RoleyesMaster (managing tenant, S3) or Slave (managed tenant, S6).
-ConfigPathyesThe build config: ids and names only (no secret is accepted).
-ApplynofalseBuild. Without it (or with -WhatIf) the plan and the operator steps are printed.
-FromnoResume at this step id.
-UpdateSourceUrlnoThe release feed URL template (a credential: never printed or saved).
-UpdateSourceUrlFileno$env:PIM_UPDATE_SOURCE_URL_FILEA one-line file holding the release feed URL.
-EnrollmentKeynoManaged tenant: the Invardia enrollment key (never printed or stored).
-InvardiaBaseUrlnohttps://invardia.comInvardia address for the enrollment.
-EnrollmentTimeoutSecondsno900How long to wait for the signed licence.
-ImageTagnothe config's imageTag, else the running image on a resumeThe image tag the build uses.
-InvardiaInstallTokenno$env:INVARDIA_INSTALL_TOKENTracked install: every step is reported to Invardia.
-InvardiaInstallEventsUrlnohttps://invardia.com/api/install/eventsWhere tracked steps are reported.
-OnStepnoCallback per step event (the guided install's reporter).
-ResumeCommandnoThe one resume line shown when a step fails (the guided install / Invardia's bootstrap): the failure is then told in three parts, without the operator steps.
-ReleaseOwnBuildMembershipnoonCertificate mode: the build's own identity leaves the SQL admin group at the end of the build (step sqlgrouprelease; only that membership, read back). On by default; the config key releaseOwnBuildMembership = false keeps the membership. A later resume that needs the store then starts at -From sqlgroup.

Preview with -WhatIf

Prints the plan (every step with the script it runs, NOT RUNNABLE steps with the reason), the operator steps, and one 'What if:' line per step naming what it would change and in which tenant and subscription. -WhatIf wins over -Apply: no claim at Invardia, no sign-in, nothing created or granted. Each step's own script can be previewed with its -WhatIf.

Undo

Delete each tenant's resource group (export the database first) and the Entra objects the hosting step created; on a managing tenant also the baseline storage, the signing key and the publish job, and the managed tenants' rows; Grant-PimSupportAccess.ps1 -Remove for the Invardia Support app. See each change's undo.

Network

It connects to: management.azure.com, graph.microsoft.com, login.microsoftonline.com, <server>.database.windows.net (TCP 1433), <storage>.blob.core.windows.net (the signed baseline), <vault>.vault.azure.net (the signing key), invardia.com (enrollment, enrolled-tenant facts, tracked install), the Azure CLI extension index (azcliextensionsync.blob.core.windows.net): az installs its 'containerapp' extension once when missing (hosting step) -- az's own download, checked against the index's sha256

How it runs

Part of the PIM Manager release - not a standalone download; it runs via the product's own install command or the updater.

Release 3.0.70

Every script, identity and permission for your security review: PIM Manager

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