Reputation: 699
I have a requirement to list down all recently created files names on Azure Blob Storage. As my team is not owner of Azure account but we are provided Client Id and Client Secret to connect. Through Client Id and Client Secret i am able to generate sasTokenUri, i have following questions and any input will be helpful
Question 1: How to connect Azure Blob Storage through sasTokenUri and list down all files which are recently created? Question 2: How can i identify newly created file over Azure Blob storage through the connection stablished above?
Limitation : I cannot access Blob storage programmatically through (Python, Java and others) because of some infra limitations, i only need to access files list through sasTokenUri or RestAPI.
Sample sasTokenUri : "https://{Account}.blob.core.windows.net/blob.name?sv=2020-02-10&spr=https&se=2021-07-04T11%3A22%3A05Z&sr=c&sp=rwdl&sig=kL9a1aaaaaaaaaa%2Bbbbbbbb4%2Bccccccc5%2B4vddddddddd0%3D"
Any input or pointers will be helpful. Thanks in advance!!
Upvotes: 2
Views: 16593
Reputation: 136126
From your SAS token URI, it seems you're getting a SAS token for a blob container.
To list the blobs in that blob container, simply append &restype=container&comp=list
to your SAS URI and use that in Postman. So your SAS Token URI will be something like:
https://{Account}.blob.core.windows.net/blob.name?sv=2020-02-10&spr=https&se=2021-07-04T11%3A22%3A05Z&sr=c&sp=rwdl&sig=kL9a1aaaaaaaaaa%2Bbbbbbbb4%2Bccccccc5%2B4vddddddddd0%3D&restype=container&comp=list
That will give you the list of blobs in that blob container (upto a maximum of 5000 blobs) in XML format. To see more options, please see List Blobs
REST API operation here: https://learn.microsoft.com/en-us/rest/api/storageservices/list-blobs.
Regarding your question about identifying the newly created blobs, Azure Storage does not provide anything out of the box. However each blob as a Created Date/Time
property that will tell you when a blob was created. You can use this information to find out the newly created blobs.
Upvotes: 2
Reputation: 2968
There are other ways but have you looked at the Azure Storage Explorer
Can connect via a SaS token through the Connect Dialog and then navigate through the blob storage account similar to File Explorer.
Upvotes: 0