title: List files on Azure BlobStorage with python API
body: <p>This code tries to list the files in the in a blob storage:</p>
  <pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python3
  
  import os
  
  from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient, __version__
  from datetime import datetime, timedelta
  import azure.cli.core as az
  
  print(f&quot;Azure Blob storage v{__version__} - Python quickstart sample&quot;)
  
  account_name = &quot;my_account&quot;
  container_name = &quot;my_container&quot;
  path_on_datastore = &quot;test/path&quot;
  
  def _create_sas(expire=timedelta(seconds=10)) -&gt; str:
      cli = az.get_default_cli()
  
      expire_date = datetime.utcnow() + expire
      expiry_string = datetime.strftime(expire_date, &quot;%Y-%m-%dT%H:%M:%SZ&quot;)
      cmd = [&quot;storage&quot;, &quot;container&quot;, &quot;generate-sas&quot;, &quot;--name&quot;, container_name, &quot;--account-name&quot;,
             account_name, &quot;--permissions&quot;, &quot;lr&quot;, &quot;--expiry&quot;, expiry_string, &quot;--auth-mode&quot;, &quot;login&quot;, &quot;--as-user&quot;]
      if cli.invoke(cmd) != 0:
          raise RuntimeError(&quot;Could not receive a SAS token for user {}@{}&quot;.format(
              account_name, container_name))
  
      return cli.result.result
  
  
  sas = _create_sas()
  blob_service_client = BlobServiceClient(
      account_url=f&quot;{account_name}.blob.core.windows.net&quot;, container_name=container_name, credential=sas)
  
  container_client = blob_service_client.create_container(container_name)
  blob_list = container_client.list_blobs()
  for blob in blob_list:
      print(&quot;\t&quot; + blob.name)
  
  </code></pre>
  <p>That code worked quite fine a few weeks ago, but then we always get the error:</p>
  <blockquote>
  <p>azure.core.exceptions.ClientAuthenticationError: Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.</p>
  </blockquote>
  <p>Does someone know what can be wrong?</p>
  <p>PS. using Azure blob storage package of version 12.3.2.</p>
  <h2><strong>[Edit]</strong></h2>
  <p>Because of security concerns we are not allowed to use account keys here.</p>