Skip to content

xg env list

Display a table of all Dataverse environment configurations registered with the XrmGhost CLI. For each environment the command shows its friendly name, environment URL, authentication method, client application ID, metadata cache lifecycle, and whether it is currently active.

License requirement: This command requires a Pro license tier. Running it with a lower-tier license prints an error and exits with code -1.

xg env list

xg env list reads the local environment configuration store (d365_environments.json) and renders a rich console table with one row per registered environment. The environments are sorted alphabetically by friendly name.

The currently active environment — the one used automatically by commands such as xg run when no explicit environment is specified — is highlighted with a green * marker in the Active column.

If no environments are registered yet, the command prints an informational message and exits with code 0.

ColumnDescription
Active* (green) for the currently active environment; empty otherwise
Friendly NameHuman-readable label assigned when the environment was added
Environment URLThe Dynamics 365 / Dataverse organisation URL (e.g., https://myorg.crm.dynamics.com)
Auth MethodAuthentication method configured for this environment (currently ClientSecret)
Client IDAzure AD application (client) ID used to authenticate
Cache LifecycleHow long the local Dataverse metadata cache is considered valid before a refresh is triggered

This command has no options or flags.

CodeMeaning
0Command completed successfully (including the empty-list case)
-1License tier insufficient (Pro license required)

List all environments (two environments registered, one active)

Section titled “List all environments (two environments registered, one active)”
$ xg env list
Registered Dynamics 365 Environments
┌────────┬──────────────────┬─────────────────────────────────────────┬───────────────┬──────────────────────────────────────┬─────────────────┐
│ Active │ Friendly Name │ Environment URL │ Auth Method │ Client ID │ Cache Lifecycle │
├────────┼──────────────────┼─────────────────────────────────────────┼───────────────┼──────────────────────────────────────┼─────────────────┤
│ * │ Production │ https://contoso.crm.dynamics.com │ ClientSecret │ a1b2c3d4-0000-0000-0000-111122223333 │ 7 day(s) │
│ │ UAT │ https://contoso-uat.crm.dynamics.com │ ClientSecret │ a1b2c3d4-0000-0000-0000-444455556666 │ 1 day(s) │
└────────┴──────────────────┴─────────────────────────────────────────┴───────────────┴──────────────────────────────────────┴─────────────────┘
* Indicates the currently active environment: Production
$ xg env list
No Dynamics 365 environments are registered yet.
You can add one using the 'XrmGhost env add' command.
$ xg env list
Registered Dynamics 365 Environments
┌────────┬──────────────────┬─────────────────────────────────────────┬───────────────┬──────────────────────────────────────┬─────────────────┐
│ Active │ Friendly Name │ Environment URL │ Auth Method │ Client ID │ Cache Lifecycle │
├────────┼──────────────────┼─────────────────────────────────────────┼───────────────┼──────────────────────────────────────┼─────────────────┤
│ │ Dev │ https://contoso-dev.crm.dynamics.com │ ClientSecret │ a1b2c3d4-0000-0000-0000-777788889999 │ 1 hour(s) │
└────────┴──────────────────┴─────────────────────────────────────────┴───────────────┴──────────────────────────────────────┴─────────────────┘
No environment is currently active.
You can activate one using 'XrmGhost env activate <FRIENDLY_NAME>'.
  • xg env add — Add a new Dataverse environment through the interactive wizard
  • xg env status — Show the status of configured environments
  • CLI Overview — Introduction to the XrmGhost CLI and command groups