Geheimen CLI (verouderd)

Belangrijk

Deze documentatie is buiten gebruik gesteld en wordt mogelijk niet bijgewerkt.

Deze informatie is van toepassing op verouderde Databricks CLI-versies 0.18 en lager. Databricks raadt u aan om in plaats daarvan nieuwere Databricks CLI versie 0.205 of hoger te gebruiken. Zie Wat is de Databricks CLI? Voer de opdracht uit databricks -vom uw versie van de Databricks CLI te vinden.

Als u wilt migreren van Databricks CLI versie 0.18 of lager naar Databricks CLI versie 0.205 of hoger, raadpleegt u de Cli-migratie van Databricks.

U voert Cli-subopdrachten voor Databricks-geheimen uit door ze toe te voegen aan databricks secrets. Deze subopdrachten roepen de Geheimen-API aan.

Zie Geheimbeheer voor meer informatie over geheimen.

Notitie

Voor de Geheimen-CLI is Databricks CLI 0.7.1 of hoger vereist.

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.

Een geheim bereik maken

Als u de gebruiksdocumentatie wilt weergeven, voert u het volgende uit databricks secrets create-scope --help.

databricks secrets create-scope --scope my-scope

Als dit lukt, wordt er geen uitvoer weergegeven.

Als u de Databricks CLI wilt gebruiken om een geheim bereik met Azure Key Vault-ondersteuning te maken, voert u uit databricks secrets create-scope --help om informatie weer te geven over aanvullende --scope-backend-type, --resource-iden --dns-name opties. Zie Geheimen voor meer informatie.

Een geheim verwijderen

Als u de gebruiksdocumentatie wilt weergeven, voert u het volgende uit databricks secrets delete --help.

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

Als dit lukt, wordt er geen uitvoer weergegeven.

Een ACL voor een principal intrekken

Als u de gebruiksdocumentatie wilt weergeven, voert u het volgende uit databricks secrets delete-acl --help.

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

Als dit lukt, wordt er geen uitvoer weergegeven.

Een geheim bereik verwijderen

Als u de gebruiksdocumentatie wilt weergeven, voert u het volgende uit databricks secrets delete-scope --help.

databricks secrets delete-scope --scope my-scope

Als dit lukt, wordt er geen uitvoer weergegeven.

Een ACL voor een principal ophalen

Als u de gebruiksdocumentatie wilt weergeven, voert u het volgende uit databricks secrets get-acl --help.

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

De geheime sleutels weergeven die zijn opgeslagen binnen een geheim bereik

Als u de gebruiksdocumentatie wilt weergeven, voert u het volgende uit databricks secrets list --help.

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

Notitie

U hebt geen toegang tot geheime waarden met behulp van de Databricks CLI. Voor toegang tot geheime waarden moet u het hulpprogramma Databricks Utilities-geheimen in een Databricks-notebook gebruiken.

De ACL's voor een geheim bereik weergeven

Als u de gebruiksdocumentatie wilt weergeven, voert u het volgende uit databricks secrets list-acls --help.

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

Alle beschikbare geheime bereiken in de werkruimte weergeven

Als u de gebruiksdocumentatie wilt weergeven, voert u het volgende uit databricks secrets list-scopes --help.

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

Een geheim maken of bijwerken

Als u gebruiksdocumentatie wilt weergeven, voert u deze uit databricks secrets put --help of databricks secrets write --help.

Er zijn drie manieren om een geheim op te slaan. De eenvoudigste manier is om de --string-value optie te gebruiken. Het geheim wordt opgeslagen in UTF-8 -8-formulier (MB4). U moet voorzichtig zijn met deze optie, omdat uw geheim mogelijk wordt opgeslagen in de geschiedenis van de opdrachtregel in tekst zonder opmaak.

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

Of:

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

Als dit lukt, wordt er geen uitvoer weergegeven.

U kunt ook de --binary-file optie gebruiken om een geheim op te geven dat is opgeslagen in een bestand. De bestandsinhoud wordt als zodanig gelezen en opgeslagen als bytes.

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

Of:

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

Als dit lukt, wordt er geen uitvoer weergegeven.

Als u geen optie opgeeft, wordt er een editor geopend om uw geheim in te voeren. Volg de instructies in de editor om uw geheim in te voeren.

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

Of:

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.

Een ACL toewijzen aan of wijzigen in een geheim bereik voor een principal

Als u gebruiksdocumentatie wilt weergeven, voert u deze uit databricks secrets put-acl --help of databricks secrets write-acl --help.

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

Of:

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

Als dit lukt, wordt er geen uitvoer weergegeven.