# Environment

Configure deployment environments

* [`sfp server environment activate`](#sfp-server-environment-activate)
* [`sfp server environment activate-by-sandbox`](#sfp-server-environment-activate-by-sandbox)
* [`sfp server environment compare`](#sfp-server-environment-compare)
* [`sfp server environment create`](#sfp-server-environment-create)
* [`sfp server environment deactivate`](#sfp-server-environment-deactivate)
* [`sfp server environment deactivate-by-sandbox`](#sfp-server-environment-deactivate-by-sandbox)
* [`sfp server environment delete`](#sfp-server-environment-delete)
* [`sfp server environment delete-by-sandbox`](#sfp-server-environment-delete-by-sandbox)
* [`sfp server environment find`](#sfp-server-environment-find)
* [`sfp server environment get`](#sfp-server-environment-get)
* [`sfp server environment list`](#sfp-server-environment-list)
* [`sfp server environment lock`](#sfp-server-environment-lock)
* [`sfp server environment login`](#sfp-server-environment-login)
* [`sfp server environment unlock`](#sfp-server-environment-unlock)
* [`sfp server environment update`](#sfp-server-environment-update)

## `sfp server environment activate`

Activate an environment

```
USAGE
  $ sfp server environment activate -r <value> -n <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -n, --name=<value>                (required) Name of the environment to activate
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Activate an environment

EXAMPLES
  $ sfp server environment activate --repository myorg/myrepo --name UAT

  $ sfp server environment activate -r myorg/myrepo -n Production
```

*See code:* [*src/commands/server/environment/activate.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment activate-by-sandbox`

Activate all environments using a specific sandbox

```
USAGE
  $ sfp server environment activate-by-sandbox -s <value> -p <value> [--json] [-r <value>] [-e <value>] [-t <value>] [--sfp-server-url
    <value>] [-g <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -p, --production-org=<value>      (required) Username of the production org that owns the sandbox
  -r, --repository=<value>          Optional repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps) to filter environments
  -s, --sandbox-name=<value>        (required) Name of the sandbox to find environments for
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Activate all environments using a specific sandbox

EXAMPLES
  $ sfp server environment activate-by-sandbox --sandbox-name QA --production-org admin@prod.com

  $ sfp server environment activate-by-sandbox -s UAT -p admin@prod.com -r myorg/myrepo

  $ sfp server environment activate-by-sandbox -s DEV -p admin@prod.com --json
```

*See code:* [*src/commands/server/environment/activate-by-sandbox.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment compare`

Compare artifacts (package versions) across environments to detect version drift

```
USAGE
  $ sfp server environment compare -r <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g <value>...]
    [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-e <value>] [-c
    dev|test|snapshot|release] [-f] [--out-of-sync-only]

FLAGS
  -c, --category=<option>           Filter environments by category
                                    <options: dev|test|snapshot|release>
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -e, --environments=<value>        Comma-separated list of environment names to compare (default: all)
  -f, --force                       Force refresh all caches, bypassing the 30-minute cache TTL
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --out-of-sync-only            Show only packages that are out of sync
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Compare artifacts (package versions) across environments to detect version drift

EXAMPLES
  $ sfp server environment compare --repository myorg/myrepo

  $ sfp server environment compare --repository myorg/myrepo --environments dev,staging,prod

  $ sfp server environment compare --repository myorg/myrepo --baseline prod

  $ sfp server environment compare --repository myorg/myrepo --category release --force
```

*See code:* [*src/commands/server/environment/compare.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment create`

Create a new environment in the server

```
USAGE
  $ sfp server environment create -r <value> -n <value> -c dev|test|snapshot|release -b <value> -d <value> [--json] [-e
    <value>] [-t <value>] [--sfp-server-url <value>] [-g <value>...] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-o <value>] [-t <value>] [--devhubusername
    <value>] [--inactive] [-m <value>]

FLAGS
  -b, --branch=<value>              (required) Git branch associated with this environment
  -c, --category=<option>           (required) Category of the environment
                                    <options: dev|test|snapshot|release>
  -d, --description=<value>         (required) Description of the environment
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -m, --metadata=<value>            Additional metadata as JSON object
  -n, --name=<value>                (required) Name of the environment
  -o, --targetusername=<value>      Salesforce username for this environment (if not provided, will prompt for
                                    selection)
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
  -t, --tags=<value>                Comma-separated tags for the environment
      --devhubusername=<value>      Parent production org username for sandbox authentication (auto-detected for JIT
                                    sandboxes)
      --inactive                    Create the environment as inactive
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Create a new environment in the server

EXAMPLES
  $ sfp server environment create --repository myorg/myrepo --name UAT --category test --branch main --description "User Acceptance Testing Environment" --targetusername uat@mycompany.com

  $ sfp server environment create --repository myorg/myrepo --name Production --category release --branch main --description "Production Environment"  # Interactive username selection
```

*See code:* [*src/commands/server/environment/create.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment deactivate`

Deactivate an environment

```
USAGE
  $ sfp server environment deactivate -r <value> -n <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -n, --name=<value>                (required) Name of the environment to deactivate
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Deactivate an environment

EXAMPLES
  $ sfp server environment deactivate --repository myorg/myrepo --name UAT

  $ sfp server environment deactivate -r myorg/myrepo -n Production
```

*See code:* [*src/commands/server/environment/deactivate.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment deactivate-by-sandbox`

Deactivate all environments using a specific sandbox

```
USAGE
  $ sfp server environment deactivate-by-sandbox -s <value> -p <value> [--json] [-r <value>] [-e <value>] [-t <value>] [--sfp-server-url
    <value>] [-g <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -p, --production-org=<value>      (required) Username of the production org that owns the sandbox
  -r, --repository=<value>          Optional repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps) to filter environments
  -s, --sandbox-name=<value>        (required) Name of the sandbox to find environments for
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Deactivate all environments using a specific sandbox

EXAMPLES
  $ sfp server environment deactivate-by-sandbox --sandbox-name QA --production-org admin@prod.com

  $ sfp server environment deactivate-by-sandbox -s UAT -p admin@prod.com -r myorg/myrepo

  $ sfp server environment deactivate-by-sandbox -s DEV -p admin@prod.com --json
```

*See code:* [*src/commands/server/environment/deactivate-by-sandbox.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment delete`

Delete an environment from the server

```
USAGE
  $ sfp server environment delete -r <value> -n <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-f]

FLAGS
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -f, --force                       Skip confirmation prompt
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -n, --name=<value>                (required) Name of the environment to delete
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Delete an environment from the server

EXAMPLES
  $ sfp server environment delete --repository myorg/myrepo --name UAT

  $ sfp server environment delete --repository myorg/myrepo --name Production --force
```

*See code:* [*src/commands/server/environment/delete.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment delete-by-sandbox`

Delete all environments using a specific sandbox

```
USAGE
  $ sfp server environment delete-by-sandbox -s <value> -p <value> [--json] [-r <value>] [-e <value>] [-t <value>] [--sfp-server-url
    <value>] [-g <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-f]

FLAGS
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -f, --force                       Skip confirmation prompt before deleting environments
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -p, --production-org=<value>      (required) Username of the production org that owns the sandbox
  -r, --repository=<value>          Optional repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps) to filter environments
  -s, --sandbox-name=<value>        (required) Name of the sandbox to find environments for
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Delete all environments using a specific sandbox

EXAMPLES
  $ sfp server environment delete-by-sandbox --sandbox-name QA --production-org admin@prod.com

  $ sfp server environment delete-by-sandbox -s UAT -p admin@prod.com -r myorg/myrepo

  $ sfp server environment delete-by-sandbox -s DEV -p admin@prod.com --force --json
```

*See code:* [*src/commands/server/environment/delete-by-sandbox.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment find`

Find environments by Salesforce username or sandbox name

```
USAGE
  $ sfp server environment find [--json] [-r <value>] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g <value>...]
    [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-u <value>] [-s <value>] [-p
    <value>]

FLAGS
  -e, --email=<value>                Email address for authenticated user. Ignored if --application-token is provided.
                                     Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...   Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                     opening group, and an optional closing group symbol.
  -p, --production-org=<value>       Production org username that owns the sandbox
  -r, --repository=<value>           Repository identifier to filter results (e.g., owner/repo for GitHub/GitLab or
                                     org/project/repo for Azure DevOps)
  -s, --sandbox-name=<value>         Sandbox name to search for (requires --production-org)
  -t, --application-token=<value>    Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                     (CLI flags take precedence over env vars).
  -u, --salesforce-username=<value>  Salesforce username to search for
      --loglevel=<option>            [default: info] logging level for this command invocation
                                     <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>       URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                     config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Find environments by Salesforce username or sandbox name

EXAMPLES
  $ sfp server environment find --salesforce-username user@sandbox.example.com

  $ sfp server environment find --sandbox-name MySandbox --production-org admin@prod.com

  $ sfp server environment find -u user@sandbox.example.com -r myorg/myrepo --json
```

*See code:* [*src/commands/server/environment/find.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment get`

Get detailed information about a specific environment, optionally retrieving SFDX auth URL with a lock ticket

```
USAGE
  $ sfp server environment get -r <value> -n <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [--lock-ticket-id
    <value>] [-a] [--auth-type accessToken|sfdxAuthUrl]

FLAGS
  -a, --authenticate                Authenticate the org locally using the environment name as alias (requires
                                    lock-ticket-id)
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -n, --name=<value>                (required) Name of the environment
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --auth-type=<option>          Type of authentication to include: "accessToken" (recommended, short-lived) or
                                    "sfdxAuthUrl" (long-lived refresh token for extended operations). Requires
                                    owner/application role.
                                    <options: accessToken|sfdxAuthUrl>
      --lock-ticket-id=<value>      Lock ticket ID to retrieve SFDX auth URL (from lock command)
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Get detailed information about a specific environment, optionally retrieving SFDX auth URL with a lock ticket

EXAMPLES
  $ sfp server environment get --name production --repository myorg/myrepo

  $ sfp server environment get --name uat --repository myorg/myrepo --lock-ticket-id ticket_123abc

  $ sfp server environment get --name dev --repository myorg/myrepo --lock-ticket-id ticket_456def --authenticate

  $ sfp server environment get --name staging --repository myorg/myrepo --auth-type accessToken

  $ sfp server environment get --name staging --repository myorg/myrepo --auth-type sfdxAuthUrl
```

*See code:* [*src/commands/server/environment/get.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment list`

List environments from the SFP server with optional filtering for CI/CD matrix jobs

```
USAGE
  $ sfp server environment list [--json] [-r <value>] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g <value>...]
    [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-b <value>] [-c
    dev|test|snapshot|release] [--all] [-t <value>] [--metadata <value>] [-m]

FLAGS
  -b, --branch=<value>              Filter environments by git branch
  -c, --category=<option>           Filter environments by category
                                    <options: dev|test|snapshot|release>
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -m, --matrix                      Output environment names only for CI/CD matrix jobs
  -r, --repository=<value>          Repository identifier (e.g., owner/repo for GitHub/GitLab or org/project/repo for
                                    Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
  -t, --tags=<value>                Filter environments by tags (comma-separated)
      --all                         Show all environments including inactive ones
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --metadata=<value>            Filter environments by metadata attributes (e.g., "test=true,env=staging")
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  List environments from the SFP server with optional filtering for CI/CD matrix jobs

EXAMPLES
  $ sfp server environment list --repository myorg/myrepo

  $ sfp server environment list --repository myorg/myrepo --branch main --category release

  $ sfp server environment list --repository myorg/myrepo --branch main --category release --matrix  # For CI/CD

  $ sfp server environment list --repository myorg/myrepo --all  # Include inactive environments

  $ sfp server environment list --repository myorg/myrepo --tags critical,monitored

  $ sfp server environment list --repository myorg/myrepo --metadata "test=true"  # Filter by metadata attributes
```

*See code:* [*src/commands/server/environment/list.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment lock`

Lock an environment for exclusive access with optional wait functionality

```
USAGE
  $ sfp server environment lock -r <value> -n <value> -d <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url
    <value>] [-g <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-w]
    [--wait-timeout <value>] [--reason <value>] [--auth-type accessToken|sfdxAuthUrl]

FLAGS
  -d, --duration=<value>            (required) [default: 30] Lock duration in minutes
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -n, --name=<value>                (required) Name of the environment to lock
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
  -w, --wait                        Wait indefinitely for lock to be acquired (blocks until lock is available)
      --auth-type=<option>          [default: accessToken] Type of authentication to return when lock is acquired:
                                    "accessToken" (recommended, short-lived) or "sfdxAuthUrl" (long-lived refresh token
                                    for extended operations)
                                    <options: accessToken|sfdxAuthUrl>
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --reason=<value>              Reason for locking the environment
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url
      --wait-timeout=<value>        [default: 5] Wait for lock with timeout in minutes (if provided without --wait flag)

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Lock an environment for exclusive access with optional wait functionality

EXAMPLES
  $ sfp server environment lock --name production --repository myorg/myrepo --duration 60

  $ sfp server environment lock --name uat --repository myorg/myrepo --duration 30 --wait

  $ sfp server environment lock --name dev --repository myorg/myrepo --duration 120 --wait --reason "Deployment in progress"

  $ sfp server environment lock --name dev --repository myorg/myrepo --duration 120 --wait --auth-type sfdxAuthUrl
```

*See code:* [*src/commands/server/environment/lock.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment login`

Authenticate to a Salesforce environment without acquiring an exclusive lock. For CI/CD pipelines requiring exclusive access, use 'sfp server environment lock' instead.

```
USAGE
  $ sfp server environment login -r <value> -n <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-a <value>]
    [--auth-type accessToken|sfdxAuthUrl]

FLAGS
  -a, --alias=<value>               Alias for the authenticated org (defaults to environment name)
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -n, --name=<value>                (required) Name of the environment to authenticate
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --auth-type=<option>          [default: accessToken] Type of authentication: "accessToken" (recommended,
                                    short-lived) or "sfdxAuthUrl" (long-lived refresh token)
                                    <options: accessToken|sfdxAuthUrl>
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Authenticate to a Salesforce environment without acquiring an exclusive lock. For CI/CD pipelines requiring exclusive
  access, use 'sfp server environment lock' instead.

EXAMPLES
  $ sfp server environment login --name production --repository myorg/myrepo

  $ sfp server environment login --name uat --repository myorg/myrepo --alias uat-org

  $ sfp server environment login --name dev --repository myorg/myrepo --auth-type sfdxAuthUrl
```

*See code:* [*src/commands/server/environment/login.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment unlock`

Unlock an environment using the ticket ID obtained from the lock command

```
USAGE
  $ sfp server environment unlock -r <value> -n <value> --ticket-id <value> [--json] [-e <value>] [-t <value>]
    [--sfp-server-url <value>] [-g <value>...] [--loglevel
    trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

FLAGS
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -n, --name=<value>                (required) Name of the environment to unlock
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url
      --ticket-id=<value>           (required) Lock ticket ID obtained from the lock command

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Unlock an environment using the ticket ID obtained from the lock command

EXAMPLES
  $ sfp server environment unlock --name production --repository myorg/myrepo --ticket-id ticket_123abc

  $ sfp server environment unlock --name uat --repository myorg/myrepo --ticket-id ticket_456def
```

*See code:* [*src/commands/server/environment/unlock.ts*](https://source.flxbl.io/flxbl/sfp-pro)

## `sfp server environment update`

Update an environment's properties

```
USAGE
  $ sfp server environment update -r <value> -n <value> [--json] [-e <value>] [-t <value>] [--sfp-server-url <value>] [-g
    <value>...] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL] [-d <value>] [--active]
    [--default] [-b <value>] [-t <value>] [-m <value>] [--devhubusername <value>]

FLAGS
  -b, --branch=<value>              Git branch associated with this environment
  -d, --description=<value>         New description for the environment
  -e, --email=<value>               Email address for authenticated user. Ignored if --application-token is provided.
                                    Can be set via SFP_SERVER_USER env var.
  -g, --logsgroupsymbol=<value>...  Symbol used by CICD platform to group/collapse logs in the console. Provide an
                                    opening group, and an optional closing group symbol.
  -m, --metadata=<value>            JSON metadata for the environment
  -n, --name=<value>                (required) Name of the environment to update
  -r, --repository=<value>          (required) Repository identifier (e.g., owner/repo for GitHub/GitLab or
                                    org/project/repo for Azure DevOps)
  -t, --application-token=<value>   Application token for CI/CD authentication. Can be set via SFP_SERVER_TOKEN env var
                                    (CLI flags take precedence over env vars).
  -t, --tags=<value>                Comma-separated tags for the environment
      --[no-]active                 Set environment active status (true/false)
      --[no-]default                Set as default environment for its category
      --devhubusername=<value>      DevHub username for JIT sandbox authentication
      --loglevel=<option>           [default: info] logging level for this command invocation
                                    <options: trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL>
      --sfp-server-url=<value>      URL of the SFP server. Can be set via SFP_SERVER_URL env var or config: sfp
                                    config:set server-url

GLOBAL FLAGS
  --json  Format output as json.

DESCRIPTION
  Update an environment's properties

EXAMPLES
  $ sfp server environment update --repository myorg/myrepo --name UAT --active false

  $ sfp server environment update --repository myorg/myrepo --name Production --active true

  $ sfp server environment update --repository myorg/myrepo --name DEV --description "Development environment"

  $ sfp server environment update --repository myorg/myrepo --name QA --tags "qa,testing,automated"
```

*See code:* [*src/commands/server/environment/update.ts*](https://source.flxbl.io/flxbl/sfp-pro)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flxbl.io/flxbl/sfp/sfp-community/cli-reference-v51-release-v3/server/environment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
