Skip to content

Commit e17c4f3

Browse files
Merge pull request #309637 from seligj95/hcmport
App Service HCM - add custom port instructions
2 parents 56f911f + df7e91b commit e17c4f3

1 file changed

Lines changed: 47 additions & 8 deletions

File tree

articles/app-service/app-service-hybrid-connections.md

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to create and use hybrid connections in Azure App Service
44
author: seligj95
55
ms.assetid: 66774bde-13f5-45d0-9a70-4e9536a4f619
66
ms.topic: how-to
7-
ms.date: 10/27/2025
7+
ms.date: 12/16/2025
88
ms.update-cycle: 1095-days
99
ms.author: jordanselig
1010
#customer intent: As an app developer, I want to understand the usage of Hybrid Connections to provide access to apps in Azure App Service.
@@ -175,8 +175,8 @@ To support the Hybrid Connections it's configured with, the Hybrid Connection Ma
175175

176176
- TCP access to Azure over port 443.
177177
- TCP access to the Hybrid Connection endpoint.
178-
- Windows clients must have ports 4999-5001 available.
179-
- Linux clients must have port 5001 available.
178+
- Windows clients use ports 4999-5001 by default. These ports can be [modified if needed](#configure-custom-ports).
179+
- Linux clients use port 5001 by default. This port can be [modified if needed](#configure-custom-ports).
180180
- The ability to do DNS look-ups on the endpoint host and the Service Bus namespace. In other words, the hostname in the Azure relay connection should be resolvable from the machine that hosts the Hybrid Connection Manager.
181181

182182
### Getting started with the Hybrid Connection Manager GUI
@@ -221,7 +221,7 @@ On Windows, you can use the Hybrid Connection Manager CLI by searching for and o
221221

222222
# [Linux](#tab/linux)
223223

224-
On Linux, once installed, you can run `hcm help` to confirm the Hybrid Connection Manager is installed and to see the available commands.
224+
On Linux, once installed, you can run `hcm --help` to confirm the Hybrid Connection Manager is installed and to see the available commands.
225225

226226
-----
227227

@@ -245,6 +245,45 @@ You can also show the details of a specific Hybrid Connection with the `hcm show
245245

246246
:::image type="content" source="media/app-service-hybrid-connections/hybrid-connections-hcm-details-cli.png" alt-text="Screenshot of Hybrid Connection Details in CLI.":::
247247

248+
### Configure custom ports
249+
250+
By default, the Hybrid Connection Manager uses ports 4999-5001 on Windows and port 5001 on Linux. You can configure custom ports if the default ports are unavailable or if your environment requires different port assignments.
251+
252+
> [!NOTE]
253+
> Custom port configuration is only supported on Hybrid Connection Manager version 1.2.5 or later.
254+
255+
# [Windows](#tab/windows)
256+
257+
To configure custom ports on Windows, navigate to **Edit the system environment variables** with Windows Search and add the following environment variables. Ensure you're editing the **System Variables** section, not the user variables.
258+
259+
- `HCM_GUI_PORT`
260+
- `HCM_SERVICE_PORT`
261+
262+
Set the value of each variable to the port number you want to use. For example, `HCM_GUI_PORT=1234`.
263+
264+
> [!NOTE]
265+
> If you set these environment variables after the Hybrid Connection Manager is installed, you need to restart **HybridConnectionManagerService** through **Services** from Windows Search. We recommend setting these variables before you install the Hybrid Connection Manager to avoid issues with the service picking up these values.
266+
267+
# [Linux](#tab/linux)
268+
269+
To configure a custom port on Linux:
270+
271+
1. Set the environment variable and add it to `/etc/environment`. Replace `<PORT-NUMBER>` with the port number you want to use:
272+
273+
```bash
274+
export HCM_SERVICE_PORT=<PORT-NUMBER> && sudo sh -c "echo HCM_SERVICE_PORT=$HCM_SERVICE_PORT >> /etc/environment"
275+
```
276+
277+
1. To apply the new port configuration, run the Hybrid Connection Manager setup script:
278+
279+
```bash
280+
sudo ./setup.sh
281+
```
282+
283+
If running the setup script with sudo doesn't apply the port change, try running it without sudo.
284+
285+
-----
286+
248287
### Configure proxy server settings
249288
250289
If you need to configure proxy server settings for the Hybrid Connection Manager, edit the `ProxySettings` section in the `appsettings.json` file located at:
@@ -358,16 +397,16 @@ The status of **Connected** means that at least one Hybrid Connection Manager is
358397
359398
:::image type="content" source="media/app-service-hybrid-connections/hybrid-connections-service-bus-endpoint-cli.png" alt-text="Screenshot of Hybrid Connection Service Bus endpoint in the CLI.":::
360399
361-
- The Service Bus gateways are the resources that accept the request into the Hybrid Connection and pass it through the Azure Relay. You need to allowlist all of the gateways. The gateways are in the format: `G#-prod-[stamp]-sb.servicebus.windows.net` and `GV#-prod-[stamp]-sb.servicebus.windows.net`. The number sign, `#`, is a number between 0 and 127 and `stamp` is the name of the instance within your Azure data center where your Service Bus endpoint exists.
400+
- The Service Bus gateways are the resources that accept the request into the Hybrid Connection and pass it through the Azure Relay. You need to allow list all of the gateways. The gateways are in the format: `G#-prod-[stamp]-sb.servicebus.windows.net` and `GV#-prod-[stamp]-sb.servicebus.windows.net`. The number sign, `#`, is a number between 0 and 127 and `stamp` is the name of the instance within your Azure data center where your Service Bus endpoint exists.
362401
363-
- If you can use a wildcard, you can allowlist *\*.servicebus.windows.net*.
364-
- If you can't use a wildcard, you must allowlist all 256 of the gateways.
402+
- If you can use a wildcard, you can allow list *\*.servicebus.windows.net*.
403+
- If you can't use a wildcard, you must allow list all 256 of the gateways.
365404

366405
You can find out the stamp using *nslookup* on the Service Bus endpoint URL.
367406

368407
:::image type="content" source="media/app-service-hybrid-connections/hybrid-connections-stamp-name.png" alt-text="Screenshot of terminal showing where to find the stamp name for the Service Bus.":::
369408

370-
In this example, the stamp is `sn3-010`. To allowlist the Service Bus gateways, you need the following entries:
409+
In this example, the stamp is `sn3-010`. To allow list the Service Bus gateways, you need the following entries:
371410

372411
G0-prod-sn3-010-sb.servicebus.windows.net
373412
G1-prod-sn3-010-sb.servicebus.windows.net

0 commit comments

Comments
 (0)