> ## Documentation Index
> Fetch the complete documentation index at: https://astronomer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# astro env airflow-variable update

> Set the value of an Environment Manager Airflow variable.

<Info>
  This command is only available on Astro.
</Info>

Set the value of an Airflow variable. By default this command upserts: if the key doesn't exist, the CLI creates it. Pass `--strict` to fail when the key is missing. Use `--from-file` to bulk-upsert variables from a dotenv file.

## Usage

```bash wrap theme={null}
astro env airflow-variable update [<id-or-key>]
```

## Options

| Option | Description | Possible Values |
| - | - | - |
| `<id-or-key>` | The ID or key of the Airflow variable to update. Omit this argument when you use `--from-file`. | Any valid variable ID or key |
| `-v`,`--value` | The new variable value. If omitted, the CLI reads the value from stdin when piped, or prompts for it with the input hidden. | Any string |
| `-s`,`--secret` | When the variable doesn't exist and the CLI creates it, mark it as secret. This has no effect when updating an existing variable. | None |
| `--strict` | Fail if the variable doesn't exist instead of creating it. | None |
| `--from-file` | Bulk-upsert variables from a dotenv file. Pass `-` to read from stdin. Mutually exclusive with `--value` and the positional `<id-or-key>`. | Any valid file path, or `-` |
| `--auto-link` | Workspace scope only. Automatically link the variable to all Deployments in the Workspace, including future ones. | None |
| `--workspace-id` | Set the Workspace scope. Mutually exclusive with `--deployment-id`. Defaults to your current Workspace from CLI context. | Any valid Workspace ID |
| `--deployment-id` | Set the Deployment scope. Mutually exclusive with `--workspace-id`. | Any valid Deployment ID |

## Examples

```bash wrap theme={null}
# Update a Workspace Airflow variable's value
astro env airflow-variable update MY_VAR --workspace-id <workspace-id> --value new-value

# Bulk-upsert Airflow variables from a dotenv file
astro env airflow-variable update --workspace-id <workspace-id> --from-file vars.env
```

## Related commands

* [`astro env airflow-variable create`](/docs/cli/v1.46/astro-env-airflow-variable-create)
* [`astro env airflow-variable get`](/docs/cli/v1.46/astro-env-airflow-variable-get)
* [`astro env airflow-variable list`](/docs/cli/v1.46/astro-env-airflow-variable-list)
