title: Best way to query Azure blob storage by multiple metadata items
body: <p>I'm working on some code to query azure blob storage by passing in a X number of metadata key/value pairs.</p>
  <p>I have this code right now to search for one:</p>
  <pre><code>            BlobContainerClient container = GetBlobContainerForDownloads(blobContainerClient);
  
              var blobItems = GetAllBlobsForContainer(container);
  
              if (blobItems == null)
              {
                  return Enumerable.Empty&lt;AzureStorageFileDownloadResultDTO&gt;();
              }
  
              IList&lt;AzureStorageFileDownloadResultDTO&gt; results = new List&lt;AzureStorageFileDownloadResultDTO&gt;();
  
              AzureStorageFileDownloadResultDTO result;
  
              foreach (var item in blobItems.Where(w =&gt; w.Metadata.Contains(new KeyValuePair&lt;string, string&gt;(FileManagerMetadataContants.ModuleType, moduleType.ToString())) == true &amp;&amp; w.Metadata.Contains(new KeyValuePair&lt;string, string&gt;(metaDataKey, metaDataValue)) == true &amp;&amp; w.Metadata.Contains(new KeyValuePair&lt;string, string&gt;(FileManagerMetadataContants.IsFileDeleted, FileManagerMetadataContants.IsFileDeletedValue)) == false))
              {
                  result = new AzureStorageFileDownloadResultDTO()
                  {
                      FileData = null, // do not pull the file data when returning all the files ; the developer will return back to the API to get the actual file with the blob name
                      FileFound = true,
                      BlobName = item.Name,
                      FileName = GetFileName(item.Metadata),
                      FileNameWithExtension = GetFileNameWithExtension(item.Metadata),
                      ContentType = item.Properties.ContentType,
                      FileExtension = item.Properties.ContentType,
                      MetaData = item.Metadata
                  };
  
                  results.Add(result);
              }
  </code></pre>
  <p>This could be slow in time.</p>
  <p>What is the best way to query multiple metadata key/value pairs?</p>