Calling Azure CDN Purge's REST API from Flow r

2019-09-01 03:05发布

I want to purge an Azure CDN endpoint from Microsoft Flow. The CDN Profile's Pricing Ties is Standard Verzion.

I have created a Microsoft Flow with an HTTP - HTTP action.

I used an URL generated by the tool shown by clicking on Try it on https://docs.microsoft.com/en-us/rest/api/cdn/endpoints/purgecontent and filling the necessary fields.

I want to purge all CDN content so I put the following as a body (I hope this is the right way as the official docs were silent about this use case).

{
  "contentPaths": [
    "/*"      
  ]
}

I have created a Registered application in the Azure Active Directory and used that to fill in Active Directory OAuth fields of the HTTP - HTTP action. I presume that the OAuth authentication is succeeding as if I put wrong values in any of the fields I get a respective error message.

So the HTTP - HTTP action is filled as on the following image. The image mostly shows where I got the values I used on the real flow.

enter image description here

When I run the flow it fails and shows just Unauthorized. inside the failed HTTP - HTTP action. HTTP box with Unauthorized written inside.

I have tried to add the app as a Contributor role of the CDN Profile but the error stayed the same.

How to get it working?

1条回答
我欲成王,谁敢阻挡
2楼-- · 2019-09-01 03:15

According to the error message, it seems that you missed the access token in the request.

If you want to generate the token for your azure ad app(service principal), you could refer to this article and the thread of generating the access token via postman.

Also, you could try to add the app as a role in the logic app.

查看更多
登录 后发表回答