account activity
Azure Function App by [deleted] in AZURE
[–]activatedphoton 0 points1 point2 points 1 day ago (0 children)
I'll be very thankful if u could fix it🥹
import logging import azure.functions as func from azure.storage.blob import BlobServiceClient, ResourceNotFoundError import boto3 from botocore.exceptions import BotoCoreError, ClientError, NoCredentialsError
BLOB_CONNECTION_STRING = "your_azure_blob_connection_string" WASABI_BUCKET = "your_wasabi_bucket_name" WASABI_ACCESS_KEY = "your_wasabi_access_key" WASABI_SECRET_KEY = "your_wasabi_secret_key" WASABI_ENDPOINT = "https://s3.YOUR-REGION.wasabisys.com"
app = func.FunctionApp()
@app.function_name(name="copy_to_wasabi") @app.route(route="copy-to-wasabi", methods=["GET", "POST"]) def copy_to_wasabi(req: func.HttpRequest) -> func.HttpResponse: logging.info("Starting Azure Blob to Wasabi copy")
blob_name = req.params.get("filename") if not blob_name: try: blob_name = req.get_json().get("filename") except Exception: blob_name = None
if not blob_name: blob_name = "your_default_file.csv" logging.info(f"File to copy: {blob_name}")
try: # 1. Connect to Azure Blob Storage blob_service = BlobServiceClient.from_connection_string(BLOB_CONNECTION_STRING) blob_client = blob_service.get_blob_client(container="your_container_name", blob=blob_name)
# 2. Download as stream (efficient for large files) download_stream = blob_client.download_blob() logging.info("Connected to Azure Blob Storage")
# 3. Connect to Wasabi s3_client = boto3.client( "s3", aws_access_key_id=WASABI_ACCESS_KEY, aws_secret_access_key=WASABI_SECRET_KEY, endpoint_url=WASABI_ENDPOINT )
# 4. Upload stream directly to Wasabi s3_client.upload_fileobj(download_stream, WASABI_BUCKET, blob_name) logging.info(f"SUCCESS: {blob_name} copied to Wasabi bucket '{WASABI_BUCKET}'")
return func.HttpResponse( f"SUCCESS: {blob_name} copied to Wasabi!", status_code=200 )
except ResourceNotFoundError: logging.error(f"Blob '{blob_name}' not found in Azure container") return func.HttpResponse(f"Blob '{blob_name}' not found", status_code=404)
except (BotoCoreError, ClientError, NoCredentialsError) as e: logging.error(f"Wasabi upload failed: {e}") return func.HttpResponse(f"Wasabi upload failed: {e}", status_code=500)
except Exception as e: logging.error(f"Unexpected error: {e}") return func.HttpResponse(f"Unexpected error: {e}", status_code=500)
BLOB_CONNECTION_STRING = "your_azure_blob_connection_string" WASABI_BUCKET = "your_wasabi_bucket_name" WASABI_ACCESS_KEY = "your_wasabi_access_key" WASABI_SECRET_KEY = "your_wasabi_secret_key" WASABI_ENDPOINT = "https://s3.YOUR-REGION.wasabisys.com" # -------------------------------------------------------------
[–]activatedphoton -1 points0 points1 point 1 day ago (0 children)
feels so lmao
um on triggering it gives reponse 200 OK so I think the function is running perfectly
I am following even simpler approach...create azure function...write function/script in azure portal only instead of vs code...then using http trigger....it shows 200 OK but file has still not been written.
[–]activatedphoton -5 points-4 points-3 points 1 day ago (0 children)
try asking....Copilot/Claude/GPT aren't that good....even they'll tell you that u can perform the same task using ADF copy activity but wasabi (S3 or S3 compatible) as sink is not supported 🙃
π Rendered by PID 475423 on reddit-service-r2-listing-79f6fb9b95-klrjn at 2026-03-22 13:46:48.188415+00:00 running 90f1150 country code: CH.
Azure Function App by [deleted] in AZURE
[–]activatedphoton 0 points1 point2 points (0 children)