简体   繁体   中英

Azure - Copy LARGE blobs from one container to other using logic apps

I successfully built logic app where whenever a blob is added in container-one, it gets copied to container-2. However it fails when any blobs larger than 50 MB (default size) is uploaded. Could you please guide.

Blobs are added via rest api.

Below is the flow,

在此处输入图像描述

Currently, the maximum file size with disabled chunking is 50MB. One of the workarounds is to use Azure functions in order to transfer the files from one container to another.

Below is the sample Python Code that worked for me when I'm trying to transfer files from One container to Another

from azure.storage.blob import BlobClient, BlobServiceClient
from azure.storage.blob import ResourceTypes, AccountSasPermissions
from azure.storage.blob import generate_account_sas   
from datetime import datetime,timedelta 

connection_string = '<Your Connection String>' 
account_key = '<Your Account Key>'
source_container_name = 'container1'
blob_name = 'samplepdf.pdf' 
destination_container_name = 'container2' 

# Create client
client = BlobServiceClient.from_connection_string(connection_string) 

# Create sas token for blob
sas_token = generate_account_sas(
    account_name = client.account_name,
    account_key = account_key,
    resource_types = ResourceTypes(object=True),
    permission= AccountSasPermissions(read=True),
    expiry = datetime.utcnow() + timedelta(hours=4)
)

# Create blob client for source blob
source_blob = BlobClient(
    client.url,
    container_name = source_container_name, 
    blob_name = blob_name,
    credential = sas_token
)

# Create new blob and start copy operation
new_blob = client.get_blob_client(destination_container_name, blob_name)    
new_blob.start_copy_from_url(source_blob.url)

RESULT:

在此处输入图像描述

在此处输入图像描述

REFERENCES:

  1. General Limits
  2. How to copy a blob from one container to another container using Azure Blob storage SDK

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM