使用 ARM 模板部署在 Azure Front Door 自定义域上启用 HTTPS

Dav*_*ard 9 https azure azure-rm-template azure-front-door

我正在通过 ARM 模板部署 Azure Front Door,并尝试在自定义域上启用 HTTPS。

根据Front DoorAzure 文档,有一个快速入门模板“将自定义域添加到您的 Front Door 并使用通过 DigiCert 生成的 Front Door 托管证书为其启用 HTTPS 流量”。但是,虽然这会添加自定义域,但它不会启用 HTTPS。

查看 Front DoorARM 模板参考,我看不到任何明显的启用 HTTPS 的方法,但也许我遗漏了什么?

尽管有以下附加信息,我还是希望能够通过 ARM 模板部署在 Front Door 自定义域上启用 HTTPS。这在这个时候可能吗?

附加信息

请注意,有一个启用 HTTPSREST 操作,但这似乎不适用于 Front Door 托管证书 -

POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/frontDoors/{frontDoorName}/frontendEndpoints/{frontendEndpointName}/enableHttps?api-version=2019-05-01
{
    "certificateSource": "FrontDoor",
    "protocolType": "ServerNameIndication",
    "minimumTLSVersion": "1.2"
}
Run Code Online (Sandbox Code Playgroud)

还有一个AzPowerShell cmdlet 来启用 HTTP,它确实有效。

Enable-AzFrontDoorCustomDomainHttps -ResourceGroupName "lmk-bvt-accounts-front-door" -FrontDoorName "my-front-door" -FrontendEndpointName "my-front-door-rg"
Run Code Online (Sandbox Code Playgroud)

Sim*_*ory 5

更新:这个实现目前似乎不稳定并且只是间歇性地工作,这表明它可能还没有准备好生产。

在跟踪最新的 Front Door API ( 2020-01-01) 规范(似乎尚未在 MS 参考网站上完全发布)之后,现在这实际上似乎可以通过 ARM 模板实现:

https://github.com/Azure/azure-rest-api-specs/tree/master/specification/frontdoor/resource-manager/Microsoft.Network/stable/2020-01-01

对象中有一个新customHttpsConfiguration属性frontendEndpoint properties

"customHttpsConfiguration": {
  "certificateSource": "AzureKeyVault" // or "FrontDoor",        
  "minimumTlsVersion":"1.2",
  "protocolType": "ServerNameIndication",

  // Depending on "certificateSource" you supply either:
  "keyVaultCertificateSourceParameters": {
    "secretName": "<secret name>",
    "secretVersion": "<secret version>",
    "vault": {
      "id": "<keyVault ResourceID>"
    }
  }

  // Or:
  "frontDoorCertificateSourceParameters": {
    "certificateType": "Dedicated"
  }
}
Run Code Online (Sandbox Code Playgroud)

KeyVault 托管 SSL 证书示例

注意:我已经对此进行了测试并且似乎可以正常工作。

    {
      "type": "Microsoft.Network/frontdoors",
      "apiVersion": "2020-01-01",
      "properties": {
        "frontendEndpoints": [
         {
            "name": "[variables('frontendEndpointName')]",
            "properties": {
              "hostName": "[variables('customDomain')]",
              "sessionAffinityEnabledState": "Enabled",
              "sessionAffinityTtlSeconds": 0,
              "webApplicationFirewallPolicyLink": {
                "id": "[variables('wafPolicyResourceId')]"
              },
              "resourceState": "Enabled",
              "customHttpsConfiguration": {
                "certificateSource": "AzureKeyVault",        
                "minimumTlsVersion":"1.2",
                "protocolType": "ServerNameIndication",
                "keyVaultCertificateSourceParameters": {
                  "secretName": "[parameters('certKeyVaultSecret')]",
                  "secretVersion": "[parameters('certKeyVaultSecretVersion')]",
                  "vault": {
                    "id": "[resourceId(parameters('certKeyVaultResourceGroupName'),'Microsoft.KeyVault/vaults',parameters('certKeyVaultName'))]"
                  }
                }
              }
            }
          }
        ],
        ...
      }
    }
Run Code Online (Sandbox Code Playgroud)

前门管理 SSL 证书示例

看起来您需要设置 FrontDoor 托管证书:

注意:我没有测试过这个

    {
      "type": "Microsoft.Network/frontdoors",
      "apiVersion": "2020-01-01",
      "properties": {
        "frontendEndpoints": [
         {
            "name": "[variables('frontendEndpointName')]",
            "properties": {
              "hostName": "[variables('customDomain')]",
              "sessionAffinityEnabledState": "Enabled",
              "sessionAffinityTtlSeconds": 0,
              "webApplicationFirewallPolicyLink": {
                "id": "[variables('wafPolicyResourceId')]"
              },
              "resourceState": "Enabled",
              "customHttpsConfiguration": {
                "certificateSource": "FrontDoor",        
                "minimumTlsVersion":"1.2",
                "protocolType": "ServerNameIndication",
                "frontDoorCertificateSourceParameters": {
                  "certificateType": "Dedicated"
                }
              }
            }
          }
        ],
        ...
      }
    }
Run Code Online (Sandbox Code Playgroud)

  • 至少对我来说完全不起作用。部署成功,但此部分被忽略。HTTP 继续被禁用。 (2认同)

Dav*_*sen 0

我能够使用Azure 管理 API成功进行enableHttps REST 调用。

我收到了成功的响应,并且可以在portal.azure.comresource.azure.com站点中查看资源结果。不过,我非常确定 Management API 和 PowerShell 方法是目前唯一受支持的方法。由于证书和处理可能需要一些验证,因此他们尚未将其包含在 ARM 模板中。鉴于验证可能非常重要,最好先确认您的配置在 UI 中可行,然后再将其自动化(恕我直言)。