Azure Rest API: The request to patch workflow is not supported

Oguzhan YIGIT
Published by Oguzhan YIGIT
Category : Azure / Logic Apps
18/10/2019

I have recently used Azure REST API to manage Logic App Workflows in a custom Web application. One of my need was to update the Logic App trigger definition by using the Azure REST API.

 

Azure Logic App REST API Operations

Perfect, the Azure REST API has an endpoint for almost what you can do from Azure Portal. For Logic Apps, check the Azure REST API definition for Logic Apps. The API has a few Operation Groups including the “Workflows” group.

Azrue REST API Logic App Operation Groups

Usually, update operations are done with a “PATCH” or a “PUT” verb. I needed to patch the workflow definition, so I selected the “Update” Operation from  “Workflows” group. Well, the description of the operation is pretty clear: “Updates a workflow”.

Aure REST API Logic App Operations

This operation is a “PATCH” operation and is exactly what I need.

 

Azure Management SDK

Instead of writing my queries manually, I chose to use the Azure Management SDK. The Microsoft.Azure.Management.Logic library has managed clients to use Azure REST API operations for Azure Logic Apps.

 

Authentication through Azure REST API

I have implemented the Client Credentials flow to authenticate my custom application through Azure REST API. It has required to create an application on Azure AD with a client ID/client secret pair. Also, I had to authorize my Azure AD application through the subscription using RBAC. To make it simple, I set the application as a contributor to my subscription. Finally, on Azure AD, I added the ability to use Management API to my application.

 

Updating the Workflow

There were my troubles. The response to my call to the update operation was: “The request to patch workflow ‘XXXX’ is not supported. None of the fields inside the properties object can be patched.”. I tried to call the API without the SDK by sending a manual request (using .Net Core and HttpClient class): the same issue. Then, I tried to authenticate myself and I ended with the same issue. Finally, I used the Azure REST API portal “Try API” forms and the result was the same.

 

Use PUT Operation to update the Workflow definition

Well, shortly, the “PATCH” operation isn’t supported. However, the PUT operation works well for creating or updating the definition. Because PATCH and PUT operations got a different purpose, that means you can’t make partial updates of the definition. So you must send the whole workflow definition in the body of your PUT request.