My objective is to check if files exist in a folder in blob container. Access to Storage from portal is closed, so here is what I have:
- VM with PowerShell and Azure Storage Explorer
- Path to files:
mycontainer/in/data/documents/ - Connection string (amended):
BlobEndpoint=https://storagecont01.blob.core.windows.net/;QueueEndpoint=https://storageacont01.queue.core.windows.net/;FileEndpoint=https://storageacont01.file.core.windows.net/;TableEndpoint=https://storageacont01.table.core.windows.net/;SharedAccessSignature=sv=2019-06-00&ss=bxqt&srt=sco&sp=xwlacux&se=2019-06-00T00:00:05Z&st=2019-06-00T01:30:00Z&spr=https&sig=Sz%2zxdadzca1e137zzdzdq131D%21366bpafOrAAdac%3D
My AD Account does not have access to these files but I successfully connected via Azure Storage Account with connection string above and I successfully copied files with Azcopy
Following the thread How to list Azure Storage Containers and Blobs
here is what I tried (unsuccessfully, get-azstorageblob is not working too):
$ctx = New-AzStorageContext -StorageAccountName "storageacont01" -sastoken "sv=2019-06-00&ss=bxqt&srt=sco&sp=xwlacux&se=2019-06-00T00:00:05Z&st=2019-06-00T01:30:00Z&spr=https&sig=Sz%2zxdadzca1e137zzdzdq131D%21366bpafOrAAdac%3D"
get-azstoragecontainer -container "mycontainer" -Context $ctx -Debug
My questions are:
- am I doing something wrong?
- is it possible, connection string I was given restricts access from PowerShell?
UPD: Account Kind StorageV2 (general purpose v2)
Here is the debug output:
DEBUG: 2:27:30 PM - GetAzureStorageContainerCommand begin processing with ParameterSet 'ContainerName'.
DEBUG: 2:27:30 PM - Use storage account 'storagecont1' from storage context.
DEBUG: Request [9888e1b0-b7f1-47ba-b9bb-116263ead7dd] GET https://storagecont1.blob.core.windows.net/mycontainer?sv=2000-00-00&ss=bfqt&srt=sco&sp=rwlacup&se=2000-00-00T08:37:05Z&st=2000-00-00
T00:30:005Z&spr=https&sig=REDACTED&restype=container
x-ms-version:2020-04-08
User-Agent:AzurePowershell/v1.0.0,azsdk-net-Storage.Blobs/12.8.0 (.NET Framework 4.7.3850.0; Microsoft Windows 10.0.14393 )
x-ms-client-request-id:9888e1b0-b7f1-47ba-b9bb-116263ead7dd
x-ms-return-client-request-id:true
client assembly: Azure.Storage.Blobs
DEBUG: Error response [9888e1b0-b7f1-47ba-b9bb-116263ead7dd] 503 Service Unavailable (00.2s)
Mime-Version:REDACTED
X-Squid-Error:REDACTED
Vary:Accept-Language
Content-Language:en
Content-Length:3888
Content-Type:text/html;charset=utf-8
Date:Sun, 03 Oct 2021 03:27:27 GMT
Server:squid/4.10
...... 4 more retries ......
get-azstoragecontainer : The 'meta' start tag on line 4 position 2 does not match the end tag of 'head'. Line 117, position 3.
At line:2 char:2
+ get-azstoragecontainer -container "mycontainer" -Context $ctx -Debug
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzStorageContainer], XmlException
+ FullyQualifiedErrorId : XmlException,Microsoft.WindowsAzure.Commands.Storage.Blob.Cmdlet.GetAzureStorageContainerCommand
DEBUG: 2:27:59 PM - GetAzureStorageContainerCommand end processing, Start 24 remote calls. Finish 0 remote calls. Elapsed time 3044243.02 ms. Client operation id: Azure-Storage-PowerShell-d39
4497f-0e4f-4e13-bc40-079df6bf143c.
DEBUG: AzureQoSEvent: Module: Az.Storage:3.11.0; CommandName: Get-AzStorageContainer; PSVersion: 5.1.14393.4583; IsSuccess: False; Duration: 00:00:28.2957856; Exception: The 'meta' start tag
on line 4 position 2 does not match the end tag of 'head'. Line 117, position 3.;
DEBUG: Finish sending metric.
DEBUG: 2:28:00 PM - GetAzureStorageContainerCommand end processing.