DocumentationDataMigrate ProGetting started

DataMigrate ProGetting started

settings.json reference (DataMigrate Pro)

The settings.json reference explains every field of the file in DataMigrate Pro, how it is used at runtime, the defaults and when to use each option.

This document explains every field in settings.json, how the app uses it at runtime, defaults, and when to use each option. It’s based on the code in DataMigratePro.Core (notably DataConnectionManager, DataConnectionSettings, DataHandler, and related classes).

Where the file lives and how it’s used

  • Location: The app loads and saves settings.json from the executable directory (same folder as DataMigratePro.exe). It does not use the repository root during runtime.
  • Load: At startup of each invocation, DataConnectionManager.LoadDataConnectionSettings() reads settings.json and populates internal static values.
  • Save: When you pass certain CLI flags (e.g., --sqlconnection, -w, --tenantid/--clientid/--clientsecret), the app persists the updated values back to settings.json using SaveDataConnectionSettingsAsync().
  • Token cache: The OAuth access token for SaaS is persisted to token.json in the same executable folder with:
    • AccessToken (string)
    • TokenExpiresAt (UTC DateTime)

Quick start examples

Minimal SaaS example:

JSON
{
  "SqlConnectionString": "Data Source=SERVER;Initial Catalog=SOURCE_DB;Integrated Security=SSPI;",
  "SourceCompany": "CRONUS AG",
  "DestinationCompany": "MyCompany",
  "SourceDatabase": "SOURCE_DB",
  "MappingDatabase": "SOURCE_DB",
  "MigrationDatabase": "MigrationDB",
  "Environment": "Sandbox",
  "TenantInfo": {
    "TenantId": "<AAD_TENANT_GUID>",
    "ClientId": "<APP_REG_CLIENT_ID>",
    "ClientSecret": "<APP_REG_CLIENT_SECRET>"
  },
  "EndpointUrl": "https://api.businesscentral.dynamics.com/v2.0/<TENANT_GUID>/Sandbox/ODataV4/Upload_LoadData?company=MyCompany",
  "BlobMagicSignature": [2, 69, 125, 91],
  "IsSaaS": true,
  "EnableServiceBus": false
}

Minimal on‑prem example:

JSON
{
  "SqlConnectionString": "Data Source=SERVER;Initial Catalog=SOURCE_DB;Integrated Security=SSPI;",
  "SourceCompany": "CRONUS AG",
  "DestinationCompany": "MyCompany",
  "SourceDatabase": "SOURCE_DB",
  "MappingDatabase": "SOURCE_DB",
  "MigrationDatabase": "MigrationDB",
  "EndpointUrl": "http://bc-server:7048/BC/ODataV4/Upload_LoadData?company=MyCompany",
  "BlobMagicSignature": [2, 69, 125, 91],
  "IsSaaS": false,
  "BCUser": "DOMAIN\\User",
  "BCPassword": "<password>",
  "EnableServiceBus": false
}

Note: For listener mode (Service Bus), see the ServiceBus section below.

Field-by-field reference

The JSON object adheres to DataConnectionSettings. Property names are case-insensitive when loading.

SQL and databases

  • SqlConnectionString (string)
    • Purpose: Primary SQL Server connection string used throughout the app (e.g., mapping initializer, exports, queries).
    • On every start-up (CLI commands, -t listen, MCP server profile activation) the app creates the databases named in MappingDatabase and MigrationDatabase when they do not exist yet (both inherit the collation of SourceDatabase), and ensures the mapping tables inside the mapping database. The login therefore needs CREATE DATABASE permission on a fresh server; if creation fails, the error is logged and the start continues.
  • SqlConnectionStringMigration (string, obsolete)
    • This field is accepted only for backward compatibility and is no longer written by the app. Migration database access uses SqlConnectionString plus MigrationDatabase.
  • SourceDatabase (string)
    • Name of the source NAV/BC database (used by SQL builders and mapping initializer).
  • MappingDatabase (string)
    • Name of the database that hosts DataMigrate Pro’s mapping tables. Required for mapping operations; created automatically on start-up when missing.
  • MigrationDatabase (string)
    • Name of the auxiliary migration database used in helper procedures (e.g., generating transfer tables, schema cache, listener activity). Created automatically on start-up when missing.
  • SqlCommandTimeout (int, seconds; 0 = unlimited)
    • Applies to SQL commands via SqlCommand.CommandTimeout in various operations.

Business Central endpoint and companies

  • EndpointUrl (string)
    • Base OData endpoint for data upload: .../ODataV4/Upload_LoadData?company=<Company>.
    • The app derives two related endpoints by replacing _LoadData with:
      • _LogMessage for logging
      • _CommitTransaction for commit/finish
    • The company name at the end of the URL is also parsed and stored internally.
  • SourceCompany (string)
    • Logical source company (used in SQL and mapping placeholder replacements, e.g., {SourceCompany} or {Company}).
  • DestinationCompany (string)
    • Target BC company (used in placeholder replacements {DestinationCompany}).
  • Environment (string)
    • Business Central Online environment name, for example Sandbox or Production. The editor requires it only when IsSaaS = true.

Placeholders in mapping expressions: The app replaces {Company} and {SourceCompany} with SourceCompany, and {DestinationCompany} with DestinationCompany inside certain mapping expressions and SQL fragments.

Authentication and runtime mode

IsSaaS selects the object numbering, BCAuth selects how requests to Business Central authenticate:

JSON
"IsSaaS": true,            // numbering: true = AppSource IDs, false = on-premise IDs
"BCAuth": "Credentials",   // optional: "OAuth" | "Credentials"; absent = derived from IsSaaS
"BCUser": "admin",         // Credentials only; DOMAIN\User supported; empty = default (Windows) credentials
"BCPassword": "..."        // DPAPI-protected on first save
IsSaaS BCAuth Auth Numbering Endpoint auto-regeneration
true absent / OAuth Bearer via TenantInfo AppSource yes
true Credentials BCUser/BCPassword or default credentials AppSource no
false absent / Credentials BCUser/BCPassword or default credentials on-premise no
false OAuth Bearer via TenantInfo on-premise yes
  • IsSaaS (bool)
    • Object numbering only: true uses the SaaS/AppSource object IDs; false derives OnPrem = true and NewNumbering = true internally and uses the on-premise object range. OnPrem and NewNumbering are no longer written to settings.json.
  • BCAuth (string, optional)
    • OAuth: Azure AD OAuth (Bearer) using TenantInfo.
    • Credentials: BCUser/BCPassword as NetworkCredential (supports DOMAIN\\User), or default credentials when BCUser is empty.
    • Absent: IsSaaS = true → OAuth, IsSaaS = false → Credentials. Values are case-insensitive; any other value is rejected with an error when settings.json is loaded.
    • Endpoint auto-regeneration: with OAuth, EndpointUrl is rebuilt from TenantInfo.TenantId, Environment and DestinationCompany when all three are set. With Credentials, EndpointUrl is used as configured (e.g. a BC container or on-premise server with IsSaaS = true).
    • Written to settings.json only when set.
  • TenantInfo (object)
    • TenantId (string, GUID)
    • ClientId (string)
    • ClientSecret (string)
    • Used to fetch and cache OAuth tokens from Azure AD. Tokens are stored in token.json and reused until ~5 minutes before expiration.
  • BCUser (string) and BCPassword (string)
    • Only relevant when BCAuth resolves to Credentials. If provided, the app uses these credentials for HTTP requests. If omitted, default/network credentials may be used by the underlying HTTP handler depending on environment configuration.
  • DemoTarget (bool, default false)
    • Set by the demo mode (DataMigratePro --demo or Demo setup… in the configuration editor). When true, the Business Central target is the managed demo sandbox: TenantInfo, Environment, IsSaaS = true, BCAuth = OAuth and EndpointUrl are applied in memory on every load from the compiled-in vendor identity and are removed from the file on every save (together with BCUser/BCPassword). Only DestinationCompany (the demo company) and the SQL settings are persisted.
    • The configuration editor hides the tenant, endpoint and authentication fields while DemoTarget is true and shows a read-only Demo target row instead. Switching Use demo target off clears the managed fields so your own tenant can be entered.
    • The compiled-in demo registration key is only accepted while DemoTarget is true.
    • Written to settings.json only when true. See docs/DataMigratePro-Demo-Mode.md.

Timeouts

  • SQL command timeout (SqlCommandTimeout)

    • Type: integer seconds; 0 disables the limit.
    • Where applied: Assigned to SqlCommand.CommandTimeout across SQL operations (e.g., query execution, configuration changes).
    • How to set: Either directly in settings.json or via CLI --sqlcommandtimeout <seconds>; persisted to settings.json.
  • Bulk copy timeout

    • SqlBulkCopy.BulkCopyTimeout is set to 0 (no limit) in code and is not configurable via settings.json.
  • Service Bus and service lifecycle

    • The Service Bus receiver uses short polling intervals (e.g., ReceiveMessageAsync(TimeSpan.FromSeconds(1))). These are internal and not configurable via settings.json.
    • The Windows Service shutdown waits up to ~30 seconds for tasks to complete; this is not configurable via settings.json.

Mapping editor: target structure change check

  • TargetStructureCheckIntervalMinutes (int, minutes, default 5; 0 disables the check)
    • Purpose: While the mapping editor (--editmode) is open, it downloads the Business Central structure via getstructure every N minutes in the background, computes a fingerprint over the normalized BC Table/BC Field records and compares it with the fingerprint stored at the last full structure refresh ([DMP BC Structure State] in the mapping database).
    • Behavior: When the structure differs, a hint with remote/local table and field counts and a Reload BC structure now link appears in the navigation panel above the Propagation Log tile; the link runs Mapping functions › Refresh BC structure. Checks are skipped while an editor action is running; connectivity problems are logged locally and never hide an existing hint.
    • Baseline: After a partial update of BC Table/BC Field (for example Build single mapping from BC structure or the standard-API/legacy download) the stored fingerprint is marked unknown and the next check records the current remote structure as the new baseline without a hint.
    • Serialization: Always written to settings.json so an explicit 0 survives a save from the Configuration editor.

Transfer behavior

  • ForceSequentialPutDataChunks (bool, default false)
    • Purpose: Forces sequential putdata chunk sending for all tables by setting effective chunk parallelism to 1.
    • Scope: Applies to both putdata and putalldata transfer paths.
    • Precedence: Overrides CLI --parallel / -parallel values.
    • Identity tables: Identity/autoincrement tables remain sequential regardless of this setting.

Binary data and BLOB handling

  • BlobMagicSignature (byte[])
    • A small magic byte signature expected at the start of serialized BLOB payloads. Default if not provided: 2, 69, 125, 91.
    • Used by NAVBlobReader and in data upload paths to recognize BLOB payload framing.

Integration: Azure Service Bus (listener mode)

  • EnableServiceBus (bool)
    • Set to true only when this installation should run listener mode (-t listen) or listener-backed file-service, printer, and remote PowerShell processing.
    • When false, the MappingEditor does not require Service Bus values and hides the queue, file-service, and PowerShell settings.
    • Printer discovery and listener startup are rejected when this flag is false.
  • ServiceBus (object)
    • ServiceBusConnectionString (string)
    • RequestQueueName (string)
    • ResponseQueueName (string)
    • connectionId (string)
    • Usage: Required only when EnableServiceBus = true and the listener-backed features are activated.
    • Validation: ServiceBusSettings.Validate() throws informative errors if any required property is missing.

Listener behavior is implemented in ServiceBusListener. Registration flows can also populate these Service Bus values automatically after a successful registration handshake.

Integration: McpRelay (remote MCP access through the listener)

  • McpRelay (object, optional; requires EnableServiceBus = true)
    • Enabled (bool, default false) – answer mcp.* commands from the DataMigrate Pro MCP gateway in Azure; without it every such command is answered with Mcp.Disabled.
    • ReplyQueueName (string, default mcp-replies) – session-enabled queue in the same namespace; the listener's SAS policy needs Send on it.
    • AllowWrite, AllowMigration, AllowSourceProfiling, AllowSourceQuery (bool, default false) – same meaning as the --allow-* switches of DMP.McpServer, enforced on this machine.
    • AllowGatewayApproval (bool, default false) – accept approvals the human confirmed through the AI client (mcp.approve); otherwise write tools need the token file in <DataDirectory>\approvals.
    • SyncWaitSeconds (int, 0–20, default 3), MaxJobs (int, 1–32, default 4), JobRetentionSeconds (int, 60–86400, default 1800), ReplyTtlSeconds (int, 30–3600, default 300).
    • DataDirectory (string, optional) – jobs, approvals, audit log and output files of the in-process MCP server (default %LOCALAPPDATA%\DataMigratePro\mcp\relay).
    • AllowedPaths (string[], optional) – additional directories the MCP file tools may read/write.
    • Validation: McpRelaySettings.Validate() runs when the first relay command arrives and Enabled is true. Details: MCP-Remote-Access.md.

Integration: serviceSchedule (service-scheduled execution)

  • serviceSchedule (object)
    • CommandArguments (string)
    • StartDate (DateTime, optional, example: 2026-07-01)
    • EndDate (DateTime, optional, example: 2026-12-31)
    • RecurringType (string, required when using the scheduler; supported values: Interval, Once)
    • RecurringInterval (TimeSpan, required for interval-based runs, example: 01:00:00)
    • StartingTime (TimeSpan, optional, example: 18:00:00)
    • EndingTime (TimeSpan, optional, example: 06:00:00)
    • Days (string, optional, comma-separated day tokens such as Mo,Tu,We,Sa,Su)
    • Usage: When present, the launcher can host a Windows service that executes the configured DataMigrate Pro command on a timer inside the defined date, day, and time window.
    • Overnight windows are supported. If StartingTime is later than EndingTime, the allowed window is treated as crossing midnight.

Example:

JSON
{
  "ServiceSchedule": {
    "CommandArguments": "-t putalldata --tablegroup \"1,2,3,4,5\" --changesonly 1",
    "StartDate": "2026-07-01",
    "EndDate": "2026-12-31",
    "RecurringType": "Interval",
    "RecurringInterval": "01:00:00",
    "StartingTime": "18:00:00",
    "EndingTime": "06:00:00",
    "Days": "Mo,Tu,We,Sa,Su"
  }
}

AppSource and on-prem compatibility

  • AppSourceEnabled is always treated as enabled internally and is no longer written to settings.json.
  • OnPrem and NewNumbering are derived from IsSaaS and are no longer written to settings.json.

Reconciliation (-t reconcile, OData mode only)

Optional section Reconciliation with the published OData page web service names (GlEntriesService, CustomerLedgerEntriesService, VendorLedgerEntriesService, DetailedCustomerLedgerEntriesService, DetailedVendorLedgerEntriesService, VatEntriesService for the vatbalance report, ItemLedgerEntriesService for inventoryqty, ValueEntriesService for inventoryvalue) and the open-item tuning values OpenItemFilterBatchSize (default 50) and OpenItemFullScanThreshold (default 2000). Only used when the Business Central side is read via --target odata (or the auto fallback). Field-by-field description: DataMigratePro-Reconciliation-Dokumentation.md.

LedgerCutoff (cutover decision file)

Optional section LedgerCutoff with CutoverSettingsPath: path of the cutover decision file cutover-settings.json (relative paths are resolved against the folder of settings.json; default cutover-settings.json next to settings.json). The file holds the department decisions for the ledger/inventory/fixed-asset cutoff (template: cutover-settings.example.json, description of every setting: DataMigratePro-LedgerCutoff-Handbuch.md). --cutoversettings <path> overrides the path, --setting section.key=value[;...] overrides single values for one run; -t ledgercutoffsettings --validate|--show|--export|--example manages the file.

How CLI flags map to settings.json

When you pass any of the following flags, the app loads current settings, applies your updates, and persists back to settings.json in the executable folder.

  • --sqlconnection → SqlConnectionString
  • --sqlconnectionmigration → accepted for compatibility, but no longer persisted
  • --tenantid/--clientid/--clientsecret → TenantInfo
  • -w → EndpointUrl (also updates derived commit/log endpoints and internal company name)
  • --sourcecompany → SourceCompany
  • --sourcedatabase → SourceDatabase
  • --sqlcommandtimeout → SqlCommandTimeout
  • --blobmagicsignature "2, 69, 125, 91" → BlobMagicSignature (comma-separated list of bytes)

Run-only overrides (never persisted)

The following flags override the corresponding settings.json values for the current process only. They are never written to settings.json, and a run that persists other flags (for example --sqlcommandtimeout) still writes the original file values for these fields.

  • --environment → overrides Environment
  • --destinationcompany → overrides DestinationCompany
  • --mappingdatabase → overrides MappingDatabase
  • --migrationdatabase → overrides MigrationDatabase

Effect on the Business Central endpoint when --environment and/or --destinationcompany are given:

  • BCAuth = OAuth (SaaS) with a TenantInfo.TenantId: the canonical endpoint https://api.businesscentral.dynamics.com/v2.0/{TenantId}/{Environment}/ODataV4/Upload_LoadData?company={DestinationCompany} is built from the effective values.
  • Otherwise (on-prem / BCAuth = Credentials): the configured EndpointUrl is rewritten — --environment replaces the path segment directly before ODataV4 (the server instance, e.g. BC230), --destinationcompany replaces the company= query value. Other query parameters are kept. Example: https://host:7048/BC230/ODataV4/Upload_LoadData?company=CRONUS with --environment BC240 --destinationcompany "CRONUS AG" becomes https://host:7048/BC240/ODataV4/Upload_LoadData?company=CRONUS%20AG.
  • If the configured URL has no ODataV4 segment, a warning is logged and the URL stays unchanged.

The log, commit and file-system-commit endpoints are derived from the effective endpoint. The overrides survive internal settings reloads during the run, and a --mappingdatabase/--migrationdatabase override also re-targets the schema cache. The mapping editor, listener and scheduled service use the overrides process-wide when started with these flags; they are not applied per received listener command.

Notes:

  • IsSaaS, BCAuth, BCUser, BCPassword, EnableServiceBus, and ServiceBus are not set by CLI flags; configure these directly in settings.json (or via registration for Service Bus values).
  • ServiceSchedule is also configured directly in settings.json and is consumed by the service-scheduled execution mode.
  • On start, if both SqlConnectionString and MappingDatabase (persisted or overridden) are present, the app tries to initialize the mapping database tables automatically.

Security notes

  • ClientSecret, BCPassword, and ServiceBusConnectionString are sensitive. They are stored in plain text within settings.json. Restrict file access appropriately.
  • token.json stores a valid OAuth access token and its expiry. Treat it as sensitive and avoid committing it to source control.

Troubleshooting tips

  • No settings.json found: You can create it manually (using the examples above) or run the app once with connection CLI flags to have it written.
  • SQL mapping init fails: Ensure the SQL Server is reachable and the user has rights to create tables in MappingDatabase.
  • SaaS auth issues: Check TenantInfo values, ensure the AAD app has the correct permissions for Business Central, and that BCAuth resolves to OAuth (BCAuth = "OAuth", or absent with IsSaaS = true).
  • On-prem auth issues: Verify EndpointUrl points to your server, BCAuth resolves to Credentials (BCAuth = "Credentials", or absent with IsSaaS = false), and BCUser/BCPassword are correct (include domain when needed).
  • Listener mode errors: Set EnableServiceBus = true and make sure all ServiceBus properties are valid; the app validates and will report which value is missing.