I want my Azure Function to transfer a file from an SFTP path to a Blob Storage path using the existing sftpDownload function. However, I also need the function to immediately return an acknowledgment response to the Logic App upon being triggered, and th

Somya Mishra 0 Reputation points
2025-05-16T13:55:06.93+00:00

I want my Azure Function to transfer a file from an SFTP path to a Blob Storage path using the existing sftpDownload function. However, I also need the function to immediately return an acknowledgment response to the Logic App upon being triggered, and then continue executing the file transfer and other tasks asynchronously. Since the function can take more than 3 minutes to complete for large files, it's important that the Logic App doesn't wait for the entire process to finish.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,883 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. RithwikBojja 3,055 Reputation points Microsoft External Staff Moderator
    2025-05-19T05:52:26.54+00:00

    Hi @Somya Mishra ,

    Azure functions general last step is returning the response, the most reliable way is using 2 functions inside one function app, that is Logic app is calling first function and it gets a response and then it can continue the next process, then the 1st function app calls the 2nd one which actually transfers the file or the operation you want to do(You can also use a Queue function and http triggered function combination too).

    Alternatively, you can also use Azure Durable Functions

    Sample function which responds first and also completes the pending functions:

    
    import time
    
    import azure.functions as func
    
    import azure.durable_functions as df
    
     
    
    myApp = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)
    
     
    
    @myApp.route(route="orchestrators/{functionName}")
    
    @myApp.durable_client_input(client_name="client")
    
    async def http_start(req: func.HttpRequest, client):
    
        function_name = req.route_params.get('functionName')
    
        instance_id = await client.start_new(function_name)
    
        response = client.create_check_status_response(req, instance_id)
    
        return response
    
     
    
    # Orchestrator
    
    @myApp.orchestration_trigger(context_name="context")
    
    def sftp_orchestrator(context):
    
        result1 = yield context.call_activity("hello", "Rithwik")
    
        result2 = yield context.call_activity("hello", "Bojja")
    
        result3 = yield context.call_activity("hello", "Chotu")
    
        return [result1, result2, result3]
    
     
    
    @myApp.activity_trigger(input_name="city")
    
    def hello(city: str):
    
        time.sleep(30)
    
        return f"Hello {city}"
    
    

    Here, it initially returns the orchestrator url and all as a response, but you will get orchestrator response after 1 min 30 sections as sleep is 30 sec and it is called 3 times. To just make it wait. In your function you can transfer file in this time or more time.

    Here, I have used Python, you can use other languages too.

    This is how you can get the desired results.

    For further you can refer to [Ms-Doc] on Durable functions.


    If this answer was helpful, please click "Accept the answer" and mark Yes, as this can help other community members.

    enter image description here

    If you have any other questions or are still experiencing issues, feel free to ask in the "comments" section, and I'd be happy to help.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.