Secrets CLI (قديم)

هام

تم إيقاف هذه الوثائق وقد لا يتم تحديثها.

تنطبق هذه المعلومات على إصدارات Databricks CLI القديمة 0.18 والإصدارات أدناه. توصي Databricks باستخدام الإصدار 0.205 أو أحدث من Databricks CLI بدلا من ذلك. راجع ما هو Databricks CLI؟. للعثور على إصدار Databricks CLI الخاص بك، قم بتشغيل databricks -v.

للترحيل من Databricks CLI الإصدار 0.18 أو أقل إلى Databricks CLI الإصدار 0.205 أو أعلى، راجع ترحيل Databricks CLI.

يمكنك تشغيل أوامر CLI الفرعية للبيانات السرية ل Databricks عن طريق إلحاقها ب databricks secrets. تستدعي هذه الأوامر الفرعية واجهة برمجة تطبيقات الأسرار.

لمزيد من المعلومات حول الأسرار، راجع إدارة البيانات السرية.

إشعار

يتطلب Secrets CLI Databricks CLI 0.7.1 أو أعلى.

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.

إنشاء نطاق سري

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets create-scope --help.

databricks secrets create-scope --scope my-scope

إذا نجحت، فلن يتم عرض أي إخراج.

لاستخدام Databricks CLI لإنشاء نطاق سري مدعوم من Azure Key Vault، قم بتشغيل databricks secrets create-scope --help لعرض معلومات حول خيارات و و --dns-name إضافية--scope-backend-type--resource-id. لمزيد من المعلومات، راجع الأسرار.

حذف سر

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets delete --help.

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

إذا نجحت، فلن يتم عرض أي إخراج.

إبطال قائمة التحكم بالوصول (ACL) لمدير

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets delete-acl --help.

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

إذا نجحت، فلن يتم عرض أي إخراج.

حذف نطاق سري

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets delete-scope --help.

databricks secrets delete-scope --scope my-scope

إذا نجحت، فلن يتم عرض أي إخراج.

الحصول على قائمة التحكم بالوصول (ACL) لمدير

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets get-acl --help.

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

سرد المفاتيح السرية المخزنة ضمن نطاق سري

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets list --help.

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

إشعار

لا يمكنك الوصول إلى القيم السرية باستخدام Databricks CLI. للوصول إلى القيم السرية، يجب استخدام الأداة المساعدة للبيانات السرية Databricks Utilities داخل دفتر ملاحظات Databricks.

سرد قوائم التحكم بالوصول لنطاق سري

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets list-acls --help.

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

سرد جميع النطاقات السرية المتوفرة في مساحة العمل

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets list-scopes --help.

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

إنشاء سر أو تحديثه

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets put --help أو databricks secrets write --help.

هناك ثلاث طرق لتخزين سر. أسهل طريقة هي استخدام --string-value الخيار؛ سيتم تخزين السر في نموذج UTF-8 (MB4). يجب أن تكون حذرا مع هذا الخيار، لأنه قد يتم تخزين سرك في محفوظات سطر الأوامر في نص عادي.

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

أو:

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

إذا نجحت، فلن يتم عرض أي إخراج.

يمكنك أيضا استخدام --binary-file الخيار لتوفير سر مخزن في ملف. ستتم قراءة محتوى الملف كما هو وتخزينه كوحدات بايت.

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

أو:

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

إذا نجحت، فلن يتم عرض أي إخراج.

إذا لم تحدد خيارا، فسيتم فتح محرر لإدخال سرك. اتبع الإرشادات الموضحة في المحرر لإدخال سرك.

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

أو:

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.

منح قائمة التحكم بالوصول (ACL) أو تغييرها إلى نطاق سري لكيان

لعرض وثائق الاستخدام، قم بتشغيل databricks secrets put-acl --help أو databricks secrets write-acl --help.

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

أو:

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

إذا نجحت، فلن يتم عرض أي إخراج.