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

New-PimHybridWorkerInfra

PIM for Active Directory: build the hybrid worker's Azure side (or check an Azure Arc server)

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

Purpose

Builds the Azure side of the PIM for Active Directory hybrid worker -- its own resource group, network, deny-all firewall, NAT gateway egress and Windows VM -- or, for an Azure Arc-enabled on-premises server, checks the machine and builds nothing.

When to run it

Once per hybrid worker, first step. Azure VM worker: with -PeerVnetId and -DnsServers. On-premises worker: with -ArcMachineResourceId after the server is onboarded to Azure Arc. Deploy-PimHybridWorker.ps1 runs it for you.

Who may run it

KindRoleScopeWhy
azureRbacContributorthe worker's subscription (Azure VM); Reader on the Arc machine (Arc)creates the resource group, VNet, NSG, NAT gateway and VM; reads the Arc machine
azureRbacNetwork Contributorevery VNet the worker peers with (-PeerVnetId)the script creates both sides of each peering
azureRbacSQL Server Contributorthe PIM SQL server (-SqlServerId)the VNet rule for the worker subnet (Azure VM) or the firewall rules for -SqlAllowedPublicIp (Arc)

What it changes

WhereActionWhatPermission / roleScopeWhyUndo
Azure (Azure VM worker)createresource group, VNet + subnet (Microsoft.Sql and Microsoft.Storage service endpoints, DNS = your DCs), NSG with deny-all inbound, NAT gateway + its public IP (Set-PimHybridWorkerEgress.ps1), peerings in both directions, the VM (Windows Server 2022 Azure Edition Core, Trusted Launch, system-assigned identity, NO public IP), a SQL VNet rulethe worker's own isolated network and machine; the local admin password is generated, used once and discardeddelete the resource group, the remote peerings and the SQL VNet rule 'pimhybridwrk'
privatelink.database.windows.net (-PrivateSqlDnsZoneId / -PrivateDnsZoneResourceGroup)createa virtual network link 'link-pimhybridwrk-<vnet>' (tagged pim-hybrid-worker) to the worker VNet and each -PrivateDnsLinkVnetId; the standard zone itself only with -CreatePrivateDnsZone when missing; a DNS zone group on the SQL private endpoint only when its A record is missing and the endpoint has nonea private-only PIM database must resolve to its private address; the DCs' conditional forwarder is printed, never writtenRemove-PimHybridWorker.ps1 (the worker VNet's link); delete other links yourself
VNet peerings (-UseRemoteGateways / -AllowForwardedTraffic)updateuseRemoteGateways / allowForwardedTraffic on the worker-side peering; allowGatewayTransit on the hub side only when PIM created that peering (otherwise printed for the hub owner)DCs reached through a hub VPN / ExpressRoute gatewaySet-PimHybridWorkerPeering.ps1 cannot turn them off; set them in the portal, or remove the worker
PIM SQL server (Arc, -SqlAllowedPublicIp)createone firewall rule per on-premises egress address (pimhybridwrk-arc-<server>-<n>)an on-premises worker reaching a public SQL endpoint; not needed with a private endpointdelete those firewall rules

What it only reads

  • the subscription's tenant
  • what already exists (read-before-write): resource group, NSG, VNet, peerings, VM, SQL rules
  • the Arc machine (status, OS, identity)

Parameters

ParameterRequiredDefaultWhat it does
-SubscriptionIdyesThe worker's subscription (Azure VM) or the Arc machine's.
-TenantIdyesThe tenant; the script refuses a subscription in another one.
-ArcMachineResourceIdnoOn-premises worker: the Azure Arc machine's resource id. Builds nothing; checks it is connected, Windows and has an identity.
-ArcApiVersionno2024-07-10Microsoft.HybridCompute api-version.
-SqlAllowedPublicIpnoArc with a public SQL endpoint: the site's egress address(es).
-ResourceGroupnorg-pimhybridwrkAzure VM: the worker's resource group.
-LocationnowesteuropeAzure VM: the region (your choice).
-VmNamenoPIMHYBRIDWRKAzure VM: VM and computer name, max 15 characters.
-VmSizenoStandard_B2sAzure VM: the size (4 GiB recommended).
-VnetNamenovnet-pimhybridwrkAzure VM: the worker VNet.
-AddressPrefixno10.221.16.0/24Azure VM: VNet range (must not overlap the peered networks).
-SubnetPrefixno10.221.16.0/27Azure VM: the worker subnet.
-PeerVnetIdnoAzure VM (required there): the VNet(s) with the domain controllers, optionally the PIM environment's.
-DnsServersnoAzure VM (required there): the domain controllers' addresses.
-SqlServerIdnoThe PIM SQL server's resource id (VNet rule / firewall rules).
-EgressnoNatGatewayAzure VM: NatGateway, or None when your network routes outbound. Never a public IP on the VM.
-ImagenoMicrosoftWindowsServer:WindowsServer:2022-datacenter-azure-edition-core-smalldisk:latestAzure VM: the image (Publisher:Offer:Sku:Version).
-PrivateSqlDnsZoneIdnoPrivate-only PIM database: the EXISTING privatelink.database.windows.net zone (no other zone name is accepted). It is linked to the worker VNet (Azure VM) and to every -PrivateDnsLinkVnetId.
-PrivateDnsLinkVnetIdnoMore VNets to link the zone to: the DCs' VNet when the DCs are Azure VMs (Azure DNS answers from the zones linked to the ASKING DNS server's VNet), or the DNS Private Resolver's VNet (Arc / on-premises DCs).
-CreatePrivateDnsZonenofalseCreate the standard zone privatelink.database.windows.net ONLY when it is missing (with -PrivateDnsZoneResourceGroup or -PrivateSqlDnsZoneId); attaches it to the SQL private endpoint when that endpoint has no DNS zone group yet.
-PrivateDnsZoneResourceGroupnoWhere the standard zone lives (in -SubscriptionId), instead of -PrivateSqlDnsZoneId.
-PrivateSqlnofalsePrint the conditional forwarder the DNS administrator adds (implied by the zone options). PIM never writes AD / on-premises DNS.
-DnsForwarderIpno168.63.129.16 (Azure VM) / the Private Resolver inbound endpoint (Arc)The address the printed forwarder points at: 168.63.129.16 for DCs that are Azure VMs, an Azure DNS Private Resolver inbound endpoint for DCs on-premises.
-UseRemoteGatewaysnofalseAzure VM: DCs reached through the hub's VPN / ExpressRoute gateway -- the worker-side peering to -GatewayVnetId uses it (Set-PimHybridWorkerPeering.ps1; the hub must have a gateway and allow gateway transit).
-GatewayVnetIdnoAzure VM: the hub VNet with the gateway (one of -PeerVnetId).
-AllowForwardedTrafficnofalseAzure VM: the worker-side peering(s) accept traffic the hub forwards (an NVA / firewall in the hub).

Preview with -WhatIf

Prints every resource it would create (or, for Arc, the checks and the firewall rules) and changes nothing.

Undo

Remove-PimHybridWorker.ps1 deletes everything this script created (it carries the tag pim-hybrid-worker). By hand: Azure VM: delete the worker's resource group, the remote peerings '<remote>-to-pimhybridwrk', the SQL VNet rule 'pimhybridwrk' and the zone link. Arc: delete the pimhybridwrk-arc-* SQL firewall rules.

Network

It connects to: management.azure.com (ARM REST) and login.microsoftonline.com -- browser sign-in or an Invardia support session; no Azure CLI, no PowerShell module

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