# Azion CLI workload

The Azion CLI `workload` commands create, list, describe, update, and delete [Workloads](/en/documentation/platform/workloads/), the resource that answers the domains of a site or an API and holds their TLS, mTLS, and port settings. The application that answers those domains is set by a deployment, which the [workload-deployment commands](/en/documentation/devtools/cli/resources/workload-deployment/) manage. The options every command accepts, such as `--format`, `--out`, and `-y`, are on [Global options](/en/documentation/devtools/cli/globals/).

---

## Create

`azion create workload` creates a workload with the name you pass:

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

| Flag       | Short | Type   | Default  | Description                                                                                            |
| ---------- | ----- | ------ | -------- | ------------------------------------------------------------------------------------------------------ |
| `--active` | —     | string | `"true"` | Turns the workload on (`true`) or off (`false`).                                                       |
| `--file`   | —     | string | —        | Path to a JSON file with the attributes of the workload. Use `-` to read the JSON from standard input. |
| `--name`   | —     | string | —        | **Required** unless `--file` is set. Name of the workload. Without it, the command asks for the name.  |

This command creates a workload named `my-workload`:

```bash
azion create workload --name my-workload
```

The command prints the ID of the workload:

```text
Created Workload with ID 1234567900
```

---

## List

`azion list workload` lists the workloads of your account, 50 to a page:

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

| Flag          | Short | Type   | Default | Description                                                                                   |
| ------------- | ----- | ------ | ------- | --------------------------------------------------------------------------------------------- |
| `--details`   | —     | —      | —       | Adds the `ACTIVE`, `LAST EDITOR`, and `LAST MODIFIED` columns to the `ID` and `NAME` 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 workloads on each page.                                                             |

This command returns the first page of a list split into pages of two workloads:

```bash
azion list workload --page 1 --page-size 2
```

The command prints one row per workload:

```text
ID          NAME
1234567905  my-blog
1234567906  my-store
```

---

## Describe

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

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

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

This command describes the workload with ID `1234567900`:

```bash
azion describe workload --workload-id 1234567900
```

The command prints the ID, the name, the state, and the last change of the workload:

```text
ID:              1234567900
Name:            my-workload
Active:          true
Last Editor:     you@example.com
Last Modified:   "2026-01-01T12:00:00.83424Z"
```

With `--format json`, the command prints the full object: `active`, `created_at`, `domains`, `id`, `infrastructure`, `last_editor`, `last_modified`, `mtls`, `name`, `product_version`, `protocols`, `tls`, `workload_domain`, and `workload_domain_allow_access`. The `workload_domain` field holds the domain Azion generates for the workload, which ends in `.map.azionedge.net`.

An ID that does not exist fails with this error:

```text
Error: Failed to describe the Domain: The given ID or API's endpoint doesn't exist or isn't available. Check that the identifying information is correct. Check your settings and try again. If the error persists, contact Azion support.
```

---

## Update

`azion update workload` changes the name, the active state, or the domains of a workload:

```bash
azion update workload [flags]
```

| Flag            | Short | Type    | Default  | Description                                                                                                                                                                                                                   |
| --------------- | ----- | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--active`      | —     | string  | `"true"` | Turns the workload on (`true`) or off (`false`).                                                                                                                                                                              |
| `--domains`     | —     | strings | —        | List of [domains](/en/documentation/platform/workloads/domains/) the workload answers. The `--alternate-domains` flag of the command's help example does not exist and fails with `Error: unknown flag: --alternate-domains`. |
| `--file`        | —     | string  | —        | Path to a JSON file with the attributes to change. Use `-` to read the JSON from standard input.                                                                                                                              |
| `--name`        | —     | string  | —        | New name of the workload.                                                                                                                                                                                                     |
| `--workload-id` | —     | int     | —        | ID of the workload to update.                                                                                                                                                                                                 |

The command reads the ID of the workload from the `"id"` field of the `--file` JSON. An update made with flags alone fails with this error, even when `--workload-id` carries a valid ID:

```text
Error: Failed to update the Workload: The given ID or API's endpoint doesn't exist or isn't available. Check that the identifying information is correct. Check your settings and try again. If the error persists, contact Azion support.
```

This file renames the workload with ID `1234567901` to `my-site-updated`:

```json
{
  "id": 1234567901,
  "name": "my-site-updated"
}
```

Pass the file to the update command:

```bash
azion update workload --file wl-update.json
```

The command prints the ID of the updated workload:

```text
Updated Workload with ID 1234567901
```

Fields left out of the file keep their values.

---

## Delete

`azion delete workload` deletes a workload:

```bash
azion delete workload [flags]
```

| Flag            | Short | Type | Default | Description                   |
| --------------- | ----- | ---- | ------- | ----------------------------- |
| `--workload-id` | —     | int  | —       | ID of the workload to delete. |

This command deletes the workload with ID `1234567900`:

```bash
azion delete workload --workload-id 1234567900 -y
```

The command confirms the deletion:

```text
Workload 1234567900 was successfully deleted
```

---

## Use a JSON file

`azion create workload` and `azion update workload` read the attributes of the workload from a JSON file with `--file`.

This file creates an active workload named `my-site`. The command reads `name` and `active` from it:

```json
{
  "name": "my-site",
  "active": true
}
```

Pass the file to the create command:

```bash
azion create workload --file wl-create.json
```

The command prints the ID of the workload:

```text
Created Workload with ID 1234567901
```

On update, the file carries `"id"` and the fields to change, such as `name` or `domains`, as shown in [Update](#update). The `domains` field takes a list of domains. The API refuses a domain your account is not allowed to use. This file lists `www.example.com` in the `domains` of the workload with ID `1234567901`:

```json
{
  "id": 1234567901,
  "domains": ["www.example.com"]
}
```

The command fails with this error:

```text
Error: Failed to update the Workload: ["This account is not allowed to use the following CNAMEs: example.com."]. 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 it puts an application on your domains.
- [Azion CLI workload-deployment](/en/documentation/devtools/cli/resources/workload-deployment.md): The commands that name the application and the firewall a workload uses.
- [Azion CLI application](/en/documentation/devtools/cli/resources/application.md): The commands that create and manage the application a deployment names.
