共享集群:无法使用Secret

问题描述 投票:0回答:1

我正在从

No Isolated Shared
切换到
Shared
集群。 我在集群中的 Spark 配置如下所示:

fs.azure.account.oauth2.client.secret {{secrets/keyvault/s}}
fs.azure.account.auth.type OAuth
spark.databricks.delta.preview.enabled true
fs.azure.account.oauth2.client.endpoint https://login.microsoftonline.com/xxx/oauth2/token
fs.azure.account.oauth.provider.type org.apache.hadoop.fs.azurebfs.oauth2.ClientCredsTokenProvider
fs.azure.account.oauth2.client.id def

在我的笔记本中,我正在使用 Azure 日志记录库,我的代码如下所示:

from azure.core.exceptions import HttpResponseError
from azure.identity import DefaultAzureCredential
from azure.identity import ClientSecretCredential
from azure.monitor.ingestion import LogsIngestionClient

#init
credential = ClientSecretCredential(tenant_id=os.getenv("AZ_TENANT_ID"), client_secret=spark.conf.get("fs.azure.account.oauth2.client.secret"), client_id=spark.conf.get("fs.azure.account.oauth2.client.id"))
client = LogsIngestionClient(endpoint=endpoint, credential=credential, logging_enable=True)
client.upload(....)

我总是收到以下错误消息:

提供的客户端密钥无效。确保秘密发送到 request 是客户端密钥值,而不是客户端密钥 ID,对于 秘密已添加到应用程序

切换到

No Isolated Shared
时,它可以工作。如何使用
Shared
集群运行代码。

databricks azure-databricks
1个回答
0
投票

根据 Azure Databricks 文档无隔离共享集群配置使用根凭据,而共享集群配置使用当前用户的凭据。

您必须为运行笔记本的当前用户配置文件创建一些凭据,并将其用于连接。

© www.soinside.com 2019 - 2024. All rights reserved.