如何在Azure资源管理器模板中为Azure功能配置App Service托管证书?

问题描述

我有一个用于配置Function App的ARM模板。

这是我的ARM模板的示例,该模板处理Function App:

{
    "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')]","scale": null,"properties": {
    },"dependsOn": [
        "[resourceId('Microsoft.Web/sites',variables('nameWithDashes'))]"
    ]
}

保护我的Function App的下一步是将自定义域绑定到SSL证书。我正在尝试找到一种使用App Service托管证书的方法,以便Azure将自己创建和管理证书(请参阅下面的选项Create App Service Managed Certificate)。

App Service Managed Certificate

问题

如何在Azure资源管理器模板中为功能应用的自定义域配置应用服务托管证书?

解决方法

亚历克斯所说的似乎是正确的。您可以参考相关的parameters

enter image description here

有关更多详细信息,请参阅Alex发送的link

,

评论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]"
                  }
             }]
         }
     }
}