Thank you very much this is very helpful :)
I have to more queries :
1- it seems that the query doesn't fetch the size ?
2- How can I put the data in a csv output ?
It's my first post and I'm glad to be here :) Thanks again for your help
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I'm trying to put in place a powershell script to export all available files in my storage account with the maximum of details, my goal is to have something like this :
Blob name | Folder name | File name | Type | Created datetime | Last modification datetime | Size | Lease State | and the full path (Parent folder/s)
I have already found some scripts in some forums but it does not fit this need, like :
https://stackoverflow.com/questions/36162435/how-to-get-size-of-azure-container-in-powershell
https://learn.microsoft.com/en-us/azure/storage/scripts/storage-blobs-container-calculate-size-powershell
Thank you for your help and best regards
Thank you very much this is very helpful :)
I have to more queries :
1- it seems that the query doesn't fetch the size ?
2- How can I put the data in a csv output ?
It's my first post and I'm glad to be here :) Thanks again for your help
@EL ALAOUI Lahcen (ADM) Welcome to Microsoft Q&A Forum, Thank you for posting your query here!
$blobs = Get-AzStorageBlob -Container $ContainerName -Context $ctx
foreach ($blob in $blobs)
{
Write-Host $blob.Name, $blob.ICloudBlob.Properties.LeaseState
}
foreach ($blob in $blobs)
{
Write-Host ($blob.Name + "|" + $blob.ICloudBlob.Properties.LeaseState + "|" + $blob.LastModified + "|" + $blob.BlobType)
}
foreach ($blob in $blobs)
{
Write-Host ($blob.name + "|" +$blob.size + "|" + $blob.accesstier)
}
Note: There is no concept of Folder in Storage unless its ADLS Gen 2. File name and Blob Name is same
Please let us know if you have any further queries. I’m happy to assist you further.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Please do not forget to and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.