我有一个 ARM 模板,我正在其中配置函数应用程序。
以下是处理 Function App 的 ARM 模板示例:
{
"apiVersion": "2015-08-01",
"type": "Microsoft.Web/sites",
"name": "MyAzureFunctionName",
"location": "[resourceGroup().location]",
"kind": "functionapp",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', variables('nameWithDashes'))]",
"[resourceId('Microsoft.Storage/storageAccounts', variables('storageName'))]"
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'MyAzureFunctionName')]",
"httpsOnly": true,
"siteConfig": {
"appSettings": [
{
...
}]
}
}
}
我已使用以下配置在我的 Function App 中成功配置了自定义域“mydomain.ca”:
{
"apiVersion": "2020-06-01",
"type": "Microsoft.Web/sites/hostNameBindings",
"name": "[concat('MyFunctionApp', '/', 'mydomain.ca')]",
"location": "[resourceGroup().location]",
"scale": null,
"properties": {
},
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('nameWithDashes'))]"
]
}
保护 Function App 安全的下一步是将自定义域绑定(bind)到 SSL 证书。我正在尝试找到一种使用应用服务托管证书的方法,以便 Azure 自行创建和管理证书(请参阅下面的选项创建应用服务托管证书
)。
问题
如何在 Azure 资源管理器模板中为 Function App 的自定义域配置应用服务托管证书?
最佳答案
评论Alex made帮了很多忙;它拥有所有重要的部分。但是我无法使用链接的模板使其工作。
我没有使用链接模板,而是转而使用 a nested template并且立即生效。
{
"apiVersion": "2020-06-01",
"name": "nestedTemplate",
"type": "Microsoft.Resources/deployments",
"dependsOn": [
"[resourceId('Microsoft.Web/sites', variables('siteName'))]",
"[resourceId('Microsoft.Web/certificates', variables('certificateName'))]"
],
"properties": {
"mode": "Incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [{
"apiVersion": "2019-08-01",
"type": "Microsoft.Web/sites/hostnameBindings",
"name": "[variables('hostNameBindingsName')]",
"location": "[resourceGroup().location)]",
"properties": {
"sslState": "SniEnabled",
"thumbprint": "[reference(resourceId('Microsoft.Web/certificates', variables('certificateName'))).Thumbprint]"
}
}]
}
}
}
关于azure - 如何在 Azure 资源管理器模板中为 Azure 函数配置应用服务托管证书?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63661222/