Secrets CLI (warisan)
Penting
Dokumentasi ini telah dihentikan dan mungkin tidak diperbarui.
Informasi ini berlaku untuk CLI Databricks warisan versi 0.18 ke bawah. Databricks merekomendasikan agar Anda menggunakan Databricks CLI versi 0.205 atau lebih baru. Lihat Apa itu Databricks CLI?. Untuk menemukan versi Databricks CLI Anda, jalankan databricks -v
.
Untuk bermigrasi dari Databricks CLI versi 0.18 atau di bawahnya ke Databricks CLI versi 0.205 atau lebih tinggi, lihat migrasi CLI Databricks.
Anda menjalankan subperintah CLI rahasia Databricks dengan menambahkannya ke databricks secrets
. Sub-perintah ini memanggil SECRETS API.
Untuk mengetahui informasi selengkapnya tentang rahasia, lihat Pengelolaan rahasia.
Catatan
CLI Rahasia membutuhkan CLI Databricks 0.7.1 atau lebih tinggi.
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.
Membuat cakupan rahasia
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets create-scope --help
.
databricks secrets create-scope --scope my-scope
Jika berhasil, maka tidak ada output yang akan ditampilkan.
Untuk menggunakan CLI Databricks untuk membuat cakupan rahasia yang didukung Azure Key Vault, jalankan databricks secrets create-scope --help
untuk menampilkan informasi tentang tambahan opsi --scope-backend-type
, --resource-id
, dan --dns-name
. Untuk informasi selengkapnya, lihat Manajemen rahasia.
Menghapus rahasia
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets delete --help
.
databricks secrets delete --scope my-scope --key my-key
Jika berhasil, maka tidak ada output yang akan ditampilkan.
Mencabut ACL untuk prinsipal
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets delete-acl --help
.
databricks secrets delete-acl --scope my-scope --principal someone@example.com
Jika berhasil, maka tidak ada output yang akan ditampilkan.
Menghapus cakupan rahasia
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets delete-scope --help
.
databricks secrets delete-scope --scope my-scope
Jika berhasil, maka tidak ada output yang akan ditampilkan.
Mendapatkan ACL untuk prinsipal
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets get-acl --help
.
databricks secrets get-acl --scope my-scope --principal someone@example.com --output JSON
{
"principal": "sonmeone@example.com",
"permission": "MANAGE"
}
Mencantumkan kunci rahasia yang disimpan dalam cakupan rahasia
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets list --help
.
databricks secrets list --scope my-scope --output JSON
{
"secrets": [
{
"key": "my-key",
"last_updated_timestamp": 1621284092605
}
]
}
Catatan
Anda tidak dapat mengakses nilai rahasia menggunakan CLI Databricks. Untuk mengakses nilai rahasia, Anda harus menggunakan utilitas rahasia Utilitas Databricks dalam notebook Databricks.
Mencantumkan ACL untuk cakupan rahasia
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets list-acls --help
.
databricks secrets list-acls --scope my-scope --output JSON
{
"items": [
{
"principal": "someone@example.com",
"permission": "MANAGE"
}
]
}
Mencantumkan semua cakupan rahasia yang tersedia di ruang kerja
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets list-scopes --help
.
databricks secrets list-scopes --output JSON
{
"scopes": [
{
"name": "my-scope",
"backend_type": "DATABRICKS"
}
]
}
Membuat atau memperbarui rahasia
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets put --help
atau databricks secrets write --help
.
Ada tiga cara untuk menyimpan rahasia. Cara termudah adalah dengan menggunakan opsi; --string-value
rahasia akan disimpan dalam bentuk UTF-8 (MB4). Anda harus berhati-hati dengan opsi ini, karena rahasia Anda dapat disimpan dalam riwayat baris perintah Anda dalam teks biasa.
databricks secrets put --scope my-scope --key my-key --string-value my-value
Atau:
databricks secrets write --scope my-scope --key my-key --string-value my-value
Jika berhasil, maka tidak ada output yang akan ditampilkan.
Anda juga dapat menggunakan opsi --binary-file
untuk memberikan rahasia yang disimpan dalam file. Konten file akan dibaca apa adanya dan disimpan sebagai byte.
databricks secrets put --scope my-scope --key my-key --binary-file my-secret.txt
Atau:
databricks secrets write --scope my-scope --key my-key --binary-file my-secret.txt
Jika berhasil, maka tidak ada output yang akan ditampilkan.
Jika Anda tidak menentukan opsi, editor akan dibuka bagi Anda untuk memasukkan rahasia Anda. Ikuti petunjuk yang ditampilkan di editor untuk memasukkan rahasia Anda.
databricks secrets put --scope my-scope --key my-key
Atau:
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.
Memberikan atau mengubah ACL ke ruang lingkup rahasia untuk prinsipal
Untuk menampilkan dokumentasi penggunaan, jalankan databricks secrets put-acl --help
atau databricks secrets write-acl --help
.
databricks secrets put-acl --scope my-scope --principal someone@example.com --permission MANAGE
Atau:
databricks secrets write-acl --scope my-scope --principal someone@example.com --permission MANAGE
Jika berhasil, maka tidak ada output yang akan ditampilkan.