Developing Custom Connector in MS Power Automate using Azure ML Services

Recently we had a chance to work on developing a custom connector in Microsoft Power Automate. We had to consume Microsoft Azure Machine Learning Services model using REST API and perform prediction. For this purpose, we used KAISPE Student Churn Prediction model and the business scenario we completed was to predict student churn when a set of input data is uploaded on Microsoft OneDrive folder in CSV form.

We started with a blank connector (Create from blank). After providing the REST API URL, we used “API Key” as the authentication mechanism with “Authorization” as the only header parameter.

1 1024x448 - Developing Custom Connector in MS Power Automate using Azure ML Services

Next in the connector Definition, we added an action. By definition, “Actions determine the operations that users can perform. Actions can be used to read, create, update or delete resources in the underlying connector.” Then we provided the Request operation “POST” along with URL and body as shown below:

2 1024x467 - Developing Custom Connector in MS Power Automate using Azure ML Services

The default response was also provided. In our case, the Response JSON looks like this. If you are using Postman, it would be a lot easier for you to get these JSONs and test your API connection.

{
“Results”:     {
“WebServiceOutput0”:     [
{
“Scored Labels”: “string”,
“Scored Probabilities”: 0.0
}
]
}
}

3 1024x472 - Developing Custom Connector in MS Power Automate using Azure ML Services

In the last step, we tested the custom connector functionality by providing the REST API key of our Azure machine learning model. An important point to note here is since our API was expecting the following in header:

Authorization: Bearer <API Key>

So we had to use Bearer UEEF(#(#NDNDJD in the Connection value. Then we provided the sample input in JSON to test the connector operation to receive the response successfully as shown below:

4 1024x502 - Developing Custom Connector in MS Power Automate using Azure ML Services

We are now ready to use this connector in any flow. An example is shown below:

6 1024x407 - Developing Custom Connector in MS Power Automate using Azure ML Services

We hope you have found it useful. For any queries, please contact info@kaispe.com

Leave a Reply

avatar
  Subscribe  
Notify of