Python使用Azure服务主体连接Storage Account

from azure.identity import ClientSecretCredential
from adal.authentication_context import AuthenticationContext
from azure.storage.blob import BlobServiceClient

_secret_scope = "test1"
_client_id = dbutils.secrets.get(_secret_scope, key="sp_client_id")
_client_secret = dbutils.secrets.get(_secret_scope, key="sp_client_secret")
_tenant_id = dbutils.secrets.get(_secret_scope, key="tenant_id")

_credential = ClientSecretCredential(tenant_id=_tenant_id,client_id=_client_id,client_secret=_client_secret)

_blob_url = f"https://land01.blob.core.windows.net/"
_blob_service_client = BlobServiceClient(account_url=_blob_url,credential=_credential)
_container_client = _blob_service_client.get_container_client("user-drop-zone-dev")
_blob_iterator = _container_client.list_blobs()

for blob in _blob_iterator:
  print(blob.name)