Extract status of azure function activity in adf

Aniesha Razdan 20 Reputation points
2024-10-16T07:39:36.0566667+00:00

How to extract status of azure function activity in adf using dynamic expression? @activity('AzureFunction').output.executionDetails[0].status is not working as it is not able to find executionDetails in its output.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,015 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,727 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vinodh247 21,876 Reputation points
    2024-10-16T14:50:44.7466667+00:00

    Hi Aniesha Razdan,

    Thanks for reaching out to Microsoft Q&A.

    To extract the status of an Azure Function activity in Azure Data Factory (ADF), you can use the @activity expression in a dynamic way, but the property you're referencing (executionDetails[0].status) might not exist in the output schema for the Azure Function activity. Instead, to capture the status, you can rely on the standard output properties for activities.

    Here’s how you can try:

    1. Check the Activity Output: First, verify the actual structure of the output for your Azure Function activity by running the pipeline and checking the activity's output in the ADF monitor.
    2. Common Output Structure: The Azure Function activity typically has an output structure like this:

      { "StatusCode": 200, "Status": "Succeeded", "Output": { "SomeProperty": "Value" } }

    3. Extract Status: Assuming the status is directly available in the Status field, you can extract it using the following dynamic expression:

      @activity('AzureFunctionActivityName').output.Status

    4. Extract Status Code: If you need to capture the HTTP status code, you can use:

      @activity('AzureFunctionActivityName').output.StatusCode

    If the status or other details are embedded in a deeper nested object, adjust the expression accordingly based on the actual output schema that you see in the pipeline run history. If your azure function returns a custom response body, ensure your function is sending a response with clear status information that ADF can easily parse.

    Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Vinodh247 21,876 Reputation points
    2024-10-16T14:56:41.2033333+00:00

    Duplicate post

    0 comments No comments

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.