title: Create blob container in azure storage if it does not exists
body: <p>I am trying to create  blob container in azure storage using python. I am using documentation provided by <a href="https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-python" rel="nofollow noreferrer">MSDN</a> to integrate azure blob storage in my python program.</p>
  <p>Here is the code:</p>
  <pre><code>connectStr = &lt;connString&gt;
  blobServiceClient = BlobServiceClient.from_connection_string(connectStr)
  containerName = &quot;quickstart-azureStorage&quot;
  localFileName = &quot;quickstart-1.txt&quot;
  blobClient = blobServiceClient.create_container(containerName)
  </code></pre>
  <p><code>create_container()</code> is creating blob container first time, <strong>but it is giving me error second time.</strong></p>
  <blockquote>
  <p>I want to create blob container if it does not exists. If it exist then use existing blob container</p>
  </blockquote>
  <p>I am using azure storage library version 12.0.0. i.e <code>azure-storage-blob==12.0.0</code></p>
  <p>I know we can do it for blob present in that container using below code, but I did not find anything for creating container itself.</p>
  <p>Check blob exists or not:</p>
  <pre><code>blobClient = blobServiceClient.get_blob_client(container=containerName, blob=localFileName)
  if blobClient:
      print(&quot;blob already exists&quot;)
  else:
       print(&quot;blob not exists&quot;)
  </code></pre>
  <p>Exception:</p>
  <pre><code>RequestId:&lt;requestId&gt;
  Time:2019-12-04T06:59:03.1459600Z
  ErrorCode:ContainerAlreadyExists
  Error:None
  </code></pre>