Geheimnis-CLI (Legacy)

Wichtig

Diese Dokumentation wurde eingestellt und wird unter Umständen nicht aktualisiert.

Diese Informationen gelten für ältere Versionen der Databricks-Befehlszeilenschnittstelle (0.18 und niedriger). Databricks empfiehlt, stattdessen die neuere Databricks-CLI Version 0.205 oder höher zu verwenden. Weitere Informationen finden Sie unter Was ist die Databricks-CLI?. Führen Sie databricks -v aus, um die Version Ihrer Databricks CLI zu ermitteln.

Informationen zum Migrieren der Databricks CLI-Version 0.18 oder niedriger zur Databricks CLI-Version 0.205 oder höher finden Sie unter Databricks CLI-Migration.

Sie führen Unterbefehle über die CLI für Databricks-Geheimnisse aus, indem Sie sie an databricks secrets anfügen. Diese Unterbefehle rufen die Geheimnis-API auf.

Weitere Informationen zu Geheimnissen finden Sie unter Verwalten von Geheimnissen.

Hinweis

Die Geheimnis-CLI erfordert Databricks CLI 0.7.1 oder höher.

databricks secrets --help
Usage: databricks secrets [OPTIONS] COMMAND [ARGS]...

  Utility to interact with secret API.

Options:
  -v, --version   [VERSION]
  --profile TEXT  CLI connection profile to use. The default profile is
                  "DEFAULT".
  -h, --help      Show this message and exit.

Commands:
  create-scope  Creates a secret scope.
    Options:
      --scope SCOPE                  The name of the secret scope.
      --initial-manage-principal     The initial principal that can manage the created secret scope.
                                      If specified, the initial ACL with MANAGE permission applied
                                      to the scope is assigned to the supplied principal (user or group).
                                      The only supported principal is the group
                                      "users", which contains all users in the workspace. If not
                                      specified, the initial ACL with MANAGE permission applied to
                                      the scope is assigned to request issuer's user identity.
  delete        Deletes a secret.
    Options:
      --scope SCOPE                  The name of the secret scope.
      --key KEY                      The name of secret key.
  delete-acl    Deletes an access control rule for a principal.
    Options:
      --scope SCOPE                  The name of the scope.
      --principal PRINCIPAL          The name of the principal.
  delete-scope  Deletes a secret scope.
    Options:
      --scope SCOPE                  The name of the secret scope.
  get-acl       Gets the details for an access control rule.
    Options:
      --scope SCOPE                  The name of the secret scope.
      --principal PRINCIPAL          The name of the principal.
      --output FORMAT                JSON or TABLE. Set to TABLE by default.
  list          Lists all the secrets in a scope.
    Options:
      --scope SCOPE                  The name of the secret scope.
      --output FORMAT                JSON or TABLE. Set to TABLE by default.
  list-acls     Lists all access control rules for a given secret scope.
    Options:
      --scope SCOPE                  The name of the secret scope.
      --output FORMAT                JSON or TABLE. Set to TABLE by default.
  list-scopes   Lists all secret scopes.
      --output FORMAT                JSON or TABLE. Set to TABLE by default.
  put           Puts a secret in a scope.
    Options:
      --scope SCOPE                  The name of the secret scope.
      --key KEY                      The name of the secret key.
      --string-value TEXT            Read value from string and stored in UTF-8 (MB4) form
      --binary-file PATH             Read value from binary-file and stored as bytes.
  put-acl       Creates or overwrites an access control rule for a principal
                applied to a given secret scope.
    Options:
      --scope SCOPE                    The name of the secret scope.
      --principal PRINCIPAL            The name of the principal.
      --permission [MANAGE|WRITE|READ] The permission to apply.
  write         Puts a secret in a scope. "write" is an alias for "put".
    Options:
      --scope SCOPE                  The name of the secret scope.
      --key KEY                      The name of the secret key.
      --string-value TEXT            Read value from string and stored in UTF-8 (MB4) form
      --binary-file PATH             Read value from binary-file and stored as bytes.
  write-acl     Creates or overwrites an access control rule for a principal
                applied to a given secret scope. "write-acl" is an alias for
                "put-acl".
    Options:
      --scope SCOPE                    The name of the secret scope.
      --principal PRINCIPAL            The name of the principal.
      --permission [MANAGE|WRITE|READ] The permission to apply.

Erstellen eines Geheimnisbereichs

Führen Sie databricks secrets create-scope --help aus, um die Nutzungsdokumentation anzuzeigen.

databricks secrets create-scope --scope my-scope

Bei Erfolg wird keine Ausgabe angezeigt.

Um die Databricks CLI zum Erstellen eines Azure Key Vault-gesicherten Geheimnisbereichs zu verwenden, führen Sie databricks secrets create-scope --help aus, um Informationen zu zusätzlichen Optionen --scope-backend-type, --resource-idund --dns-name anzuzeigen. Weitere Informationen finden Sie unter Geheimnisse.

Löschen eines Geheimnisses

Führen Sie databricks secrets delete --help aus, um die Syntaxdokumentation anzuzeigen.

databricks secrets delete --scope my-scope --key my-key

Bei Erfolg wird keine Ausgabe angezeigt.

Widerrufen einer ACL für einen Prinzipal

Führen Sie databricks secrets delete-acl --help aus, um die Nutzungsdokumentation anzuzeigen.

databricks secrets delete-acl --scope my-scope --principal someone@example.com

Bei Erfolg wird keine Ausgabe angezeigt.

Löschen eines Geheimnisbereichs

Führen Sie databricks secrets delete-scope --help aus, um die Nutzungsdokumentation anzuzeigen.

databricks secrets delete-scope --scope my-scope

Bei Erfolg wird keine Ausgabe angezeigt.

Abrufen einer ACL für einen Prinzipal

Führen Sie databricks secrets get-acl --help aus, um die Syntaxdokumentation anzuzeigen.

databricks secrets get-acl --scope my-scope --principal someone@example.com --output JSON
{
  "principal": "sonmeone@example.com",
  "permission": "MANAGE"
}

Auflisten der geheimen Schlüssel, die in einem Geheimnisbereich gespeichert sind

Führen Sie databricks secrets list --help aus, um die Syntaxdokumentation anzuzeigen.

databricks secrets list --scope my-scope --output JSON
{
  "secrets": [
    {
      "key": "my-key",
      "last_updated_timestamp": 1621284092605
    }
  ]
}

Hinweis

Sie können nicht über die Databricks CLI auf Geheimniswerte zugreifen. Um auf Geheimniswerte zuzugreifen, müssen Sie das Databricks Utilities Geheimnis-Dienstprogramm in einem Databricks Notebook verwenden.

Auflisten der ACLs für einen Geheimnisbereich

Führen Sie databricks secrets list-acls --help aus, um die Nutzungsdokumentation anzuzeigen.

databricks secrets list-acls --scope my-scope --output JSON
{
  "items": [
    {
      "principal": "someone@example.com",
      "permission": "MANAGE"
    }
  ]
}

Auflisten aller verfügbaren Geheimnisbereiche im Arbeitsbereich

Führen Sie databricks secrets list-scopes --help aus, um die Syntaxdokumentation anzuzeigen.

databricks secrets list-scopes --output JSON
{
  "scopes": [
    {
      "name": "my-scope",
      "backend_type": "DATABRICKS"
    }
  ]
}

Erstellen oder Aktualisieren eines geheimen Schlüssels

Führen Sie databricks secrets put --help oder databricks secrets write --help aus, um die Syntaxdokumentation anzuzeigen.

Es gibt drei Möglichkeiten, ein Geheimnis zu speichern. Die einfachste Möglichkeit besteht darin, die --string-value-Option zu verwenden. Das Geheimnis wird im UTF-8-Formular (MB4) gespeichert. Bei dieser Option sollten Sie vorsichtig sein, da Ihr Geheimnis möglicherweise im Befehlszeilenverlauf im Nur-Text-Format gespeichert wird.

databricks secrets put --scope my-scope --key my-key --string-value my-value

Oder:

databricks secrets write --scope my-scope --key my-key --string-value my-value

Bei Erfolg wird keine Ausgabe angezeigt.

Sie können auch die --binary-file-Option verwenden, um ein in einer Datei gespeichertes Geheimnis bereitzustellen. Der Dateiinhalt wird wie besehen gelesen und als Bytes gespeichert.

databricks secrets put --scope my-scope --key my-key --binary-file my-secret.txt

Oder:

databricks secrets write --scope my-scope --key my-key --binary-file my-secret.txt

Bei Erfolg wird keine Ausgabe angezeigt.

Wenn Sie keine Option angeben, wird ein Editor geöffnet, in dem Sie Ihr Geheimnis eingeben können. Befolgen Sie die Anweisungen im Editor, um Ihr Geheimnis einzugeben.

databricks secrets put --scope my-scope --key my-key

Oder:

databricks secrets write --scope my-scope --key my-key

# ----------------------------------------------------------------------
# Do not edit the above line. Everything below it will be ignored.
# Please input your secret value above the line. Text will be stored in
# UTF-8 (MB4) form and any trailing new line will be stripped.
# Exit without saving will abort writing secret.

Zuweisen oder Ändern einer ACL für einen Geheimnisbereich für einen Prinzipal

Führen Sie databricks secrets put-acl --help oder databricks secrets write-acl --help aus, um die Syntaxdokumentation anzuzeigen.

databricks secrets put-acl --scope my-scope --principal someone@example.com --permission MANAGE

Oder:

databricks secrets write-acl --scope my-scope --principal someone@example.com --permission MANAGE

Bei Erfolg wird keine Ausgabe angezeigt.