azure - 如何在 Azure 资源管理器模板中为 Azure 函数配置应用服务托管证书?

标签 azure azure-functions azure-resource-manager

我有一个 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 自行创建和管理证书(请参阅下面的选项创建应用服务托管证书)。

App Service Managed Certificate

问题

如何在 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/

相关文章:

azure - 如何获取队列触发的azure函数的运行时状态?

azure - 该表达式引用了它自己的声明,这是不允许的。bicep(BCP079) Bicep 错误

azure - 如何在 Windows Azure Active Directory 身份验证后获取访问 token

Azure 容器实例与 Azure Functions

azure - 在代码中获取 Azure Web App 名称

azure - 基于计时器的触发器 - 本地测试

Azure DevOps - 在 ARM 模板参数中使用 ARM 输出

azure - 如何使用 Arm 模板获取应用服务中的主体 Id?

azure - 如何通过添加SSL证书修复Azure错误?

azure - 使用 Azure 数据管理网关安装 Power BI Gateway 本地服务器?