如何清除 Azure CDN 以刷新任何缓存的内容?

How to purge the Azure CDN to refresh any cached content?

我上传新内容到CDN时需要刷新内容。当内容发生变化时,更新后的数据立即可用非常重要。但是 CDN 缓存并且它不会立即反映。

我参考了网站“https://msdn.microsoft.com/en-us/library/mt634451.aspx”并尝试实施相同的网站。但是,当我尝试点击它时,出现授权错误。

{ "error":{ "code": "AuthenticationFailed", "message": "Authentication failed. The 'Authorization' header is missing." } }

但是这篇文章没有提供关于需要进入授权的信息 header。有人可以在这里帮助我,了解如何构建此授权 header 吗?如果您需要更多详细信息,请告诉我。

注意:我检查了 SO post 'How do I force Azure CDN content to be purged or invalidated?' 它确实给 msdn link link (同上),但不涉及授权header。

您正在使用正确的 API,但没有通过您的应用程序使用 Azure API 身份验证。您可以在此处找到有关如何验证 API 请求以及可重用代码示例的详细信息:Azure Authentication - Authenticating any Azure API Request in your Application

或者,您可以使用新的门户 Web 界面清除。在此处找到有关如何执行此操作的详细信息:Purge an Azure CDN endpoint