'Azure Logic App how to read files from ADLS using HTTP GET
I am trying to use an HTTP get to iterate through a folder in ADLS. The folder " TemplatesUpdated" has a bunch of subfolders that have a few files in each subfolder. I want to iterate through each subfolder and then copy each file to a new location. This is what I have so far, but I am not sure what to put in the Body to get each subfolder and each item within the subfolders.
Solution 1:[1]
Achieving your requirement using HTTP requires methods in order to iterate or loop through each folder. There are 2 ways of achieving your requirement.
WAY - 1: USING LOGIC APPS WITH AZURE BLOB STORAGE CONNECTOR
You will require 2 List Blob actions so that one will get the subfolders in TemplatesUpdated
and the other List Blob retrieves files n the subfolder. below is the flow of my logic app
RESULT:
WAY - 2: USING SDK
from azure.storage.blob import BlockBlobService
ACCOUNT_NAME = "<STORAGE ACCOUNT NAME>"
SAS_TOKEN='<SAS TOKEN>'
blob_service = BlockBlobService(account_name=ACCOUNT_NAME,account_key=None,sas_token=SAS_TOKEN)
containers = blob_service.list_containers()
for c in containers:
generator = blob_service.list_blobs(c.name)
for blob in generator:
print("\t Blob name: "+c.name+'/'+ blob.name)
RESULTS:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | SwethaKandikonda-MT |