如何通过Azure ARM模板将证书上载到应用程序网关

问题描述 投票:0回答:2

我试图通过我的ARM模板脚本将证书上传到app网关。如何通过ARM脚本执行此操作。以下是我的脚本:

"backendHttpSettingsCollection": [
                    {
                        "name": "appGatewayBackendHttpSettings",
                        "properties": {
                            "Port": 80,
                            "Protocol": "Http",
                            "CookieBasedAffinity": "Disabled"
                        }
                    },
                    {
                        "name": "httpssettings",
                        "etag": "W/\"f5659c7c-d83a-431b-b456-097622a27c7b\"",
                        "properties": {
                            "provisioningState": "Succeeded",
                            "port": 8443,
                            "protocol": "Https",
                            "cookieBasedAffinity": "Enabled",
                            "connectionDraining": {
                                "enabled": false,
                                "drainTimeoutInSec": 60
                            },
                            "pickHostNameFromBackendAddress": false,
                            "path": null,
                            "requestTimeout": 300,
                            "authenticationCertificates": [
                                {
                                    "id": "[parameters('sslCertData')]"
                                }
                            ]
                        },
                        "type": "Microsoft.Network/applicationGateways/backendHttpSettingsCollection"
                    },
                    {
                        "name": "scalablehttpsettings",
                        "etag": "W/\"f5659c7c-d83a-431b-b456-097622a27c7b\"",
                        "properties": {
                            "provisioningState": "Succeeded",
                            "port": 7443,
                            "protocol": "Https",
                            "cookieBasedAffinity": "Enabled",
                            "connectionDraining": {
                                "enabled": false,
                                "drainTimeoutInSec": 60
                            },
                            "pickHostNameFromBackendAddress": false,
                            "path": null,
                            "requestTimeout": 300,
                            "authenticationCertificates": [
                                {
                                    "id": "[parameters('sslCertData')]"
                                }
                            ]
                        },
                        "type": "Microsoft.Network/applicationGateways/backendHttpSettingsCollection"
                    }
                ],

我想知道如何在authenticationCertificates下提供参数('sslCertData')的证书路径。任何人都可以帮助我。

PS:证书是.cer格式。

azure arm-template
2个回答
0
投票

你不能直接这样做。您需要将证书转换为base64并将其作为base64传递给应用程序网关。另外,我很确定你不能将.cer用于听众,只能用于auth(所以端到端的ssl)。工作实例:

"sslCertificates": [ // these certificates can be used for listeners
    {
        "name": "offloadCertificate",
        "properties": {
            "data": "base64_value_of_.pfx",
            "password": "password_for_.pfx"
        }
    }
],
"authenticationCertificates": [ // these only for end-to-end ssl
    {
        "name": "authenticationCertificate",
        "properties": {
            "data": "base64_value_of_.cer"
        }
    }
]

0
投票
We have to use and declare as shown below. It works like a charm.

"httpscertificate": { 
        "defaultValue":"Base64 converted value"
    "type": "string"
        },

"authenticationCertificates": [
                    {
                        "properties": {
                            "data": "[parameters('httpscertificate')]"
                        },
                        "name": "Appgatewaybackendcert"
                    }
                ],

"backendHttpSettingsCollection": [
                    {
                        "name": "appGatewayBackendHttpSettings",
                        "properties": {
                            "Port": 80,
                            "Protocol": "Http",
                            "CookieBasedAffinity": "Disabled"
                        }
                    },
                    {
                        "name": "nonscalablehttpssettings",
                        "etag": "W/\"f5659c7c-d83a-431b-b456-097622a27c7b\"",
                        "properties": {
                            "provisioningState": "Succeeded",
                            "port": 8443,
                            "protocol": "Https",
                            "cookieBasedAffinity": "Disabled",
                            "connectionDraining": {
                                "enabled": false,
                                "drainTimeoutInSec": 60
                            },
                            "pickHostNameFromBackendAddress": false,
                            "path": null,
                            "requestTimeout": 300,
                            "authenticationCertificates": [
                                {
                                    "Id": "[concat(variables('applicationGatewayID'), '/authenticationCertificates/checkpointsystems')]" //appGatewayBackendCert
                                }
                            ]
                        },
                        "type": "Microsoft.Network/applicationGateways/backendHttpSettingsCollection"
                    },
                    {
                        "name": "scalablehttpsettings",
                        "etag": "W/\"f5659c7c-d83a-431b-b456-097622a27c7b\"",
                        "properties": {
                            "provisioningState": "Succeeded",
                            "port": 7443,
                            "protocol": "Https",
                            "cookieBasedAffinity": "Disabled",
                            "connectionDraining": {
                                "enabled": false,
                                "drainTimeoutInSec": 60
                            },
                            "pickHostNameFromBackendAddress": false,
                            "path": null,
                            "requestTimeout": 300,
                            "authenticationCertificates": [
                                {
                                    "Id": "[concat(variables('applicationGatewayID'), '/authenticationCertificates/checkpointsystems')]"
                                }
                            ]
                        },
                        "type": "Microsoft.Network/applicationGateways/backendHttpSettingsCollection"
                    }
                ],
© www.soinside.com 2019 - 2024. All rights reserved.