Search code examples
azureazure-resource-managerazure-cdn

Azure CDN purge fails with error InvalidResource"


CDN purge is working when I do it from azure portal but when I tried the same using arm api, it fails with

{
  "error": {
    "code": "InvalidResource",
    "message": "The resource format is invalid."
  }
}

Here's the api:

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/endpoints/{endpointName}/purge?api-version=2016-10-02

I am able to do CDN Start, CDN load via API's except this purge which is my requirement :-(

Any help on this will be appreciated in tons :-)


Solution

  • Finally after 62+ purge requests I found out that contentPaths in the request body had issues.

    It should be this format

    {
      "contentPaths": [
        "(String)"
      ]
    }