# PEDM Deployment Commands

### Overview

This section covers all the Keeper Commander commands for managing PEDM agent deployments. Deployments represent agent deployment configurations and provide the tokens needed to install and register PEDM agents on endpoints. These commands allow administrators to create, view, update, and delete deployment configurations.

This section supports the following commands:

[**Deployment List Command**](#deployment-list-command)

[**Deployment Add Command**](#deployment-add-command)

[**Deployment Edit Command**](#deployment-edit-command)

[**Deployment Delete Command**](#deployment-delete-command)

[**Deployment Download Command**](#deployment-download-command)

### Usage

`pedm deployment command [--options]` OR `pedm d command [--options]`

**Alias:** `d`

***

### Deployment List Command

View all PEDM deployments with their details including deployment UID, name, status, creation date, and associated agent count. Useful for monitoring and managing multiple deployment configurations across the organisation.

<details>

<summary>DotNet CLI</summary>

**Command:** Coming Soon

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** Coming Soon

</details>

<details>

<summary>Power Commander</summary>

**Command:** Coming Soon

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm deployment list`

**Aliases:** `pedm d l`, `pedm d list`

**Flags:**

| Flag            | Description                                         |
| --------------- | --------------------------------------------------- |
| `-v, --verbose` | Print detailed information including all agent UIDs |
| `--format`      | Output format - json, csv, or table                 |
| `--output`      | Save output to specified file                       |

**Example:**

```
My Vault> pedm deployment list

Deployment UID: abc123def456
Name: Production Deployment
Disabled: False
Created: 2024-10-15
Updated: 2024-11-01
Agent Count: 15
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**&#x20;

```python
from keepersdk.plugins.pedm import admin_plugin

plugin = admin_plugin.PedmPlugin(enterprise_loader)
deployments = plugin.deployments.get_all_entities()
```

</details>

### Deployment Add Command

Create a new PEDM deployment configuration. This command generates a unique deployment token that can be used to install and register PEDM agents on endpoints. The deployment serves as a logical grouping for agents.

<details>

<summary>DotNet CLI</summary>

**Command:** Coming Soon

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** Coming Soon

</details>

<details>

<summary>Power Commander</summary>

**Command:** Coming Soon

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm deployment add <name>`

**Aliases:** `pedm d a`, `pedm d add`&#x20;

**Parameter:**&#x20;

`name`  - Deployment name (required)

**Flags:**

| Flag          | Description                    |
| ------------- | ------------------------------ |
| `-f, --force` | Do not prompt for confirmation |

**Example:**

```
My Vault> pedm deployment add "Production Environment"

Deployment created successfully
Deployment UID: xyz789abc123
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**&#x20;

```python
from keepersdk.plugins.pedm import admin_plugin

deployment_name = 'deployment name'
plugin = admin_plugin.PedmPlugin(enterprise_loader)

ec_public_key = crypto.unload_ec_public_key(enterprise_data.enterprise_info.ec_public_key)
agent_info = pedm_shared.DeploymentAgentInformation(hash_key=plugin.agent_key, peer_public_key=ec_public_key)
spiffe_cert = cert.public_bytes(serialization.Encoding.DER)

add_rq = admin_types.AddDeployment(name=deployment_name, spiffe_cert=spiffe_cert, agent_info=agent_info)
response = plugin.modify_deployments(add_deployments=[add_rq])
```

</details>

### Deployment Edit Command

Modify an existing PEDM deployment's settings such as name or enabled/disabled status. This command allows administrators to update deployment configurations without recreating them.

<details>

<summary>DotNet CLI</summary>

**Command:** Coming Soon

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** Coming Soon

</details>

<details>

<summary>Power Commander</summary>

**Command:** Coming Soon

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm deployment edit <deployment>`

**Aliases:** `pedm d edit`

**Flags:**

| Flag         | Description                                     |
| ------------ | ----------------------------------------------- |
| `--disable`  | Enable or disable deployment (choices: on, off) |
| `--name`     | New deployment name                             |
| `deployment` | Deployment name or UID (required)               |

**Example:**

```
My Vault> pedm deployment edit Production --name "Production-US-East" --disable off

Deployment updated successfully
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**&#x20;

```python
from keepersdk.plugins.pedm import admin_plugin

deployment_name = 'deployment name'
plugin = admin_plugin.PedmPlugin(enterprise_loader)

deployment = plugin.deployments.get_entity(deployment_name)
spiffe_cert = cert.public_bytes(serialization.Encoding.DER)

name= 'new name'
disable = True ## or false
update_rq = admin_types.UpdateDeployment(
            deployment_uid=deployment.deployment_uid, name=name, disabled=disabled, spiffe_cert=spiffe_cert)
response = plugin.modify_deployments(update_deployments=[update_rq])
```

</details>

### Deployment Delete Command

Remove one or more PEDM deployments from the system. This command permanently deletes deployment configurations and should be used with caution, especially when agents are still associated with the deployment.

<details>

<summary>DotNet CLI</summary>

**Command:** Coming Soon

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** Coming Soon

</details>

<details>

<summary>Power Commander</summary>

**Command:** Coming Soon

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm deployment delete <deployment> [deployment...]`

**Aliases:** `pedm d delete`

**Flags:**

| Flag          | Description                                             |
| ------------- | ------------------------------------------------------- |
| `-f, --force` | Do not prompt for confirmation                          |
| `deployment`  | Deployment name or UID (required, can specify multiple) |

**Example:**

```
My Vault> pedm deployment delete "Old Deployment" --force

Deployment deleted successfully
```

</details>

<details>

<summary>Python SDK</summary>

**Function:**&#x20;

```python
from keepersdk.plugins.pedm import admin_plugin

deployment_name = 'deployment name'
plugin = admin_plugin.PedmPlugin(enterprise_loader)

deployment = plugin.deployments.get_entity(deployment_name)
response = plugin.modify_deployments(remove_deployments=[deployment.uid])
```

</details>

### Deployment Download Command

Retrieve the deployment token needed for PEDM agent installation. This command can display the token on screen or save it to a file, and optionally show download URLs for agent installation packages for Windows, MacOS, and Linux platforms.

<details>

<summary>DotNet CLI</summary>

**Command:** Coming Soon

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** Not Supported

</details>

<details>

<summary>Power Commander</summary>

**Command:** Coming Soon

</details>

<details>

<summary>Python CLI</summary>

**Command:** `pedm deployment download <deployment>`

**Aliases:** `pedm d download`

**Flags:**

| Flag            | Description                                  |
| --------------- | -------------------------------------------- |
| `--file`        | Save deployment token to specified file      |
| `-v, --verbose` | Show package download URLs for all platforms |
| `deployment`    | Deployment name or UID (required)            |

**Example:**

```
My Vault> pedm deployment download Production --verbose

Windows download URL: https://keepersecurity.com/pam/pedm/packages/keeper-pedm-windows.zip
MacOS download URL: https://keepersecurity.com/pam/pedm/packages/keeper-pedm-macos.zip
Linux download URL: https://keepersecurity.com/pam/pedm/packages/keeper-pedm-linux.zip

Deployment Token: us.keepersecurity.com:abc123def456:xyz789token
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** Not Supported

</details>
