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

Convert-PimToPrivate

Convert a public PIM Manager environment to private with one command

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

Purpose

Converts a public (external) PIM Manager environment to private (internal-only) in one command. It runs the conversion guide's steps in order by calling the existing setup scripts (safety copy, private registry, remove and redeploy or rebuild, verify from inside the network, registry public access off, optional custom name, optional private SQL with its public access off), checks each step before the next, records progress per tenant and resource group so -Resume continues after a stop or a failure, and stops with exit code 10 where your network team must act. Data is kept. It only prints the plan unless -Apply is given.

When to run it

Once, to move a public PIM Manager environment to private, in a maintenance window of about 1-2 hours (the PIM Manager and the engine are unavailable from the removal until the redeploy completes; active privileged access stays active). Read network-options.md first. Run it from the PIM Manager release package folder (Pro / trial: the signed package Install-Invardia downloaded for your installation; Community: the public repository at the release tag), on the machine that ran the original install when possible (its deploy profile holds the install's parameters). It stops at two points: when -SkipPeering is given (the hub owner creates the hub side of the peering) and before any public endpoint is closed (verify from inside the network); resume with -Resume -Apply and -HubSideDone or -ConfirmedFromInside.

Who may run it

KindRoleScopeWhy
azureRbacOwner, or Contributor + User Access Administratorthe PIM subscriptionThe steps it runs remove and recreate the Container Apps environment, the PIM Manager and the jobs, upgrade the registry and add private endpoints, and grant the new managed identities their Azure roles (AcrPull, Reader, Contributor for the updater).
azureRbacNetwork Contributorthe hub VNet (optional)Only when this run creates the peering and links the private DNS zone to the hub. With -SkipPeering the hub owner does it with the script New-PimHubPrepareScript.ps1 writes, and this run needs no right on the hub.
entraRolePrivileged Role AdministratortenantThe redeploy grants the new identities their Microsoft Graph application permissions and adds them to the role-assignable SQL admin group.
entraRoleApplication AdministratortenantSign-in (Easy Auth) is attached to the new private address: the existing sign-in app registration is reused and its reply address moved.
otherOne REST session for -TenantId: the Invardia Support app session for that tenant, or your own browser sign-inthe target tenant + subscriptionEvery step runs in this process and reuses the one session; a session of another tenant is refused. No Azure CLI, no PowerShell modules.

What it changes

WhereActionWhatPermission / roleScopeWhyUndo
Local machinecreatethe conversion state %LOCALAPPDATA%\pim\convert\<tenant>-<resource group>.json (parameters without secrets, the completed steps, the restore point) and the safety-copy capture folder of the same namethe current Windows userSo -Resume continues after a stop or a failure, and so the live app definitions are kept before anything is removed.Delete the file and the folder after the conversion is complete.
Azure (the PIM resource group)updatethe container registry: Premium, a private endpoint, the privatelink.azurecr.io zone and a build pool (New-PimHostingPrerequisites.ps1)the existing registry and VNetA private environment pulls images and builds updates over the private endpoint.The registry stays Premium (never downgraded); delete the private endpoint and the build pool in the portal if you go back to public.
Azure (the PIM resource group)removethe Container Apps jobs, the PIM Manager app and the Container Apps environment, and the role assignments of their system identities (Remove-PimContainerStack.ps1; route Redeploy)the resource group givenThe internal/external setting of a Container Apps environment cannot be changed.The next step recreates them; to go back to public, run Invoke-PimDeployAll.ps1 with the original deploy profile and -Apply.
Azure (the PIM resource group)createthe internal-only Container Apps environment, the PIM Manager, the engine, bootstrap and updater jobs, the peering to the hub and the private DNS zone for the new address (Invoke-PimDeployAll.ps1 -Exposure internal, or Rebuild-PimEnvInternal.ps1 on route Rebuild)the resource group given (the peering: the PIM VNet and, with the right, the hub VNet)The private environment, on the same subnet, SQL database and registry.Rebuild-PimEnvExternal.ps1 -Apply converts back to public (the address changes again).
Microsoft Entra IDgrantthe new managed identities' Microsoft Graph application permissions, Azure roles and database usersthe engine and PIM Manager permission sets of Invoke-PimDeployAll.ps1 (see its documentation page)the tenant / the PIM resource group / the PIM databaseRecreated apps get new managed identities; the grants of the old ones no longer match.Removed with the identities when the stack is removed again.
Azure (the PIM resource group)updateoptional: a custom host name with your certificate and its DNS record (Set-PimManagerCustomHost.ps1, with -HostName)the PIM Manager app and an existing private DNS zoneOne stable address that survives future rebuilds.Remove the custom domain from the app and the record from the zone.
Azure (the PIM resource group)createoptional: the SQL private endpoint and the privatelink.database.windows.net zone (New-PimHostingPrerequisites.ps1 -SqlPrivateEndpoint, with -SqlPrivate), then one deploy that saves the private values in the deploy profilethe SQL server and the PIM VNetStep 7 of the guide, done last, after the private PIM Manager is verified from inside.Delete the SQL private endpoint (turn the server's public network access back on first).
Azure (the PIM resource group)updatethe container registry's public network access OFF, after the check from inside (route Redeploy; the same change as Rebuild-PimEnvInternal.ps1 -LockRegistry on route Rebuild), read back. Refused unless the registry is Premium with an Approved private endpoint, the build pool is Succeeded in the VNet and the updater job carries PIM_ACR_AGENT_POOLthe existing registryA private environment pulls images and builds updates over the private endpoint and the build pool; the public endpoint is no longer needed.Turn the registry's public network access back on (portal).
Azure (the PIM resource group)updateoptional, the very last change: the SQL server's public network access OFF (Set-PimSqlPublicAccess.ps1 -Disable, with -SqlPrivate), refused unless the server has an Approved private endpointthe PIM SQL serverStep 7 of the guide: the database is reached through its private endpoint only.Set-PimSqlPublicAccess.ps1 -Enable -Apply.

What it only reads

  • the deploy profile and the conversion state on this machine
  • the subscription (visible, and in -TenantId)
  • the Container Apps environment and the PIM Manager (exposure, static IP, address)
  • the SQL database's point-in-time restore window
  • the registry (SKU, public access, private endpoint approval), its build pool and the updater job's PIM_ACR_AGENT_POOL (the registry lock)
  • whether this machine reaches the PIM Manager's private address (name resolution and TCP 443 only)

Parameters

ParameterRequiredDefaultWhat it does
-TenantIdyesThe PIM tenant. The REST session is pinned to it; a session or subscription of another tenant is refused.
-SubscriptionIdyesThe PIM subscription.
-ResourceGroupyesThe PIM resource group (the conversion state is kept per tenant and resource group).
-RoutenoRedeployRedeploy (guide Route B, default: remove the Container Apps stack and deploy it again internal-only from the install's parameters; grants everything the new identities need in one session) or Rebuild (guide Route A: capture, recreate and restore the live apps; keeps hand-made app changes, Windows only, the database users need a certificate identity afterwards).
-DeployProfilePathno%LOCALAPPDATA%\pim\deploy-profiles\<tenant>-<resource group>.jsonThe original install's saved parameters (written by Invoke-PimDeployAll.ps1 -Apply), or the file Invardia's wizard regenerated from your install answers. Values given on the command line win.
-Tagnothe profile's PrereqToken, else 'pim'A short label: the hosting prerequisites token and the capture file names.
-Locationnothe deploy profileThe Azure region of the environment.
-VnetNamenothe deploy profileThe existing PIM VNet.
-VnetResourceGroupno-ResourceGroupThe VNet's resource group. This command supports the VNet in the PIM resource group only (otherwise follow the guide's manual steps).
-SubnetNamenothe deploy profileThe existing Container Apps subnet.
-VnetAddressPrefixnothe deploy profileThe existing VNet range (the prerequisites script never invents an address plan).
-SubnetAddressPrefixnothe deploy profileThe existing Container Apps subnet range.
-AcrNamenothe deploy profileThe existing container registry.
-LogAnalyticsNamenothe deploy profileThe existing Log Analytics workspace.
-SqlServerFqdnnothe deploy profileThe existing SQL server, e.g. <server>.database.windows.net.
-SqlDatabasenoPimPlatformThe PIM database.
-EnvNamenocae-pimThe Container Apps environment.
-ManagerAppnoca-pim-managerThe PIM Manager app.
-PrivateEndpointSubnetNamenopim-endpointsThe private-endpoint subnet inside the PIM VNet (found or created).
-PrivateEndpointSubnetAddressPrefixnothe deploy profileA free range for that subnet inside the PIM VNet, e.g. 10.50.1.0/26. Required.
-AcrAgentPoolNamenopimbuildThe registry build pool (private builds; the updater job gets PIM_ACR_AGENT_POOL).
-HubVnetIdnoThe hub VNet resource id. Route Redeploy peers to it and links the private DNS zone; route Rebuild links the zone to each one given. Without it only the PIM VNet resolves the PIM Manager.
-SkipPeeringnofalseThe hub owner creates the hub side of the peering. The run STOPS at step 1 (exit 10) and prints the New-PimHubPrepareScript.ps1 command that writes the hub owner's script.
-DeployPrincipalObjectIdnoPassed to New-PimHubPrepareScript.ps1: the object id of whoever runs the conversion, so the hub owner's script grants it its rights on the hub.
-PrivateDnsResourceGroupnothe PIM resource groupWhere the private DNS zones go (same subscription).
-SkipPrivateDnsnofalseRoute Redeploy: do not create the private DNS zone for the new address (your own DNS answers for it).
-EasyAuthAllowedPrincipalsnoWho may sign in to the PIM Manager (groups / users). Default: the existing assignments are kept.
-EasyAuthAllowAllTenantUsersnofalseEvery member account in the tenant may sign in (never guests).
-HostNamenoOptional stable custom name for the PIM Manager (step 6), e.g. pim.contoso.local. Needs your certificate.
-KeyVaultNamenoWith -HostName: the Key Vault holding the certificate.
-KeyVaultCertNamenoWith -HostName: the certificate's name in that Key Vault.
-PfxPathnoWith -HostName: a PFX file instead of Key Vault.
-PfxPasswordnoThe PFX password (secure string; never saved in the state, pass it again on -Resume).
-HostDnsnoAutoWith -HostName: Auto, PrivateDnsZone, AdDns (prints the record for you to add) or None.
-HostDnsResourceGroupno-PrivateDnsResourceGroupWith -HostName: the resource group of your existing private DNS zone for that name.
-SqlPrivatenofalseStep 7, last: add the SQL private endpoint, save the private values in the deploy profile, then turn the SQL server's public network access off (Set-PimSqlPublicAccess.ps1; refused unless its private endpoint is Approved). Can be added later with -Resume -Apply -SqlPrivate.
-HubSideDonenofalseOn -Resume after stop point 1: the hub owner has run the script.
-ConfirmedFromInsidenofalseOn -Resume after stop point 2: the private PIM Manager was verified from inside the network (Confirm-PimInstall.ps1 run there).
-ReporternoOptional scriptblock called with one event per step: { step = { id; title }; state = started|ok|failed|waiting|skipped; message }.
-InvardiaInstallTokennoOptional: posts each step to Invardia's tracked installation (best effort; never fails the run).
-ResumenofalseContinue the recorded conversion after its last completed step (the first run's parameters fill everything not given again).
-ApplynofalseRun the steps. Without it (and always with -WhatIf) the script prints the full plan with each child command, signs in to nothing and changes nothing.

Preview with -WhatIf

Prints the resolved parameters (from the deploy profile and the command line), anything missing, and every step in the guide's order with the exact child command it would run (New-PimHubPrepareScript.ps1 for the hub owner, the capture, New-PimHostingPrerequisites.ps1, Remove-PimContainerStack.ps1, Invoke-PimDeployAll.ps1, Confirm-PimInstall.ps1, the registry lock with its refusal conditions, Set-PimManagerCustomHost.ps1, Set-PimSqlPublicAccess.ps1 -Disable), the two stop points, and 'PLAN ONLY -- nothing was signed in to and nothing was changed'. -WhatIf wins over -Apply.

Undo

Before -Apply nothing changes. After a stop or a failure: -Resume -Apply continues, or the printed rollback applies (route Redeploy: Invoke-PimDeployAll.ps1 with the original profile brings the public environment back; route Rebuild: Rebuild-PimEnvExternal.ps1 -Apply). The data is never touched; the point-in-time restore point is recorded in the state file.

Network

It connects to: login.microsoftonline.com (sign-in), management.azure.com (Azure Resource Manager), graph.microsoft.com (the steps that grant the new identities), <server>.database.windows.net:1433 (the steps that write database users and the profile deploy), the PIM Manager's private address on TCP 443 (the inside check), invardia.com (only with -InvardiaInstallToken)

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