Skip to main content

Use notebook secrets

Secrets in ArcGIS Notebooks provide a secure method for storing and using sensitive information, such as connection keys for external systems. This capability is supported for notebooks that use Notebook runtime 14.0 or later.

If you have the privilege to create notebooks, you can create and manage secrets in the Secrets pane of the notebook editor. Any secrets you register appear in this pane, allowing you to add and use them programmatically across your notebooks, for both interactive and scheduled workflows, without exposing hardcoded secret values.

Caution:

Do not print secret values in your notebook to prevent exposing them.

Note:

If a notebook that references a registered secret is shared with another notebook author, the secret value will not be available to that author. Shared users can create their own secrets using the same name in the notebook.

Secrets are not supported in notebook web tools, as they are shared and run by multiple users.

Register a secret

Using the Secrets pane in the notebook editor, you can create one or more secrets for use in your notebook. To register a secret, complete the following steps:

  1. Follow the steps to open a notebook.

  2. Click Secrets in the top ribbon of the notebook editor.

  3. Click Register secret.

  4. Provide a name and value for the secret.

    The name can contain alphanumeric characters, hyphens, and underscores and can be a maximum length of 255 characters. The secret value cannot exceed 5000 characters.

  5. Click Save.

Add a secret to a notebook

  1. Click Secrets in the top ribbon of the notebook editor.

  2. Click + Add to insert a code snippet into your notebook that retrieves the value of the secret.

  3. Replace the variable name in the code snippet with your desired name.

Update a secret

To update the value of a registered secret, you must delete the secret and register a new secret with the same name.

Set key

Optionally, you can set a key that will be used to encrypt and decrypt your registered secrets. If you do not provide a key, a default key will be used. To set a key or update an existing key, complete the following steps:

  1. Follow the steps to open a notebook.

  2. Click Secrets in the top ribbon of the notebook editor.

  3. Click Set Key.

  4. Enter the value for the key.

  5. Click Save.