CDN Library for .NET. purge BadRequest Exception: only accept 100 paths but only sent 2

Sergio Solorzano 26 Reputation points
2021-05-18T15:19:28.733+00:00

Hello

I have followed this tutorial to purge with a cdn end point using Azure CDN Library for .NET. I use Azure CDN Standard from Microsoft.

I purged all (path is /) once and it worked.
cdn.Endpoints.PurgeContent(resourceGroupName,profileName,endpointName, new List<string>() { "/
" });

I purged again after 10 minutes and got exception and see this error for Response Content:
Content "{\n \"error\": {\n \"code\": \"BadRequest\",\n \"message\": \"We can only accept 100 paths for purging concurrently. Please try again in a few minutes.\"\n }\n}" string

I don't see any problems with the query (e.g. authentication, token all seem fine etc).

The CDN cached 6 files at the time, so assuming Purge All breaks out into each file path, that's a total of 6. Plus the other 6 in the prior purge that's 12. Why the 100 paths error? This problem was raised in stackoverflow in 2020 for Akamai but no response.

I note I see in Logs that 12 minutes later Azure retried the purge (I didn't fire it again) and it succeeded. Is it the case when a Badrequest occurs the PurgeContent fires back after sometime?

After some testing we find this problem happens when the registered app for Access Control only has CDN Endpoint Contributor role assigned (shouldn't be the case because this role has purge permission -> Microsoft.Cdn/profiles/endpoints/Purge/action, Microsoft.Cdn/operationresults/profileresults/endpointresults/Purge/action, Microsoft.Cdn/operationresults/profileresults/afdendpointresults/Purge/action). The exception does not happen when the registered app also has CDN Profile Contributor role assigned. FYI the CDN Profile we create has several end points and we do not wish for the registered app to have a role on other end points of the profile. Is this a bug?

Please help to understand concurrent purging count.

Thank you, Sergio

Azure Content Delivery Network
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.