问题
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