xg env add
xg env add
Section titled “xg env add”Synopsis
Section titled “Synopsis”xg env addDescription
Section titled “Description”xg env add opens an interactive wizard that collects all the information needed to register a new Dataverse environment with XrmGhost.
The wizard prompts you for the following details in sequence:
- Friendly name — a short, unique label used to reference this environment in other
xg envcommands (e.g.activate,delete,refresh). Must not be empty; uniqueness is enforced by the service layer. - Environment URL — the full HTTPS URL of your Dynamics 365 / Dataverse organisation (e.g.
https://myorg.crm.dynamics.com). Must be a valid absolute HTTP/HTTPS URL. - Authentication method — currently fixed to Client Secret (the only supported method). Displayed for informational purposes.
- Client ID — the Application (Client) ID of the Azure AD app registration used for authentication.
- Client Secret — the client secret for the Azure AD app registration. Input is masked. Must not be empty.
- Metadata cache lifecycle — how long XrmGhost keeps Dataverse metadata cached for this environment. Choose from a preset list or enter a custom duration.
After the wizard completes, the environment configuration is saved and the client secret is stored securely in the platform credential store (Windows Credential Manager on Windows, or an equivalent secure store on other platforms).
License requirement:
xg env addrequires a Pro license tier. Running it without a valid Pro subscription will produce an error before the wizard starts.
Interactive-only mode
Section titled “Interactive-only mode”xg env add is fully interactive — there are no non-interactive flags to pre-fill values. All inputs must be entered at the terminal prompt. Scripted or CI usage is not supported for this command.
Metadata cache lifecycle presets
Section titled “Metadata cache lifecycle presets”The wizard offers the following preset durations. Select Custom to enter a value manually.
| Preset | Duration |
|---|---|
1 hour | 1 hour |
4 hours | 4 hours |
1 day | 24 hours |
1 week (default) | 7 days |
2 weeks | 14 days |
1 month | ~30 days |
Custom | User-specified (see format below) |
Custom duration format: a positive integer followed by a unit suffix — m (minutes), h (hours), or d (days). Examples: 30m, 12h, 3d.
Options
Section titled “Options”xg env add accepts no command-line flags or arguments. The entire configuration is gathered through the interactive wizard.
| Flag | Type | Description |
|---|---|---|
| (none) | — | This command has no flags. All input is interactive. |
Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
0 | Environment added successfully. |
1 | Wizard cancelled, required information was missing, or a duplicate friendly name was supplied. |
-1 | License tier check failed (Pro license required). |
Examples
Section titled “Examples”Add a new environment (basic)
Section titled “Add a new environment (basic)”xg env addLaunch the wizard and follow the prompts to register a new Dataverse environment. After completing all steps, the environment is available immediately for use with other xg env commands.
Add an environment and verify it was registered
Section titled “Add an environment and verify it was registered”xg env addxg env listRun xg env add to register the environment, then run xg env list to confirm it appears in the list of configured environments.
See Also
Section titled “See Also”xg env list— list all registered Dataverse environmentsxg env edit— update the configuration of an existing environmentxg env delete— remove a registered environment- CLI Overview