Azure Durable Functions

This blogs talks about how to create a simple Durable Function App.

There are three components to Durable Function App.

  1. Main / Starter Function
  2. Workflow / Orchestrator Function
  3. Activity Function

Durable Function App needs all three functions. Main / Starter function is responsible for starting a workflow instance. Workflow / Orchestrator function has workflow logic, calls activities and waits for external events. Activity function, actual work is implemented here.

In this sample Durable Function App, we are going to create a workflow with three activities and one external event. We are going to start workflow via PostMan. We are also going to use PostMan to get workflow instance status and to fire external events. 

Here are high level steps:

  1. Create Function App
  2. Create Main / Starter Function
  3. Create Workflow Function
  4. Create Activity Function
  5. Start Workflow
  6. Workflow with external events

1. Create Function App

1. Log into Azure Portal:

3. Click on the Add button as shown below


4. In the search box, type Function App and click on the Function App resource as shown below


5. Click on Create button

6. In Function App blade, set name to devbootcampdurable as shown below


7. Click on the Create button

8. Once the resource is created, navigate to this newly created Function App resource

2. Add new Durable Function

1. Open a new tab in the browser and navigate to Azure portal

2. Go to devbootcamp Resource Group

3. Click on the devbootcampdurable{your alias} Function App

4. Hit >> button next to Functions

5. Select Function App Settings as shown below


6. Set the Function Runtime to beta as shown below


7. Now click on the + button next to Functions

8. Select “Custom function” as shown below


9. Change the Scenario to Durable Functions

10. Click on the “Durable Functions HTTP starter” C# Function as shown below


11. Next, you should see prompt to install Durable Extensions as shown below


12. This should take about 2 min to complete. If you don’t see this dialog box, try again: go back to step #7

13. Once the extension is installed, you should see this below success dialog box


14. Next, portal will prompt to create a new Function.

15. Set the name to Main as shown below


16. Review the Main function code.

17. See the functionName variable and instanceId variable


3. Add Workflow Function

1. Click on the + button next to Functions

2. Set the scenario to Durable Functions

3. Select Durable Orchestrator Function as shown below


4. Set the name of the function to WorkflowOne as shown below


5. Click on the Create button

6. Once the WorkflowOne is created, review the code.

7. There are three activity calls to Hello Function show below


8. Change the Function name from Hello to ActivityOne, ActivityTwo, ActivityThree as shown below


4. Add Activity One Function

1. Click on the + button next to Functions

2. Set the scenario to Durable Functions

3. Select Durable Functions activity as shown below


4. Set the name of the function to ActivityOne as shown below

5. Click on the Create button


6. Review the function code


7. Update the code as shown below:


8. Add two more activity functions, just go back to step # 1


5. Start Workflow

1. Click on the Main function

2. Click on the Get Function URL link as shown below


3. Next click on the copy


4. Open PostMan (install it from

5. Copy this URL into PostMan

6. Rename {funcitonName} with WorkflowOne as shown below.

7. Set the HTTP to POST and click on Send


8. Review response. Look for statusQueryGetUri


9. Now click on the statusQueryGetUri URL in the PostMan

10. Add these to end of the URL and click on the SEND as shown below



11. Review response. Look for output for the workflow and individual activities


6. Wait for External Event

1. Go back to WorkflowOne function

2. Add these lines before return statement as shown

string strApprovalEvent = await context.WaitForExternalEvent<string>("ApprovalEvent");

if(strApprovalEvent == "true")









3. Start a new instance of Workflow, by click on the PostMan URL. Follow the step #1 in the previous section

4. Now try to get the status of the Workflow, Follow the step # 9 in the previous section

5. Review the results. Workflow is still running and all three activities are done.

6. Workflow is now waiting for external event as shown below


7. Now, click on the sendEventPostUri URL from the PostMan results for starting workflow

8. Remane the {eventName} with ApprovalEvent as shown below


9. Change the HTTP method to POST

10. Select the Body, select raw and content type to JSON

11. In the body field type “true”

12. Hit Send button as shown below:


13. Now check the status again. Follow the step # 9 in the previous section

14. Review the output. Do you see Approved message ?



Comments (0)

Skip to main content