class_docstr: Connects to an Azure Blob Storage service account.
class_docstr_tok: ["Connects","to","an","Azure","Blob","Storage","service","account","."]
code: def __init__(
      self,
      container: str,
      connection_string: Optional[str] = None,
      account_url: Optional[str] = None,
      credential: Optional[str] = None,
  ) -> None:
      import azure.core.exceptions
      from azure.storage import blob
  
      if connection_string:
          self.client = blob.BlobServiceClient.from_connection_string(
              connection_string
          )
      elif account_url:
          self.client = blob.BlobServiceClient(account_url, credential)
      else:
          raise ValueError(
              "Either 'connection_string' or 'account_url' must be specified."
          )
  
      logger.info(
          f"Trying to create Azure Blob Storage Container: {container}."
      )
      try:
          self.client.create_container(container.split("/")[0])
          logger.info(f"Successfully created container {container}.")
      except azure.core.exceptions.ResourceExistsError:
          logger.info(
              f"Container {container} already exists, and will be used to store checkpoints."
          )
      except azure.core.exceptions.HttpResponseError as e:
          if e.error_code == blob.StorageErrorCode.invalid_uri:  # type: ignore
              logger.warning(
                  f"The storage client raised the following HttpResponseError:\n{e}\nPlease "
                  "ignore this warning if this is because the account url provided points to a "
                  "container instead of a storage account; otherwise, it may be necessary to fix "
                  "your config.yaml."
              )
          else:
              logger.error(
                  f"Failed while trying to create container {container}."
              )
              raise e
  
file_path: determined/harness/determined/common/storage/azure_client.py
imports: import logging
  from pathlib import Path
  from typing import Dict, List, Optional, Union
  from determined.common import util
label_desc: Use image node_id 1 to create a new AzureStorageClient object from inherited base classes: object with example: obj = AzureStorageClient(container, connection_string, account_url, credential)