vmware-archive / powernsx

PowerShell module that abstracts the VMware NSX-v API to a set of easily used PowerShell functions
173 stars 90 forks source link

Access to the NSX FW #660

Open aldowski opened 1 year ago

aldowski commented 1 year ago

Describe the bug

Hello; I found multiple manuals and tutorials; did read most of those; anyway, still have issues to connect to NSX FW properly, getting different error messages. In this case I am trying to automate NSX FW access and searching rules by different parameters, as mentioned, I cannot even connect to it (cannot using PowerNSX; at the other side browser access works).

The server is accessible: PS C:\WINDOWS\system32> Connect-VIServer x.x.x.x -Credential (Get-Credential) cmdlet Get-Credential at command pipeline position 1 Supply values for the following parameters:

Name Port User


x.x.x.x 443 NSXSERVERNAME\adminname

Reproduction steps

Regardless of next steps I am getting errors:

Connect-NsxServer -vCenterServer x.x.x.x Connection to NSX server x.x.x.x failed : System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond x.x.x.x:443

Or: Connect-NsxServer -Server x.x.x.x (mentioned as deprecated) or: Connect-NsxServer -NsxServer x.x.x.x Connection to NSX server x.x.x.x failed : Invoke-NsxRestMethod : The NSX API response received indicates a failure. 405 : Method Not Allowed : Response Body:

Expected behavior

Of course this is not a bug itself, it is not new feature request; I just wanted to get any answer, what and where needs to be checked (also, must say that the error 405 is not clearly mentioned at any suggestions, tutorials).

What is being expected = just connection to the end NSX FW server, if the connection is not allowed, why it's not. I am emphasizing that I have proper, full access to the NSX FW using browser (https, 443), same credentials I am using in PowerNSX attempts.

Additional context

The PowerNSX installed today, all commands listed, available as expected; using the PS C:\WINDOWS\system32> gcm -Module PowerNSX.

I am checking usage with both hostname and IP address (anyway; I put one more line to Windows hosts file, just in case).

Is the NSX firewall rejecting access because of some specific settings; should anything be changed there?

alagoutte commented 1 year ago

What version of Powershell do you are using ? You use the Vcenter FQDN (or IP) not the NSX Manager IP ?

What do you if you try with -verbose ?