aws/aws-tools-for-powershell

Set-AWSProxy Cmdlet examples are wrong.

Closed this issue · 2 comments

Describe the issue

In some examples, -BypassList parameter is specified incorrectly.

Example 4

-BypassList is string array, so it is correct to use comma, and IPv4 address should be enclosed in quotes.

# Incorrect :  This example ignore ";169.254.169.251;169.254.169.254" 
Set-AWSProxy -Hostname https://proxy.testserver.com -Port 80 -BypassList 169.254.169.250;169.254.169.251;169.254.169.254

# Only 169.254.169.250 is set in BypassList.
> $AWSProxy                                                                                                         
Hostname      : https://proxy.testserver.com
Port          : 80
Credentials   :
BypassList    : {169.254.169.250}
BypassOnLocal :
# Correct
Set-AWSProxy -Hostname https://proxy.testserver.com -Port 80 -BypassList "169.254.169.250","169.254.169.251","169.254.169.254"

#  BypassList is set expected values.
> $AWSProxy

Hostname      : https://proxy.testserver.com
Port          : 80
Credentials   :
BypassList    : {169.254.169.250, 169.254.169.251, 169.254.169.254}
BypassOnLocal :

quotation marks around the IP address values are not needed.

It is correct, but in some cases PowerShell treats non-quated IP address as scriptblock.
In the example below all IP addresses are ignored.

# With array subexpression operator (`@()`), non-quated IP address are parsed as non-value scritpblock.
Set-AWSProxy -Hostname https://proxy.testserver.com -Port 80 -BypassList @(169.254.169.250, 169.254.169.251, 169.254.169.254)

# All IP address are ignored.
> $AWSProxy

Hostname      : https://proxy.testserver.com
Port          : 80
Credentials   :
BypassList    : {$null, $null, $null}
BypassOnLocal :

Example 7

Same as Example 4.

# Incorrect
Set-AWSProxy -Port 8888 -Hostname 127.0.0.1 -BypassList "127.0.0.1";"ip-ranges.amazonaws.com"

# Correct
Set-AWSProxy -Port 8888 -Hostname 127.0.0.1 -BypassList "127.0.0.1","ip-ranges.amazonaws.com"

Links

https://docs.aws.amazon.com/powershell/latest/reference/items/Set-AWSProxy.html

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.