|
| 1 | +--- |
| 2 | +title: Configure Azure Application Gateway TCP/TLS proxy (Preview) |
| 3 | +titleSuffix: Azure Application Gateway |
| 4 | +description: This article provides information on how to configure Application Gateway's layer 4 proxy service for non-HTTP workloads. |
| 5 | +services: application-gateway |
| 6 | +author: greg-lindsay |
| 7 | +ms.service: application-gateway |
| 8 | +ms.topic: how-to |
| 9 | +ms.date: 02/26/2024 |
| 10 | +ms.author: greglin |
| 11 | +--- |
| 12 | + |
| 13 | +# Configure Azure Application Gateway TCP/TLS proxy (Preview) |
| 14 | + |
| 15 | +To try out the layer 4 features of Azure Application Gateway, this article shows how to use the Azure portal to create an Azure Application Gateway with a SQL Server virtual machine as the backend server. Connectivity through a SQL client is also tested to verify the configuration works correctly. The article guides you through the following procedures: |
| 16 | + |
| 17 | +- Create a SQL server Azure virtual machine |
| 18 | +- Create a new application gateway |
| 19 | + - Configure basic settings and a frontend public IP address |
| 20 | + - Add a backend pool and set the SQL server as a backend target |
| 21 | + - Create a routing rule |
| 22 | + - Create a listener with the required port (SQL 1433) |
| 23 | + - Create a backend setting using layer 4 protocol |
| 24 | + |
| 25 | + - Add a SQL server to the backend pool |
| 26 | +- Connect to the application gateway using a SQL client |
| 27 | + |
| 28 | +> [!IMPORTANT] |
| 29 | +> Application Gateway TCP/TLS proxy is currently in PREVIEW.<br> |
| 30 | +> See the [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/) for legal terms that apply to Azure features that are in beta, preview, or otherwise not yet released into general availability. |
| 31 | +
|
| 32 | +## Register to the preview |
| 33 | + |
| 34 | +> [!NOTE] |
| 35 | +> When you join this preview, all Application Gateways will have the ability to use Layer 4 proxy features. This is an auto-approved registration and needs about **30 minutes to take effect**. |
| 36 | +
|
| 37 | +For more information about preview features, see [Set up preview features in Azure subscription](../azure-resource-manager/management/preview-features.md). |
| 38 | + |
| 39 | +Use the following steps to enroll into the public preview for Application Gateway TCP/TLS proxy using the Azure portal: |
| 40 | + |
| 41 | +1. Sign in to the [Azure portal](https://portal.azure.com/). |
| 42 | +2. In the search box, enter _subscriptions_ and select **Subscriptions**. |
| 43 | + |
| 44 | + :::image type="content" source="../azure-resource-manager/management/media/preview-features/search.png" alt-text="Screenshot of Azure portal search."::: |
| 45 | + |
| 46 | +3. Select the link for your subscription's name. |
| 47 | + |
| 48 | + :::image type="content" source="../azure-resource-manager/management/media/preview-features/subscriptions.png" alt-text="Screenshot selecting the Azure subscription."::: |
| 49 | + |
| 50 | +4. From the left menu, under **Settings** select **Preview features**. |
| 51 | + |
| 52 | + :::image type="content" source="../azure-resource-manager/management/media/preview-features/preview-features-menu.png" alt-text="Screenshot of the Azure preview features menu."::: |
| 53 | + |
| 54 | +5. You see a list of available preview features and your current registration status. |
| 55 | + |
| 56 | + :::image type="content" source="../azure-resource-manager/management/media/preview-features/preview-features-list.png" alt-text="Screenshot of Azure portal list of preview features listed."::: |
| 57 | + |
| 58 | +6. From **Preview features** type into the filter box **AllowApplicationGatewayTlsProxy**, select the feature, and then select **Register**. |
| 59 | + |
| 60 | + :::image type="content" source="../azure-resource-manager/management/media/preview-features/filter.png" alt-text="Screenshot of Azure portal filter preview features."::: |
| 61 | + |
| 62 | +## Create a SQL server |
| 63 | + |
| 64 | +First, create a SQL Server virtual machine (VM) using the Azure portal. |
| 65 | + |
| 66 | +1. From the Azure portal Home page, search for **SQL Virtual Machines** and then select **SQL virtual machines** under **Services**. |
| 67 | + |
| 68 | +  |
| 69 | + |
| 70 | +2. Select **Create** and then on the Select SQL deployment option page, choose a **Free SQL Server License** option from the drop-down menu. For example: **SQL Server 2022 Developer on Windows Server 2022**. You can also select a different Free license version to test. |
| 71 | + |
| 72 | +3. After choosing a free SQL license version, select **Create**. The **Basics** tab opens. |
| 73 | + |
| 74 | +4. Enter the following information on the **Basics** tab: |
| 75 | + - **Subscription**: Select your Azure subscription name. |
| 76 | + - **Resource group**: Create a new resource group so that you can easily remove it after testing, for example: **myresourcegroup**. |
| 77 | + - **Virtual machine name**: mySQLVM |
| 78 | + - **Region**: Select the same region as your resource group. |
| 79 | + - **Availability options**: Accept the default settings. |
| 80 | + - **Security type**: Accept the default settings. |
| 81 | + - **Image**: Accept the default settings. |
| 82 | + - **VM architecture**: Accept the default settings. |
| 83 | + - **Size**: Select a size compatible with the region. |
| 84 | + - **Administrator details**: Enter a username and password. |
| 85 | + - **Inbound port rules**: Accept the default settings. |
| 86 | + |
| 87 | +  |
| 88 | + |
| 89 | +5. Select **Review + create**, and then select **Create**. Deployment of the virtual machine takes a few minutes. |
| 90 | +6. When deployment is complete, select the SQL server resource's overview page and write down the public IP address of the virtual machine. |
| 91 | + |
| 92 | +  |
| 93 | + |
| 94 | +## Create an Application Gateway |
| 95 | + |
| 96 | +1. On the Azure portal menu or from the **Home** page, select **Create a resource**. |
| 97 | +2. Under **Categories**, select **Networking** and then select **Application Gateway** in the **Popular Azure services** list. |
| 98 | +3. On the **Basics** tab, enter the following details: |
| 99 | + - **Subscription**: Select your Azure subscription name. |
| 100 | + - **Resource group**: Select the same resource group that you entered for the previous procedure to create a SQL server virtual machine. |
| 101 | + - **Application gateway name**: myL4AppGW |
| 102 | + - **Region**: Select the same region as your resource group. |
| 103 | + - **Tier**: Standard V2 |
| 104 | + - **Enable autoscaling**: Accept the default setting. |
| 105 | + - **Minimum instance count**: 2 |
| 106 | + - All other **Instance details**: Accept the default settings. |
| 107 | + - **Virtual network**: Select **Create new** and enter a name. For example: **myL4AppGWVNet**. Accept the default address space settings and replace the subnet name of default with a descriptive name such as **appgw-subnet**. |
| 108 | + |
| 109 | + > [!NOTE] |
| 110 | + > Default address space and subnet settings are adjusted to avoid conflicting with other VNets that you have deployed. |
| 111 | +
|
| 112 | +  |
| 113 | + |
| 114 | + The following table provides more information about the settings used in this procedure. |
| 115 | + |
| 116 | + | Field | Details | |
| 117 | + |-------|---------| |
| 118 | + | Subscription | Select the same subscription where you deployed the SQL server. | |
| 119 | + | Resource group | Select the same resource group where you deployed the SQL server. | |
| 120 | + | Application gateway name | You can provide any name for easy identification. | |
| 121 | + | Region | The region is automatically selected based on the resource group that you choose. | |
| 122 | + | Tier | For TCP/TLS proxy, you can select either Standard v2 or WAF v2. The WAF functions only apply to HTTP(S) when using a gateway in hybrid mode (HTTP, HTTPS along with TCP or TLS). | |
| 123 | + | Enable autoscaling | This setting allows your gateway to scale out and scale in based on loads. This is applicable for both Layer 7 and Layer 4 proxy. The default setting is **Yes**. | |
| 124 | + | Min/Max instance counts | For more information, see [Scaling Application Gateway v2 and WAF v2](application-gateway-autoscaling-zone-redundant.md). | |
| 125 | + | Availability zone | For more information, see [What are Azure regions and availability zones?](/azure/reliability/availability-zones-overview). | |
| 126 | + | HTTP2 | The default setting of disabled can be used for this test. | |
| 127 | + | Virtual network and subnet | You can choose an existing VNet under the region or create a new VNet. Application Gateway requires its own dedicated subnet with no other services deployed in it. | |
| 128 | + |
| 129 | +4. Select **Next: Frontends**. |
| 130 | +5. Select a **Frontend IP address type** of **Public** and either use an existing IP address or create a new one. |
| 131 | + |
| 132 | + <br><img src="./media/how-to-tcp-tls-proxy/create-a-public-ip-address.png" alt="Screenshot displaying creation of a new public IP address." width="70%"> |
| 133 | + |
| 134 | +6. Select **Next: Backends**. |
| 135 | +7. On the **Backends** tab, select **Add a backend pool**. |
| 136 | +8. Enter details under Add a backend pool: |
| 137 | + - **Name**: Enter a name for the backend pool, for example **sql-vm**. |
| 138 | + - **Target type**: Select **IP address or FQDN** and enter the public IP address of the SQL server virtual machine that you wrote down previously. |
| 139 | + |
| 140 | + <img src="./media/how-to-tcp-tls-proxy/add-backend-pool.png" alt="Screenshot displaying backend pool creation." width="60%"> |
| 141 | + |
| 142 | +9. Select **Add** and then select **Next: Configuration**. |
| 143 | + |
| 144 | +10. Next, you create listeners, backend settings and a routing rule that links frontend and backend properties. Start by **selecting Add a routing rule** and entering the following settings on the **Listener** tab: |
| 145 | + - **Rule name**: SQL-rule |
| 146 | + - **Priority**: 100 |
| 147 | + - **Listener name**: sql-client-listener |
| 148 | + - **Frontend IP**: Public IPv4 |
| 149 | + - **Protocol**: TCP |
| 150 | + - **Port**: 1433 |
| 151 | + |
| 152 | + <br><img src="./media/how-to-tcp-tls-proxy/create-routing-rule.png" alt="Screenshot displaying routing rule creation." width="70%"> |
| 153 | + |
| 154 | +11. Select the **Backend targets** tab and enter the following settings: |
| 155 | + |
| 156 | + - **Target type**: Backend pool |
| 157 | + - **Backend target**: Select the pool name you created, for example **sql-vm**. |
| 158 | + - **Backend settings**: Select Add new and create backend settings with the following values: |
| 159 | + - **Backend settings name**: backend-settings-sql |
| 160 | + - **Backend protocol**: TCP |
| 161 | + - **Backend port**: 1433 |
| 162 | + - **Time-out (seconds)**: 20 |
| 163 | + |
| 164 | + <br><img src="./media/how-to-tcp-tls-proxy/create-backend-settings.png" alt="Screenshot displaying backend settings creation." width="70%"> |
| 165 | + |
| 166 | +12. Select **Add** to add the backend settings, and then select **Add** to add the routing rule. |
| 167 | + |
| 168 | + <br><img src="./media/how-to-tcp-tls-proxy/add-routing-rule.png" alt="Screenshot adding a routing rule." width="70%"> |
| 169 | + |
| 170 | +13. Select **Next: Tags** and add tags if desired. No tags are required for this demonstration. |
| 171 | +14. Select Next: **Review + Create** and then select **Create**. The deployment process takes a few minutes. |
| 172 | + |
| 173 | +## Connect to the SQL server |
| 174 | + |
| 175 | +1. Before connecting to the SQL server, verify that you have: |
| 176 | + - The public IP address of the Application Gateway frontend |
| 177 | + - Configured the SQL server to accept SQL authentication |
| 178 | + - Created an admin account on the SQL server |
| 179 | + |
| 180 | +2. On a client device with [SQL Server Management Studio](/sql/ssms/download-sql-server-management-studio-ssms) installed, connect to the public IP address of the Azure virtual machine. |
| 181 | + |
| 182 | + <br><img src="./media/how-to-tcp-tls-proxy/sql-connect.png" alt="Screenshot displaying the connection to a SQL server." width="60%"> |
| 183 | + |
| 184 | +## Clean up resources |
| 185 | + |
| 186 | +When no longer needed, remove the application gateway and all related resources by deleting the resource group you created, **myresourcegroup**. |
| 187 | + |
| 188 | +## Unregister from the preview |
| 189 | + |
| 190 | +Using the same process that you used to register for the preview, unregister from the preview by selecting the preview feature and then selecting **Unregister**. |
| 191 | + |
| 192 | +## Next steps |
| 193 | + |
| 194 | +To monitor the health of your backend pool, see [Backend health and diagnostic logs for Application Gateway](application-gateway-diagnostics.md). |
0 commit comments