Copy-PimSettings
Copy settings from one PIM Manager environment to another
Part of the PIM Manager release - not a standalone download; it runs via the product's own install command or the updater.
Purpose
Copies named PIM Manager settings (for example the naming conventions) from one environment's store to another environment's store: it reads both, shows the difference, backs up the target's current value, and only with -Apply overwrites it and reads it back.
When to run it
When a new or rebuilt environment should start from settings that are already right in another environment (for example a managing tenant's naming conventions for a managed tenant). Settings that name the environment itself (who may use it, break-glass state, trust pins, store pointers, licence, environment name, demo mode) are refused.
Who may run it
| Kind | Role | Scope | Why |
|---|---|---|---|
| other | Source store reader (application with a certificate, member of the source SQL admin group) | the source environment's SQL database (pim.Settings) | Reads the setting from the source store. The identity is given with -FromClientId / -FromCertThumbprint and its certificate must be in the local machine certificate store. |
| other | Target store writer (application with a certificate, member of the target SQL admin group) | the target environment's SQL database (pim.Settings) | Reads the target's current value and, with -Apply, writes the new one. Given with -ToClientId / -ToCertThumbprint. |
What it changes
| Where | Action | What | Permission / role | Scope | Why | Undo |
|---|---|---|---|---|---|---|
| Target environment SQL database | update | pim.Settings row for each -Name (one JSON document per setting) | the target environment only | The point of the script: the target gets the source's value (with -MergeKeys, the source's top-level keys plus the keys only the target has). | Run the script again with -From and -To swapped, or import the TARGET-BEFORE backup file it wrote. | |
| Local temp folder | create | <Name>-SOURCE-<time>.json and <Name>-TARGET-BEFORE-<time>.json backups in -BackupDir (default: <temp>\pim-settings-copy) | this computer | The target's value before any change, so it can be restored; taken on every run, also a dry run. | Delete the backup files. |
What it only reads
- pim.Settings in the source store (the named settings)
- pim.Settings in the target store (the named settings, before and after the write)
Parameters
| Parameter | Required | Default | What it does |
|---|---|---|---|
| -Name | yes | The setting(s) to copy, e.g. NamingConventions. There is no 'copy everything'. | |
| -FromServer | yes | The source store's SQL server (FQDN). | |
| -FromDatabase | no | PimPlatform | The source database. |
| -FromTenantId | yes | The source tenant id. | |
| -FromClientId | yes | Application (client) id of the identity that reads the source store. | |
| -FromCertThumbprint | yes | Thumbprint of that identity's certificate in the local machine store. | |
| -ToServer | yes | The target store's SQL server (FQDN). | |
| -ToDatabase | no | PimPlatform | The target database. |
| -ToTenantId | yes | The target tenant id. | |
| -ToClientId | yes | Application (client) id of the identity that writes the target store. | |
| -ToCertThumbprint | yes | Thumbprint of that identity's certificate in the local machine store. | |
| -BackupDir | no | <temp>\pim-settings-copy | Where the backups are written before anything changes. |
| -MergeKeys | no | false | For an object setting: keep the top-level keys only the target has (the source's keys win). Arrays and plain values are replaced whole. |
| -Apply | no | false | Write. Without it the script only shows what would change. |
Preview with -WhatIf
Reads both stores, prints the source and target values and 'What if: Performing the operation "overwrite with the source value" on target "pim.Settings['<Name>'] in <server>/<database> (tenant <id>)"'. Nothing is written to either store; a backup in the temp folder is still taken, a backup elsewhere is only announced.
Undo
Run the same command with the From and To values swapped (it restores the previous environment's value), or write back the TARGET-BEFORE backup file. The local backups can be deleted.
Network
It connects to: login.microsoftonline.com (tokens for Azure SQL, certificate sign-in), <source server>.database.windows.net:1433, <target server>.database.windows.net:1433
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