﻿---
title: config context add cli command
description: Add a new context to the config file 
url: https://www.elastic.co/elastic/docs-builder/docs/4116/reference/elastic-cli/cli/config/context/add
applies_to:
  - Elastic Cloud Serverless: Preview
  - Elastic Stack: Preview
---

# config context add cli command
```bash
elastic config context add <name> [options]
```

Add a new context to the config file

## Arguments

<definitions>
  <definition term="<name> string required">
    context name
  </definition>
</definitions>


## Options

<definitions>
  <definition term="--force">
    overwrite an existing context with the same name
  </definition>
  <definition term="--inline-secrets">
    store secrets inline in the config file (instead of the OS keychain)
  </definition>
  <definition term="--es-url string">
    Elasticsearch URL
  </definition>
  <definition term="--es-username string">
    Elasticsearch username (pair with --es-password)
  </definition>
  <definition term="--kb-url string">
    Kibana URL
  </definition>
  <definition term="--kb-username string">
    Kibana username (pair with --kb-password)
  </definition>
  <definition term="--cloud-url string">
    Elastic Cloud API URL
  </definition>
  <definition term="--es-api-key string">
    Elasticsearch API key (secret -- stored in the OS keychain when available)
  </definition>
  <definition term="--es-password string">
    Elasticsearch password (secret -- stored in the OS keychain when available)
  </definition>
  <definition term="--kb-api-key string">
    Kibana API key (secret -- stored in the OS keychain when available)
  </definition>
  <definition term="--kb-password string">
    Kibana password (secret -- stored in the OS keychain when available)
  </definition>
  <definition term="--cloud-api-key string">
    Elastic Cloud API key (secret -- stored in the OS keychain when available)
  </definition>
</definitions>


## config Options

<definitions>
  <definition term="--config-file string">
    path to the config file to edit (defaults to ~/.elasticrc.yml)
  </definition>
  <definition term="--dry-run">
    validate all inputs and exit without performing any action (preview changes without applying them)
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="--json">
    output as JSON
  </definition>
</definitions>