mTLS パススルー リスナーを使用して Azure Application Gateway をデプロイする

このクイックスタートでは、Azure Resource Manager テンプレート (ARM テンプレート) と API バージョン を使用して、2025-03-01 を使用してAzure Application Gatewayをデプロイする方法について説明します。 パススルー モードでは、ゲートウェイはクライアント証明書を要求しますが、検証は行いません。 証明書の検証とポリシーの適用はバックエンドで行われます。

主な機能

  • SSL プロファイルを mTLS パススルーのリスナーに関連付けます。
  • ゲートウェイでクライアント CA 証明書は必要ありません。
  • verifyClientAuthMode プロパティは、Strict値とPassthrough値をサポートします。
  • サポート: mTLS パススルーは、Azure ポータルで直接構成できます。

パススルー構成に対する PowerShell と CLI のサポートは現在使用できません。 mTLS パススルーは、Azure ポータルまたは ARM テンプレートを使用して構成できます。

Azure ポータルを使用して mTLS パススルーを構成する

Azure ポータルで mTLS パススルーを直接構成するには、Passthrough クライアント認証方法を使用して SSL プロファイルを作成します。

  1. Azure ポータルで Application Gateway リソースに移動します。

  2. [ 設定] で、[ SSL プロファイル] を選択します。

  3. [ + 追加] を選択して新しい SSL プロファイルを作成します。

  4. SSL プロファイルの名前を入力します。

  5. [ クライアント認証 ] タブで、[ パススルー] を選択します。

    パススルー モードでは、クライアント証明書は省略可能であり、バックエンド サーバーがクライアント認証を担当します。

クライアント認証方法にパススルーが選択されたAzureポータルの [SSL プロファイルの作成] ダイアログを示すスクリーンショット。

  1. 必要に応じて SSL ポリシー設定を構成します。
  2. [ 追加] を選択して SSL プロファイルを作成します。
  3. SSL プロファイルを HTTPS リスナーに関連付けます。

[前提条件]

  • Azure サブスクリプションとリソース グループ。
  • Azure CLIローカルにインストールされます。
  • SSL 証明書 (Base64 でエンコードされた PFX) とパスワード。
  • Linux VM 管理者用の SSH キー (該当する場合)。
  • パススルー プロパティ 2025-03-01 以降の API バージョン。

mTLS パススルー リスナーを使用して Application Gateway をデプロイする

このテンプレートでは、次のリソースを作成します。

  • 2 つのサブネット (Application Gateway に委任されたサブネット) を持つ仮想ネットワーク。
  • ゲートウェイ フロントエンドのパブリック IP アドレス。
  • Application Gateway (Standard_v2) で次の機能を使用します。
    • クライアント証明書パススルーの SSL 証明書と SSL プロファイル。
    • HTTPS リスナーとルーティング規則。
    • アプリケーション サービスを指すバックエンド プール。

構成の詳細でテンプレートを更新し、有効な SSL 証明書を含めます。

パラメーター ファイル: deploymentParameters.json

{
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "addressPrefix": {
            "value": "10.0.0.0/16"
        },
        "subnetPrefix": {
            "value": "10.0.0.0/24"
        },
        "skuName": {
            "value": "Standard_v2"
        },
        "capacity": {
            "value": 2
        },
        "adminUsername": {
            "value": "ubuntu"
        },
        "adminSSHKey": {
            "value": "<your-ssh-public-key>"
        },
        "certData": {
            "value": "<Base64-encoded-PFX-data>"
        },
        "certPassword": {
            "value": "<certificate-password>"
        }
    }
}

テンプレート ファイル: deploymentTemplate.json

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
        "addressPrefix": {
            "defaultValue": "10.0.0.0/16",
            "type": "String",
            "metadata": {
                "description": "Address prefix for the Virtual Network"
            }
        },
        "subnetPrefix": {
            "defaultValue": "10.0.0.0/24",
            "type": "String",
            "metadata": {
                "description": "Subnet prefix"
            }
        },
        "skuName": {
            "defaultValue": "Standard_Medium",
            "type": "String",
            "metadata": {
                "description": "Sku Name"
            }
        },
        "capacity": {
            "defaultValue": 2,
            "type": "Int",
            "metadata": {
                "description": "Number of instances"
            }
        },
        "adminUsername": {
            "type": "String"
        },
		"adminSSHKey": {
            "type": "securestring"
        },
        "certData": {
            "type": "String",
            "metadata": {
                "description": "ssl cert data"
            }
        },
        "certPassword": {
            "type": "SecureString",
            "metadata": {
                "description": "ssl cert password"
            }
        }
    },
    "variables": {
        "applicationGatewayName": "mtlsAppGw",
        "idName": "identity",
        "publicIPAddressName": "mtlsPip",
        "virtualNetworkName": "mtlsVnet",
        "subnetName": "appgwsubnet",
        "vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
        "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
        "publicIPRef": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]",
        "applicationGatewayID": "[resourceId('Microsoft.Network/applicationGateways',variables('applicationGatewayName'))]",
        "apiVersion": "2025-03-01",
        "identityID": "[resourceId('Microsoft.ManagedIdentity/userAssignedIdentities',variables('idName'))]",
        "backendSubnetId": "[concat(variables('vnetID'),'/subnets/backendsubnet')]"
    },
    "resources": [
        {
            "type": "Microsoft.Network/virtualNetworks",
            "name": "[variables('virtualNetworkName')]",
            "apiVersion": "2024-07-01",
            "location": "[resourceGroup().location]",
            "properties": {
                "addressSpace": {
                    "addressPrefixes": [
                        "[parameters('addressPrefix')]"
                    ]
                },
                "subnets": [
                    {
                        "name": "[variables('subnetName')]",
                        "properties": {
                            "addressPrefix": "[parameters('subnetPrefix')]",
                             "delegations": [
                                {
                                    "name": "Microsoft.Network/applicationGateways",
                                    "properties": {
                                        "serviceName": "Microsoft.Network/applicationGateways"
                                    }
                                }
                            ]
                        }
                    },
                    {
                        "name": "backendSubnet",
                        "properties": {
                            "addressPrefix": "10.0.2.0/24"
                        }
                    }
                ]
            }
        },
        {
            "type": "Microsoft.Network/publicIPAddresses",
            "sku": {
                "name": "Standard"
            },
            "name": "[variables('publicIPAddressName')]",
            "apiVersion": "2024-07-01",
            "location": "[resourceGroup().location]",
            "properties": {
                "publicIPAllocationMethod": "Static"
            }
        },
        {
            "type": "Microsoft.Network/applicationGateways",
            "name": "[variables('applicationGatewayName')]",
            "apiVersion": "[variables('apiVersion')]",
            "location": "[resourceGroup().location]",
            "properties": {
                "sku": {
                    "name": "Standard_v2",
                    "tier": "Standard_v2",
                    "capacity": 3
                },
                "sslCertificates": [
                    {
                        "name": "sslCert",
                        "properties": {
                            "data": "[parameters('certData')]",
                            "password": "[parameters('certPassword')]"
                        }
                    }
                ],
                "sslPolicy": {
                    "policyType": "Predefined",
                    "policyName": "AppGwSslPolicy20220101"
                },
                "sslProfiles": [
                    {
                        "name": "sslnotrustedcert",
                        "id": "[concat(resourceId('Microsoft.Network/applicationGateways',  variables('applicationGatewayName')), '/sslProfiles/sslnotrustedcert')]",
                        "properties": {
                            "clientAuthConfiguration": {
                                "VerifyClientCertIssuerDN": false,
                                "VerifyClientRevocation": "None",
                                "VerifyClientAuthMode": "Passthrough"
                            }
                        }
                    }                   
                ],
                "gatewayIPConfigurations": [
                    {
                        "name": "appGatewayIpConfig",
                        "properties": {
                            "subnet": {
                                "id": "[variables('subnetRef')]"
                            }
                        }
                    }
                ],
                "frontendIPConfigurations": [
                    {
                        "name": "appGatewayFrontendIP",
                        "properties": {
                            "PublicIPAddress": {
                                "id": "[variables('publicIPRef')]"
                            }
                        }
                    }
                ],
                "frontendPorts": [
                    {
                        "name": "port2",
                        "properties": {
                            "Port": 444
                        }
                    }
                ],
                "backendAddressPools": [
                    {
                        "name": "pool2",
                        "properties": {
                            "BackendAddresses": [
							  {
                                "fqdn": "headerappgw-hsa5gjh8fpfebcfd.westus-01.azurewebsites.net"
                              }
							]
                        }
                    }
                ],
                "backendHttpSettingsCollection": [
                    {
                        "name": "settings2",
                        "properties": {
                            "Port": 80,
                            "Protocol": "Http"
                        }
                    }
                ],
                "httpListeners": [
                    {
                        "name": "listener2",
                        "properties": {
                            "FrontendIPConfiguration": {
                                "Id": "[concat(variables('applicationGatewayID'), '/frontendIPConfigurations/appGatewayFrontendIP')]"
                            },
                            "FrontendPort": {
                                "Id": "[concat(variables('applicationGatewayID'), '/frontendPorts/port2')]"
                            },
                            "Protocol": "Https",
                            "SslCertificate": {
                                "Id": "[concat(variables('applicationGatewayID'), '/sslCertificates/sslCert')]"
                            },
                            "sslProfile": {
                                "id": "[concat(variables('applicationGatewayID'), '/sslProfiles/sslnotrustedcert')]"
                            }
                        }
                    }
                ],
                "requestRoutingRules": [
                    {
                        "Name": "rule2",
                        "properties": {
                            "RuleType": "Basic",
                            "priority": 2000,
                            "httpListener": {
                                "id": "[concat(variables('applicationGatewayID'), '/httpListeners/listener2')]"
                            },
                            "backendAddressPool": {
                                "id": "[concat(variables('applicationGatewayID'), '/backendAddressPools/pool2')]"
                            },
                            "backendHttpSettings": {
                                "id": "[concat(variables('applicationGatewayID'), '/backendHttpSettingsCollection/settings2')]"
                            }
                        }
                    }
                ]
            },
            "dependsOn": [
                "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]",
                "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
            ]
        }
    ]
}

テンプレートをデプロイする

次のAzure CLI コマンドを実行してテンプレートをデプロイします。

az deployment group create \
  --resource-group <your-resource-group> \
  --template-file deploymentTemplate.json \
  --parameters @deploymentParameters.json

検証とテスト

デプロイメントを検証する

  1. Azure portal で、当該の Application Gateway のリソースに移動します。

  2. [JSON ビュー] を選択し、[API バージョン] 2025-03-01を選択します。

  3. verifyClientAuthMode が SSL プロファイルで Passthrough に設定されていることを確認します。

    "sslProfiles": [
        {
            "name": "sslnotrustedcert",
            "id": "<sample-subscription-id>",
            "etag": "W/\"851e4e20-d2b1-4338-9135-e0beac11aa0e\"",
            "properties": {
                "provisioningState": "Succeeded",
                "clientAuthConfiguration": {
                    "verifyClientCertIssuerDN": false,
                    "verifyClientRevocation": "None",
                    "verifyClientAuthMode": "Passthrough"
                },
                "httpListeners": [
                    {
                        "id": "<sample-subscription-id>"
                    }
                ]
            }
        }
    ]
    

クライアント証明書をバックエンドに送信する

クライアント証明書をバックエンドに転送する必要がある場合は、書き換え規則を構成します。 詳細については、「Application Gateway を使用して HTTP ヘッダーと URL を書き換える」を参照してください。

クライアントが証明書を送信すると、この書き換えにより、バックエンド処理の要求ヘッダーにクライアント証明書が確実に含められます。

接続をテストする

クライアント証明書が指定されていない場合でも、接続が確立されていることを確認します。

mTLS パススルー パラメーター

次の表では、mTLS パススルー構成のパラメーターについて説明します。

名前 タイプ Description
verifyClientCertIssuerDN ブール値 ゲートウェイでクライアント証明書の発行者名を確認するかどうかを指定します。
verifyClientRevocation String クライアント証明書失効検証モードを指定します。
verifyClientAuthMode String クライアント証明書モードを指定します。 有効値は Strict または Passthrough です。

パススルー モード: ゲートウェイはクライアント証明書を要求しますが、適用しません。 バックエンドは証明書を検証し、ポリシーを適用します。

セキュリティの考慮事項

このソリューションを展開して管理するときは、組織のセキュリティとデータ処理のベスト プラクティスに従ってください。