Azure - 使用逻辑应用程序将大 blob 从一个容器复制到另一个容器

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

我成功构建了逻辑应用程序,只要在容器 1 中添加 blob,它就会被复制到容器 2。但是,当上传任何大于 50 MB(默认大小)的 blob 时,它会失败。 能否请指导一下。

通过 rest 添加 Blob api.

下面是流程,

目前,禁用分块的最大文件大小为 50MB。解决方法之一是使用 Azure 函数将文件从一个容器传输到另一个容器。

下面是示例 Python 当我尝试将文件从一个容器传输到另一个容器时对我有用的代码

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)

结果:

参考资料:

  1. General Limits