1 year ago

#383291

test-img

Zin Yosrim

AzureKeyvault ContainerClient missing required connection details

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.") enter image description here

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?

python

azure

azure-storage

azure-keyvault

0 Answers

Your Answer

Accepted video resources