azure-resource-manager - 如何更改 CDN 端点源类型
问题描述
我已经创建并一直在使用指向应用程序网关的源类型为“自定义源”的 CDN 端点。现在我想将源类型更改为“Web 应用程序”并指向一个函数应用程序。我可以将hostName
属性更改为函数应用程序 URL,但我找不到更改源类型的方法,并且值仍然是“自定义源”。我看不到 ARM 模板中的属性,也看不到 PowerShell 命令行开关中的任何属性。有没有办法改变它还是我需要删除并重新创建?
解决方案
无需Origin type
手动更改,当您更改Origin hostname
为函数应用的url时,Origin type
将更改为Web App
自动。
试试下面的 powershell 命令,它对我有用。
在我的示例中,www-test-com
是Origin Name
,一旦创建就无法更改,因此您可以使用旧的。如果要更改它,则需要创建一个新端点。
$endpoint = Get-AzResource -ResourceId "/subscriptions/<subscription-id>/resourceGroups/<group-name>/providers/Microsoft.Cdn/profiles/<cdn-name>/endpoints/<endpoint-name>"
$endpoint.Properties.originHostHeader = "joyfun.azurewebsites.net"
$endpoint | Set-AzResource -Force
$origin = Get-AzResource -ResourceId "/subscriptions/<subscription-id>/resourcegroups/<group-name>/providers/Microsoft.Cdn/profiles/<cdn-name>/endpoints/<endpoint-name>/origins/www-test-com"
$origin.Properties.hostName = "joyfun.azurewebsites.net"
$origin | Set-AzResource -Force
运行命令后,结果将如下所示。
推荐阅读
- python - 巨大的稀疏 Csr_matrix tp Pandas 数据帧的转换
- javascript - 如何将方法添加到多个变量
- java - Java Android 错误:类是抽象的,无法实例化
- jsf - 如何使用 primefaces 日历过滤日期范围?
- python - Pytest-django 依赖注入
- .htaccess - 使用 /?1 重定向 URL
- docker - 在 docker 映像中运行的詹金斯管道只是挂起
- tensorflow - tf.gradients 是如何管理复杂函数的?
- qt - 如何获得满足给定 QPainterPath 的点列表?
- apache-spark - 如何读取多行文本文件(分隔符换行符)作为不同 csv 数据文件的标题?