Azure 刷新 Front Door CDN 缓存

2025-06-28 20:32:00
丁国栋
原创 13
摘要:本文记录如何通过命令行或API清除 Azure Front Door (CDN)缓存。

Azure 的自动化操作的方法和参数值一般可以在Azure的具体资源的 Automation 选项卡下的 CLI/PS 中找到。

例如在本例中,浏览器访问的URL为“https://portal.azure.com/#@myaccount.onmicrosoft.com/resource/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myresourcegroup/providers/Microsoft.Cdn/profiles/myprofile/endpoints/myendpoint/automationapis”。

命令行登录 az

注:命令行会显示登录URL或直接打开浏览器跳转到。

az login

列出 订阅ID

az account list
az account show

列出组名

注:资源组名是非常容易找到的,在任意资源的概况/概览页面都有。

az group list

列出 Profile

az afd profile list --resource-group myresourcegroup --subscription 00000000-0000-0000-0000-000000000000
列出 EndPoint
az cdn endpoint list --resource-group myresourcegroup --profile-name myprofile --subscription 00000000-0000-0000-0000-000000000000

列出 Domain

az cdn custom-domain list --resource-group myresourcegroup --profile-name myprofile --endpoint-name myendpoint --subscription 00000000-0000-0000-0000-000000000000

清除 Azure Front Door (CDN)缓存

az afd endpoint purge \
--resource-group myresourcegroup \
--profile-name myprofile \
--endpoint-name myendpoint \
--domains www.contoso.com \
--content-paths '/scripts/*'

如果成功,则没有结果输出,如果失败则会提示错误。

--

发表评论
博客分类