我对你的问题的理解 - 如何从 Databricks 笔记本中的密钥库访问秘密值?
因此,要访问密钥,您必须将 Databricks 笔记本链接到密钥库。
此链接必须通过使用范围来完成。
在下面的网址中,您必须提供详细信息:
https://westeurope.azuredatabricks.net/#secrets/createScope https://westeurope.azuredatabricks.net/#secrets/createScope
If you open the link then you will land to a secret scope creation page:
Link may be vary depends on the area/region of subscription. In my case it is "westeurope".
您必须在页面上提供 3 个值:
1)范围名称
2)DNS 名称
3)资源ID
Scope name have to be define manually and rest of the two values has to copy from the key-vault.
Now go to your Azure key-vault and click on properties section.
复制DNS Name and 资源ID值并将其粘贴到范围创建页面的所需单元格中。
就是这样。现在您的笔记本将指向您的密钥保管库。
我给了az-kv-范围测试命名到我的范围。
让我们假设我的密钥库有一个带有名称的秘密数据库密码我想在我的笔记本中访问它。
因此,要从 Databricks 笔记本内的密钥保管库访问秘密值,我必须使用以下命令。
// variable declaration and initialization.
val my_kv_scope = "az-kv-scope-test"
val password = dbutils.secrets.get(scope = my_kv_scope, key = "db_password")
以下链接将引导您获取有关秘密范围的更多信息。
https://docs.databricks.com/security/secrets/index.html https://docs.databricks.com/security/secrets/index.html
我希望这能让您清楚地了解笔记本中的 Key-Vault 值的可访问性。