{
  "schema_version": 2,
  "id": "integrate/redis-data-integration/reference/cli/redis-di-set-context",
  "title": "redis-di set-context",
  "url": "https://redis.io/docs/latest/integrate/redis-data-integration/1.19.1/reference/cli/redis-di-set-context/",
  "summary": "Creates or updates a context",
  "content": "\nCreates or updates a context in the `~/.redis-di` context file. A context stores an API connection\nso you don't have to pass the connection options on every command. `set-context` merges only the\noptions you give on the command line, preserving the rest, and does not change which context is\nactive; use [`use-context`](https://redis.io/docs/latest/integrate/redis-data-integration/1.19.1/reference/cli/redis-di-use-context)\nfor that. See the\n[CLI reference overview](https://redis.io/docs/latest/integrate/redis-data-integration/1.19.1/reference/cli#contexts)\nfor more about contexts.\n\nSecrets (the password and the Redis Cloud user key) are never stored in a context, so `set-context`\nrejects `--password` and `--user-key`.\n\n## Usage\n\n```\nredis-di set-context \u003cname\u003e [flags]\n```\n\nThe connection is set from the global options `--api-url`, `--user`, `--account-key`, `--cacert`,\nand `--insecure`.\n\n## Options\n\n| Option                | Description                                                                                   |\n| :-------------------- | :-------------------------------------------------------------------------------------------- |\n| `--unset-user`        | Clear the stored user, so the context authenticates without a user.                           |\n| `--unset-account-key` | Clear the stored account key, so the context authenticates without a Redis Cloud account key. |\n\nThis command also accepts the\n[global options](https://redis.io/docs/latest/integrate/redis-data-integration/1.19.1/reference/cli/redis-di#global-options).\n\n## Example\n\n```bash\n# Create or update a context for a VM or Kubernetes installation\nredis-di set-context prod --api-url https://rdi.example.com --user default --cacert /etc/rdi/ingress-ca.crt\n\n# Create or update a context that skips TLS verification\nredis-di set-context dev --api-url https://localhost:8443 --insecure\n```\n",
  "tags": ["redis-di"],
  "last_updated": "2026-09-19T17:55:58-07:00"
}
