AzureKeyvault ContainerClient 缺少所需的连接详细信息
我正在尝试使用以下代码在 Azure Function 中创建 Azure 存储 ContainerClient:
导入:
from azure.storage.blob import ContainerClient
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
在 Azure Function 中:
# initialize credentials
default_credential = DefaultAzureCredential()
# connect to key vault and authenticate
my_key_vault = SecretClient (
vault_url = "https://my-keyvault.vault.azure.net/",
credential = default_credential
)
# grab the blob connection string
blob_connection_string = my_key_vault.get_secret (
name = "mystoragesecret"
)
# create container client
container_client = ContainerClient.from_connection_string (
conn_str=blob_connection_string.value,
container_name="my-container"
)
创建 ContainerClient
时,代码会抛出 ValueError("Connection string Missing required连接详细信息。”)
所有必需的参数均已传递 - 根据 文档:
from_connection_string(conn_str: str,container_name: str,凭证:可选[任何] = 无,**kwargs:任何)-> ClassType
我在这里缺少什么?
I'm trying to create an Azure Storage ContainerClient within am Azure Function with following code:
Imports:
from azure.storage.blob import ContainerClient
from azure.keyvault.secrets import SecretClient
from azure.identity import DefaultAzureCredential
In Azure Function:
# initialize credentials
default_credential = DefaultAzureCredential()
# connect to key vault and authenticate
my_key_vault = SecretClient (
vault_url = "https://my-keyvault.vault.azure.net/",
credential = default_credential
)
# grab the blob connection string
blob_connection_string = my_key_vault.get_secret (
name = "mystoragesecret"
)
# create container client
container_client = ContainerClient.from_connection_string (
conn_str=blob_connection_string.value,
container_name="my-container"
)
When creating the ContainerClient
, the code throws a ValueError("Connection string missing required connection details.")
All required parameters are passed - signature according to the docs:
from_connection_string(conn_str: str, container_name: str, credential: Optional[Any] = None, **kwargs: Any) -> ClassType
What am I missing here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论