Share via


網路組態設定

因為 App Service 環境是針對單一客戶隔離的,所以有一些可以專門套用到 App Service 環境的組態設定。 此文章記錄各種可供 App Service 環境 v3 使用的特定網路自訂。

注意

本文是關於搭配隔離式 v2 App Service 方案一起使用的 App Service 環境 v3。

如果您沒有 App Service 環境,請參閱如何建立 App Service 環境 v3

App Service 環境網路自訂會儲存在 hostingEnvironments Azure Resource Manager 實體的子資源 (稱為 networking) 中。

下列縮寫的 Resource Manager 範本程式碼片段會顯示 networking 資源︰

"resources": [
{
    "apiVersion": "2021-03-01",
    "type": "Microsoft.Web/hostingEnvironments",
    "name": "[parameter('aseName')]",
    "location": ...,
    "properties": {
        "internalLoadBalancingMode": ...,
        etc...
    },    
    "resources": [
        {
            "type": "configurations",
            "apiVersion": "2021-03-01",
            "name": "networking",
            "dependsOn": [
                "[resourceId('Microsoft.Web/hostingEnvironments', parameters('aseName'))]"
            ],
            "properties": {
                "remoteDebugEnabled": true,
                "ftpEnabled": true,
                "allowNewPrivateEndpointConnections": true
            }
        }
    ]
}

networking 資源可以包括在 Resource Manager 範本中,以更新 App Service 環境。

使用 Azure 資源總管進行設定

或者,您可以使用 Azure 資源總管更新 App Service 環境。

  1. 在 [資源總管] 中,移至 App Service 環境的節點 ([訂用帳戶]>[{您的訂用帳戶}]>[resourceGroups]>[{您的資源群組}]>[提供者]>[Microsoft.Web]>[hostingEnvironments]>[App Service 環境名稱]>[設定]>[網路])。
  2. 選取上方工具列中的 [讀取/寫入] 以允許在資源總管中進行互動式編輯。
  3. 選取藍色的 [編輯] 按鈕以開放編輯 Resource Manager 範本。
  4. 修改您想要變更的一或多個設定,ftpEnabled、remoteDebugEnabled、allowNewPrivateEndpointConnections。
  5. 選取右窗格頂端的綠色 [PUT] 按鈕以認可對 App Service 環境的變更。
  6. 您可能需要再次選取綠色 [GET] 按鈕來查看變更的值。

變更會在一分鐘內生效。

允許新的私人端點連線

針對裝載於 ILB 和外部 App Service 環境的應用程式,您可以允許建立私人端點。 此設定預設為停用。 如果啟用設定時已建立私人端點,這些端點將不會刪除,且會繼續運作。 此設定只會防止建立新的私人端點。

下列 Azure CLI 命令將會啟用 allowNewPrivateEndpointConnections:

ASE_NAME="[myAseName]"
RESOURCE_GROUP_NAME="[myResourceGroup]"
az appservice ase update --name $ASE_NAME -g $RESOURCE_GROUP_NAME --allow-new-private-endpoint-connection true

az appservice ase list-addresses -n --name $ASE_NAME -g $RESOURCE_GROUP_NAME --query allowNewPrivateEndpointConnections

此設定也可透過 Azure 入口網站上的 App Service 環境設定進行設定:

Screenshot from Azure portal of how to configure your App Service Environment to allow creating new private endpoints for apps.

FTP 存取

這個 ftpEnabled 設定可讓您允許或拒絕 FTP 連線是 App Service 環境層級。 個別應用程式仍然需要設定 FTP 存取。 如果您在 App Service 環境層級啟用 FTP,建議您在個別應用程式層級強制執行 FTPS。 此設定預設為停用。

如果您想要啟用 FTP 存取,您可以執行下列 Azure CLI 命令:

ASE_NAME="[myAseName]"
RESOURCE_GROUP_NAME="[myResourceGroup]"
az appservice ase update --name $ASE_NAME -g $RESOURCE_GROUP_NAME --allow-incoming-ftp-connections true

az appservice ase list-addresses -n --name $ASE_NAME -g $RESOURCE_GROUP_NAME --query ftpEnabled

此設定也可透過 Azure 入口網站上的 App Service 環境設定進行設定:

Screenshot from Azure portal of how to configure your App Service Environment to allow incoming ftp connections.

除了啟用存取,您必須確定您在使用 ILB App Service 環境的情況下已設定 DNS,以及確定必要連接埠已解除封鎖。

遠端偵錯存取

遠端偵錯預設會在 App Service 環境層級停用。 您可以使用此設定為所有應用程式啟用網路層級存取。 您仍然需要在個別應用程式層級設定遠端偵錯

執行下列 Azure CLI 命令以啟用遠端偵錯存取:

ASE_NAME="[myAseName]"
RESOURCE_GROUP_NAME="[myResourceGroup]"
az appservice ase update --name $ASE_NAME -g $RESOURCE_GROUP_NAME --allow-remote-debugging true

az appservice ase list-addresses -n --name $ASE_NAME -g $RESOURCE_GROUP_NAME --query remoteDebugEnabled

此設定也可透過 Azure 入口網站上的 App Service 環境設定進行設定:

Screenshot from Azure portal of how to configure your App Service Environment to allow remote debugging.

下一步