title: Unable to get Azure Blob Container info using powershell
body: <p>I'm trying get Azure Blob Container information using powershell. I'm using below script. </p>
  
  <p>I have tried changing the <strong>Set-AzStorageContainerAcl</strong> to <strong>Blob</strong> and <strong>Container</strong> Still no luck. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    $StorageAccounts = Get-AzStorageAccount
      FOREACH ($StorageAccount in $StorageAccounts) {   
              $AllContainers = Get-AzStorageContainerAcl -Context $StorageAccount.Context
              $AccountCapacity = 0
  
              FOREACH ($Container in $AllContainers) { 
              $ListOfBLobs = Get-AzStorageBlob -Container $Container.Name -Context $StorageAccount.Context
              $length = 0
              $BlobCapacity = 0            
              $BlobCapacity = ($listOfBlobs | Measure-Object 'Length' -Sum).Sum
  
              $AccountCapacity = $AccountCapacity + $BlobCapacity   
              }</code></pre>
  </div>
  </div>
  </p>
  
  <p>This works when I use my credentials. But when I try to use App Registration to connect to Subscription, I'm getting below error. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>Get-AzStorageContainerAcl : The client 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx' with object id 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx' does not have authorization to perform action 'Microsoft.Storage/storageAccounts/listKeys/action' over scope 
  '/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx/resourceGroups/ResourceGroupName/providers/Microsoft.Storage/storageAccounts/StorageAccountName' or the scope is invalid. If access was recently granted, please refresh your credentials.
  At line:11 char:30
  + ... ontainers = Get-AzStorageContainerAcl -Context $StorageAccount.Contex ...
  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [Get-AzStorageContainer], CloudException
      + FullyQualifiedErrorId : Microsoft.Rest.Azure.CloudException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageContainerCommand</code></pre>
  </div>
  </div>
  </p>