Azure / Azure/Azure-Data-Factory-Integration-Runtime-in-Windows-Container

Passing in HA_PORT doesn't work, as $PORT isn't being passed in correctly in code

Open
#3 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
32
Forks
60
PR merge metrics
No merged PRs in 30d

Description

The current logic that implements passing in `$HA_PORT` from the `docker run` isn't properly making it to `dmgcmd.exe` due to this line of code:
``` PowerShell
$PORT = $HA_PORT -or "8060"
Start-Process $DmgcmdPath -Wait -ArgumentList "-EnableRemoteAccess"
```
I think [`-or`](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_logical_operators?view=powershell-7.1#long-description) is being incorrectly used here. By this logic, `$PORT` always evaluates to `True` (rather than picking up 8060 if no `$HA_PORT` is passed in - I think the intention here was to perform [NULL Coalesce](https://stackoverflow.com/questions/10623907/null-coalescing-in-powershell)?)

So you get this error every time:
![image](https://user-images.githubusercontent.com/46581776/120898375-9ce8dd00-c5f8-11eb-8e68-d93b382ed931.png)

``` Text
The value of port is invalid. Please set an integer bigger than or equal to 0 and less than or equal to 65535.
```
Since the expression turns out to be `.\dmgcmd.exe -EnableRemoteAccess TRUE`.

**Possible Solution**
![image](https://user-images.githubusercontent.com/46581776/120900079-f9e89100-c600-11eb-816c-d5dc3c788e64.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.