azure authentication via 'HTTP Client POST' operation.

I'm trying to authenticate against the azure endpoint login.windows.net using the http client post operation but I'm unable to get it working correctly.

The request looks like this

URL : https://login.windows.net/${subscriptionid}/oauth2/token

Header : Content-Type: application/x-www-form-urlencoded, Accept: application/json

Body: grant_type=client_credentials&client_id=${client_id}&client_secret=${client_secret}&resource=${audiences}

Works fine in postman and returns a json response but I recieve a html form response when performing it with the http cllient post action.

/Base [1.10.0]/Library/Operations/HTTP Client/v2.0/Http Client Post

What I get when using the OO Action is a form response

 

<head>
<title>Continue</title>
</head>
<body>
<form method="POST" name="hiddenform" action="https://login.microsoftonline.com/*******************/oauth2/authorize">
<input type="hidden" name="grant_type" value="client_credentials" />
<input type="hidden" name="client_id" value="*****************************" />
<input type="hidden" name="client_secret" value="*********************" />
<input type="hidden" name="resource" value="https://adminmanagement.tenant.onmicrosoft.com/****************************" />
<noscript>
<p>Script is disabled. Click Submit to continue</p>
<input type="submit" value="Submit" />
</noscript>
</form>
<script language="javascript">window.setTimeout('document.forms[0].submit()', 0);</script>
</body>
</html>;reasonPhrase=OK;finalLocation=https://login.windows.net/***********************/oauth2/authorize;protocolVersion=HTTP/1.1;statusCode=200;Result=<html>

 

Any ideas on where I can go with this? I saw another person mention that they have to use a powershell rest invoke instead, but I'm doing this mainly to avoid using powershell.

 

edit : the cloud content pack has an auth operation but only supports username/password not applications for credentials.