Azion CLI workload
Azion CLI commands that create, list, describe, update, and delete workloads, with every flag, its type, and its default.
The Azion CLI workload commands create, list, describe, update, and delete 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 the workload’s deployment, which the workload-deployment commands create, list, and describe. azion deploy also writes it from the deployments entry of azion.config.js, and in Azion Console you set it in the workload’s deployment settings. The options every command accepts, such as --format, --out, and -y, are on Global options.
Create
azion create workload creates a workload with the name you pass.
Replace <your-workload-name> with the name of the workload.
This command creates a workload named my-workload:
The command prints the ID of the 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. |
List
azion list workload lists the workloads of your account, 50 to a page.
This command returns the first page of a list split into pages of two workloads:
The command prints one row per workload:
Flags
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--details |
— | — | — | Adds the ACTIVE, LAST EDITOR, and LAST MODIFIED columns to the ID and NAME columns. |
--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. |
Describe
azion describe workload prints the settings of one workload.
Replace <your-workload-id> with the ID of the workload to describe.
This command describes the workload with ID 1234567900:
The command prints the ID, the name, the state, and the last change of the workload:
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:
Flags
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--workload-id |
— | int | — | ID of the workload to describe. |
Update
azion update workload changes the name, the active state, or the domains of a workload.
Replace <your-json-file> with the path to a JSON file with the attributes to change.
This file renames the workload with ID 1234567901 to my-site-updated:
Pass the file to the update command:
The command prints the ID of the updated workload:
Fields left out of the file keep their values.
Flags
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--active |
— | string | "true" |
Turns the workload on (true) or off (false). |
--domains |
— | strings | — | List of 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:
Delete
azion delete workload deletes a workload.
Replace <your-workload-id> with the ID of the workload to delete.
This command deletes the workload with ID 1234567900:
The command confirms the deletion:
Flags
| Flag | Short | Type | Default | Description |
|---|---|---|---|---|
--workload-id |
— | int | — | ID of the workload to delete. |
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:
Pass the file to the create command:
The command prints the ID of the workload:
On update, the file carries "id" and the fields to change, such as name or domains, as shown in 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:
The command fails with this error: