Calling Azure CDN Purge's REST API from Flow returns Unauthorized

只谈情不闲聊 提交于 2019-12-11 14:12:31

问题


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.

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

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:


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.



来源:https://stackoverflow.com/questions/52130448/calling-azure-cdn-purges-rest-api-from-flow-returns-unauthorized

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!