適用対象: ✔️ Front Door Premium
この記事では、Azure Private Link を使用して Azure Application Gateway にプライベートに接続するように Azure Front Door Premium を構成する手順について説明します。
前提条件
- アクティブなサブスクリプションが含まれる Azure アカウント。 無料でアカウントを作成できます。
Azure Front Door Premium プロファイルとエンドポイント。 詳細については、「 Azure Front Door の作成」を参照してください。
Azure Application Gateway。 アプリケーション ゲートウェイの作成方法について詳しくは、「Azure Application Gateway による Web トラフィックのルーティング - Azure portal」をご覧ください。
Azure アカウントで Azure Portal にサインインします。
Azure Front Door Premium プロファイルとエンドポイント。 詳細については、「 Azure Front Door の作成」を参照してください。
Azure Application Gateway。 Application Gateway を作成する方法の詳細については「Azure PowerShell を使用した Azure Application Gateway による Web トラフィックの転送」を参照してください
Azure Cloud Shell または Azure PowerShell。
この記事の手順では、Azure Cloud Shell で Azure PowerShell コマンドレットを対話型で実行します。 Cloud Shell でコマンドレットを実行するには、コード ブロックの右上隅にある [Cloud Shell を開く ] を選択します。 [コピー] を選択してコードをコピーし、Cloud Shell に貼り付けて実行します。 Azure portal 内から Cloud Shell を実行することもできます。
Azure PowerShell をローカルにインストールしてコマンドレットを実行することもできます。 PowerShell をローカルで実行している場合は、Connect-AzAccount コマンドレットを使用して Azure にサインインします。
オリジングループを含む Azure Front Door Premium プロファイル。 詳細については、「 Azure Front Door の作成」を参照してください。
Azure Application Gateway。 Application Gateway を作成する方法の詳細については、「 Azure CLI を使用して Azure Application Gateway を使用して Web トラフィックを転送する」を参照してください。
Azure Cloud Shell または Azure CLI。
この記事の手順では、Azure Cloud Shell で Azure CLI コマンドを対話型で実行します。 Cloud Shell でコマンドを実行するには、コード ブロックの右上隅にある [Cloud Shell を開く ] を選択します。 [コピー] を選択してコードをコピーし、Cloud Shell に貼り付けて実行します。 Azure portal 内から Cloud Shell を実行することもできます。
Azure CLI をローカルにインストールしてコマンドを実行することもできます。 Azure CLI をローカルで実行する場合は、 az login コマンドを使用して Azure にサインインします。
注意
Azure portal を使用して構成する場合、Azure Front Door 配信元の構成で選択されるリージョンは、Application Gateway が配置されているリージョンと同じである必要があります。 Azure Front Door のオリジンリージョンと Application Gateway のリージョンが異なる場合は、CLI/PowerShell を使用してください。 これは、Application Gateway が Azure Front Door で Private Link をサポートしていないリージョンに配置されている場合に必要になります。
Azure Application Gateway へのプライベート接続を有効にする
Azure Application Gateway の Private Link を構成するページの手順に従います。ただし、プライベート エンドポイントを作成する最後の手順は省いてください。
Application Gateway の [概要 ] タブに移動し、リソース グループ名、Application Gateway 名、サブスクリプション ID をメモします。
[ 設定] で、[ プライベート リンク] を選択します。 [プライベート リンク構成] タブの [名前 ] 列に表示される プライベート リンク サービスの名前を メモしておきます
前の手順の値を使用して、プライベート リンク サービスのリソース ID を構築します。 形式は
/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/Microsoft.Network/privateLinkServices/_e41f87a2_{applicationGatewayName}_{privateLinkResource.Name}です。 このリソース ID は、Front Door の配信元の構成中に使用されます。
配信元グループを作成し、アプリケーション ゲートウェイを配信元として追加する
Azure Front Door Premium プロファイルで [設定] に移動して、[配信元グループ] を選びます。
追加を選択する
配信元グループの名前を入力します
[+ 配信元を追加] を選択します
次の表を使って、配信元の設定を構成します。
設定 価値 名前 この配信元を識別する名前を入力します。 起源の種類 習慣 ホスト名 Application Gateway のリスナーのホスト名を入力します 配信元のホスト ヘッダー Application Gateway のリスナーのホスト名を入力します HTTP ポート 80 (既定値) HTTPS ポート 443 (既定) 優先順位 プライマリ、セカンダリ、バックアップの各目的の配信元に、異なる優先順位を割り当てます。 体重 1000 (既定値)。 重みを使って、異なる配信元の間にトラフィックを分散させます。 プライベート リンク プライベート リンク サービスを有効にする プライベート リンクを選択する ID またはエイリアスで ID/別名 Application Gateway の構成中に取得したプライベート リンク サービス リソース ID を入力します。 リージョン Application Gateway が配置されているリージョンを選択します。 要求メッセージ プライベート エンドポイントの承認中に表示されるカスタム メッセージを入力します。
[追加] を選んで配信元の設定を保存します
[追加] を選んで、配信元グループの設定を保存します。
プライベート エンドポイントを承認する
前のセクションで Private Link を構成した Application Gateway に移動します。 [設定] で、[プライベート リンク] を選びます。
[プライベート エンドポイントの接続] タブを選びます。
Azure Front Door Premium から "保留中" のプライベート エンドポイント要求を見つけて、[承認] を選びます。
承認の後、接続の状態が更新されます。 接続が完全に確立されるまで数分かかる場合があります。 確立されたら、Front Door を通ってアプリケーション ゲートウェイにアクセスできます。 プライベート エンドポイントが有効になると、パブリック インターネットからアプリケーション ゲートウェイへの直接アクセスは無効になります。
Azure Application Gateway へのプライベート接続を有効にする
Azure Application Gateway の Private Link を構成するページの手順に従います。ただし、プライベート エンドポイントを作成する最後の手順は省いてください。
配信元グループを作成し、アプリケーション ゲートウェイを配信元として追加する
New-AzFrontDoorCdnOriginGroupHealthProbeSettingObject を使用して、正常性プローブの設定を格納するためのメモリ内オブジェクトを作成します。
$healthProbeSetting = New-AzFrontDoorCdnOriginGroupHealthProbeSettingObject ` -ProbeIntervalInSecond 60 ` -ProbePath "/" ` -ProbeRequestType GET ` -ProbeProtocol HttpNew-AzFrontDoorCdnOriginGroupLoadBalancingSettingObject を使用して、負荷分散の設定を格納するためのメモリ内オブジェクトを作成します。
$loadBalancingSetting = New-AzFrontDoorCdnOriginGroupLoadBalancingSettingObject ` -AdditionalLatencyInMillisecond 50 ` -SampleSize 4 ` -SuccessfulSamplesRequired 3New-AzFrontDoorCdnOriginGroup を実行して、アプリケーション ゲートウェイを含めた配信元グループを作成します。
$origingroup = New-AzFrontDoorCdnOriginGroup ` -OriginGroupName myOriginGroup ` -ProfileName myFrontDoorProfile ` -ResourceGroupName myResourceGroup ` -HealthProbeSetting $healthProbeSetting ` -LoadBalancingSetting $loadBalancingSettingGet-AzApplicationGatewayFrontendIPConfig コマンドを使用して、Application Gateway のフロントエンド IP 構成の名前を取得します。
$AppGw = Get-AzApplicationGateway -Name myAppGateway -ResourceGroupName myResourceGroup $FrontEndIPs= Get-AzApplicationGatewayFrontendIPConfig -ApplicationGateway $AppGw $FrontEndIPs.nameNew-AzFrontDoorCdnOrigin コマンドを使用して、アプリケーション ゲートウェイを配信元グループに追加します。
New-AzFrontDoorCdnOrigin ` -OriginGroupName myOriginGroup ` -OriginName myAppGatewayOrigin ` -ProfileName myFrontDoorProfile ` -ResourceGroupName myResourceGroup ` -HostName www.contoso.com ` -HttpPort 80 ` -HttpsPort 443 ` -OriginHostHeader www.contoso.com ` -Priority 1 ` -PrivateLinkId /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/myAppGateway ` -SharedPrivateLinkResourceGroupId $FrontEndIPs.name ` -SharedPrivateLinkResourcePrivateLinkLocation CentralUS ` -SharedPrivateLinkResourceRequestMessage 'Azure Front Door private connectivity request' ` -Weight 1000 `注意
SharedPrivateLinkResourceGroupIdは、Azure Application Gateway のフロントエンド IP 構成の名前です。
プライベート エンドポイントを承認する
Get-AzPrivateEndpointConnection を実行して、承認が必要なプライベート エンドポイント接続の接続名を取得します。
Get-AzPrivateEndpointConnection -ResourceGroupName myResourceGroup -ServiceName myAppGateway -PrivateLinkResourceType Microsoft.Network/applicationgatewaysApprove-AzPrivateEndpointConnection を実行して、プライベート エンドポイント接続の詳細を承認します。 接続を承認するには、前の手順の出力の Name 値を使用します。
Get-AzPrivateEndpointConnection -Name aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb.bbbbbbbb-1111-2222-3333-cccccccccccc -ResourceGroupName myResourceGroup -ServiceName myAppGateway -PrivateLinkResourceType Microsoft.Network/applicationgateways
Azure Front Door のセットアップを完了する
New-AzFrontDoorCdnRoute コマンドを使用して、エンドポイントを配信元グループにマップするルートを作成します。 このルートでは、エンドポイントからの要求を配信元グループに転送します。
# Create a route to map the endpoint to the origin group
$Route = New-AzFrontDoorCdnRoute `
-EndpointName myFrontDoorEndpoint `
-Name myRoute `
-ProfileName myFrontDoorProfile `
-ResourceGroupName myResourceGroup `
-ForwardingProtocol MatchRequest `
-HttpsRedirect Enabled `
-LinkToDefaultDomain Enabled `
-OriginGroupId $origingroup.Id `
-SupportedProtocol Http,Https
最後の手順を完了すると、Azure Front Door プロファイルは完全に機能します。
Azure Application Gateway へのプライベート接続を有効にする
Azure Application Gateway の Private Link を構成する方法に関するページの手順に従います。ただし、プライベート エンドポイントを作成する最後の手順はスキップしてください。
配信元グループを作成し、アプリケーション ゲートウェイを配信元として追加する
az afd origin-group create を実行して、配信元グループを作成します。
az afd origin-group create \ --resource-group myResourceGroup \ --origin-group-name myOriginGroup \ --profile-name myFrontDoorProfile \ --probe-request-type GET \ --probe-protocol Http \ --probe-interval-in-seconds 60 \ --probe-path / \ --sample-size 4 \ --successful-samples-required 3 \ --additional-latency-in-milliseconds 50az network application-gateway frontend-ip list を実行して、Application Gateway のフロントエンド IP 構成名を取得します。
az network application-gateway frontend-ip list --gateway-name myAppGateway --resource-group myResourceGroupaz afd origin create を実行して、アプリケーション ゲートウェイを配信元グループに配信元として追加します。
az afd origin create \ --enabled-state Enabled \ --resource-group myResourceGroup \ --origin-group-name myOriginGroup \ --origin-name myAppGatewayOrigin \ --profile-name myFrontDoorProfile \ --host-name www.contoso.com \ --origin-host-header www.contoso.com \ --http-port 80 \ --https-port 443 \ --priority 1 \ --weight 500 \ --enable-private-link true \ --private-link-location centralus \ --private-link-request-message 'Azure Front Door private connectivity request.' \ --private-link-resource /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myRGAG/providers/Microsoft.Network/applicationGateways/myAppGateway \ --private-link-sub-resource-type myAppGatewayFrontendIPName注意
private-link-sub-resource-typeは Azure Application Gateway フロントエンド IP 構成の名前です。
プライベート エンドポイント接続を承認する
az network private-endpoint-connection list を実行して、承認が必要なプライベート エンドポイント接続の ID を取得します。
az network private-endpoint-connection list --name myAppGateway --resource-group myResourceGroup --type Microsoft.Network/applicationgatewaysaz network private-endpoint-connection approve を実行して、前の手順の ID を使用してプライベート エンドポイント接続を承認します。
az network private-endpoint-connection approve --id /subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/myResourceGroup/providers/Microsoft.Network/applicationGateways/myAppGateway/privateEndpointConnections/aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb.bbbbbbbb-1111-2222-3333-cccccccccccc
Azure Front Door のセットアップを完了する
az afd route create を実行して、エンドポイントを配信元グループにマップするルートを作成します。 このルートでは、エンドポイントからの要求を配信元グループに転送します。
az afd route create \
--resource-group myResourceGroup \
--profile-name myFrontDoorProfile \
--endpoint-name myFrontDoorEndpoint \
--forwarding-protocol MatchRequest \
--route-name myRoute \
--https-redirect Enabled \
--origin-group myOriginGroup \
--supported-protocols Http Https \
--link-to-default-domain Enabled
最後の手順を完了すると、Azure Front Door プロファイルは完全に機能します。
回避するべき一般的なミス
Azure Private Link を有効にして Azure Application Gateway の配信元を構成する場合によくある間違いを次に示します。
- Azure Application Gateway で Azure Private Link を構成する前に Azure Front Door 配信元を構成する。
- パブリック オリジンを含む既存の配信元グループに Azure Private Link を使用して Azure Application Gateway の配信元を追加する。 Azure Front Door では、同じ配信元グループにパブリック オリジンとプライベート オリジンを混在させることはできません。
- デプロイエラーを回避するために、Application Gateway 名と Private Link 構成名の組み合わせの長さは 70 文字を超えないようにする必要があります。
- Application Gateway フロントエンド IP がリスナーに関連付けされていません。
- 配信元の種類を 'カスタム' ではなく 'Application Gateway' として配信元を構成する。 配信元の種類を "Application Gateway" として選択すると、配信元のホスト名に Application Gateway の IP アドレスが自動的に設定されます。 これにより、"CertificateNameValidation" エラーが発生する可能性があります。 この問題は、証明書のサブジェクト名の検証を無効にすることで、パブリック配信元で回避できます。 ただし、プライベート リンクが有効になっているオリジンの場合、証明書のサブジェクト名の検証は必須です。
-
SharedPrivateLinkResourceGroupIdの値として、正しくない Azure Application Gateway フロントエンド IP 構成の名前を指定する。
-
private-link-sub-resource-typeの値として、正しくない Azure Application Gateway フロントエンド IP 構成の名前を指定する。