# Azion CLI workload-deployment

The Azion CLI `workload-deployment` commands create, list, and describe the deployment of a workload in [Workloads](/en/documentation/platform/workloads/). A deployment names the application, the firewall, and the custom page set that serve the traffic of a workload, and a workload holds one deployment. The CLI has no command that updates or deletes a deployment. To change one, refer to [Workload settings](/en/documentation/platform/workloads/settings/). The options every command accepts, such as `--format`, `--out`, and `-y`, are on [Global options](/en/documentation/devtools/cli/globals/).

---

## Create

`azion create workload-deployment` creates a deployment in a workload with the settings you pass:

```bash
azion create workload-deployment [flags]
```

| Flag               | Short | Type   | Default | Description                                                                                              |
| ------------------ | ----- | ------ | ------- | -------------------------------------------------------------------------------------------------------- |
| `--active`         | —     | string | —       | Turns the deployment on (`true`) or off (`false`).                                                       |
| `--application-id` | —     | int    | —       | ID of the application that serves the traffic of the workload.                                           |
| `--current`        | —     | string | —       | Takes `true` or `false`. With `true`, this deployment is the one the workload runs.                      |
| `--custom-page`    | —     | string | —       | ID of the custom page set that replaces error responses for the workload.                                |
| `--file`           | —     | string | —       | Path to a JSON file with the attributes of the deployment. Use `-` to read the JSON from standard input. |
| `--firewall-id`    | —     | int    | —       | ID of the firewall that runs its rules on requests before the application.                               |
| `--name`           | —     | string | —       | Name of the deployment.                                                                                  |
| `--strategy-type`  | —     | string | —       | Type of the deployment strategy, such as `default`.                                                      |
| `--workload-id`    | —     | int    | —       | ID of the workload that holds the deployment.                                                            |

This command creates a deployment named `my-deployment` in the workload with ID `1234567900`. The deployment sends the traffic to the application with ID `1234567890` and uses the custom page set with ID `123`:

```bash
azion create workload-deployment --workload-id 1234567900 --name my-deployment --strategy-type default --application-id 1234567890 --custom-page 123 --active true --current true
```

The command prints the ID of the deployment:

```text
Created Workload Deployment with ID 123470
```

---

## List

`azion list workload-deployment` lists the deployments of one workload, 50 to a page:

```bash
azion list workload-deployment [flags]
```

| Flag            | Short | Type   | Default | Description                                                                                                                                           |
| --------------- | ----- | ------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--details`     | —     | —      | —       | Adds a column with the ID of the application and a column with the ID of the firewall to the `ID` and `CURRENT` columns.                              |
| `--filter`      | —     | string | —       | Name to filter the list by.                                                                                                                           |
| `--order-by`    | —     | string | —       | Field to sort the list by.                                                                                                                            |
| `--page`        | —     | int    | `1`     | Number of the page to return.                                                                                                                         |
| `--page-size`   | —     | int    | `50`    | Number of deployments on each page.                                                                                                                   |
| `--workload-id` | —     | int    | —       | **Required**. ID of the workload whose deployments the command lists. Without it, the command asks `? Enter the Workload ID to list its Deployments`. |

This command lists the deployments of the workload with ID `1234567900`, with the application and firewall columns:

```bash
azion list workload-deployment --workload-id 1234567900 --details
```

The command prints one row per deployment. A deployment without a firewall shows `0` in the firewall column:

```text
ID      CURRENT  EDGE APPLICATION  EDGE FIREWALL
123470  true     1234567890        0
```

---

## Describe

`azion describe workload-deployment` prints the settings of one deployment:

```bash
azion describe workload-deployment [flags]
```

| Flag              | Short | Type | Default | Description                                   |
| ----------------- | ----- | ---- | ------- | --------------------------------------------- |
| `--deployment-id` | —     | int  | —       | ID of the deployment to describe.             |
| `--workload-id`   | —     | int  | —       | ID of the workload that holds the deployment. |

---

## Use a JSON file

`azion create workload-deployment` reads the attributes of the deployment from a JSON file with `--file`.

This file creates an active deployment named `my-deployment-file` that sends the traffic to the application with ID `1234567890`. The command reads `name`, `active`, `current`, and `strategy` from it:

```json
{
  "name": "my-deployment-file",
  "active": true,
  "current": false,
  "strategy": {
    "type": "default",
    "attributes": {
      "application": 1234567890
    }
  }
}
```

The file holds no workload ID, so pass `--workload-id` on the command line with the file:

```bash
azion create workload-deployment --workload-id 1234567901 --file dep-create.json
```

The command prints the ID of the deployment:

```text
Created Workload Deployment with ID 123471
```

A workload holds one deployment. Passed for a workload that already holds a deployment, the same file fails with this error:

```text
Error: Failed to create the Workload Deployment: ["The maximum number of deployments allowed per workload is 1."]. Check your settings and try again. If the error persists, contact Azion support.
```

---

## Related resources

- [Global options](/en/documentation/devtools/cli/globals.md): The options every command accepts, such as `--format`, `--out`, and `-y`.
- [Workloads](/en/documentation/platform/workloads.md): What a workload holds and how its deployment binds an application to its domains.
- [Azion CLI workload](/en/documentation/devtools/cli/resources/workload.md): The commands that create and manage the workload a deployment belongs to.
- [Azion CLI application](/en/documentation/devtools/cli/resources/application.md): The commands that create and manage the application a deployment serves.
