Running Azure Durable Functions in VS Code

Hello All,

Azure Durable Functions are great new addition to the exciting Azure Serverless offerings! They allow you to create complex Azure Functions workflows completely in code. You can find more information in my previous post –  https://azurekan.wordpress.com/2017/11/13/azure-durable-functions/

If you use Visual Studio, you can find instructions how to run sample code here – https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-install

In this post I want to share how easy is to achieve the same result in Visual Studio Code. 

In order to speed you up I created this “Hello World” project in GitHub – https://github.com/gled4er/vs-code-azure-durable-functions-hello-world

If you follow the instructions in the README file you will be able to run the Azure Durable Functions in VS Code in less than 5 minutes – https://github.com/gled4er/vs-code-azure-durable-functions-hello-world/blob/master/README.md:

1. Clone the project – https://github.com/gled4er/vs-code-azure-durable-functions-hello-world

2. Install Azure Functions Cross Platform Tools (more info here http://bit.ly/2ftaOIC) by running the following command (you will need Node.js 8.5 and later):

npm i -g azure-functions-core-tools@core 

If you already have the tools, please be sure to update them to the latest available version. Only after updating to Azure Functions Core Tools (2.0.1-beta.21) and Function Runtime Version 2.0.11370.0 we were able to run the sample successfully on Mac.

3. Navigate the to folder and add Durable Functions Extenstion by running the following command:

func extensions install -p Microsoft.Azure.WebJobs.Extensions.DurableTask -v 1.0.0-beta

4. Start local Azure Storage Emulator v5.2 (or later) or use connection string to existing Azure Storage account

5. Add local.setting.json file next to host.json file and then modify local.settings.json file to look similar to if you use Azure Storage Emulator or provide the connection string to your storage account in Azure:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true"
  }
}

6. Start the project by running the following command in the folder of your function app:

func host start 

7. In Postman or with cURL call the endpoint provided by Azure Functions Tools:

curl -X POST http://localhost:7071/api/orchestrators/HelloSequence

8. You can check the progress of your function by calling “statusQueryGetUri” endpoint provided in the response similar to:

url -X GET 'http://localhost:7071/runtime/webhooks/DurableTaskExtension/instances/9c71ff5ff9f34e4f82f882c795bb20fa?taskHub=DurableFunctionsHub&connection=Storage&code=xuqaAlxP%2F%2FjlrBxU%2FL8kE5jjzMzhHysVVUucYItg6rBPJvAAIetd%2FA%3D%3D'

9. Great! You are now able to run Azure Durable Functions in VS Code! Congratulations!!!

Let us know what ideas you have and how we can help you be more successful with Azure Functions and Azure Durable Functions! Please contact me here or at @azurekanio

Thank you!

Kanio

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s