使用 powershell PowerNSX 模块的 Connect-NsxServer 出现错误

Getting an error with Connect-NsxServer with powershell PowerNSX module

在运行执行此命令后

$cred = get-credential
Connect-NsxServer -vCenterServer MyVsphereServer -Credential $cred

我收到这个错误

Connection to NSX server 10.X.X.X failed : Invoke-NsxRestMethod : The NSX API response received indicates a failure. 403 : Forbidden : Response Body: 
At C:\Program Files\WindowsPowerShell\Modules\PowerNSX.0.1174\PowerNSX.psm1:4939 char:13
+             Throw "Connection to NSX server $NsxServer failed : $_"
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (Connection to N...Response Body: :String) [], RuntimeException
    + FullyQualifiedErrorId : Connection to NSX server 10.X.X.X failed : Invoke-NsxRestMethod : The NSX API response received indicates a failure. 403 : Forbidden : Respons 
   e Body: 

我在错误中看到了这个,但之前也从未设置过

The variable '$defaultNSXConnection' cannot be retrieved because it has not been set.

PowerNSX 模块评论说:

 Invoke-NsxWebRequest uses either a specified connection object as returned
    by Connect-NsxServer, or the $DefaultNsxConnection global variable if
    defined to construct a REST api call to the NSX API.

我的帐户权限不可能是问题所在。我可以登录到 NSX gui 并拥有企业管理员凭据。我还可以使用 powercli 模块和针对它的 运行 cmdlet 成功登录 Vsphere。特别是当我尝试连接到 NSX 时出现错误。迷失在这一点上。不知道为什么它不起作用。通过 IP 和 FQDN 尝试。根据他们的文档,-vcenterserver 参数是首选参数,我确实看到绿色文本响应指向正确的 nsx 管理器 IP 地址。一切看起来都不错,但显然有些地方不对。

powernsx 显然要求您使用 administrator@vsphere.local 帐户才能使用它,无论您的其他管理员帐户是否可以通过本地 API 呼叫进行 NSX 支持的任何 API 呼叫.

在 powernsx 文档中没有看到。如果这不仅仅是我的过度访问,那真的应该放在他们文档的中心位置。

我们有用于 vSphere 的 MS AD 身份验证帐户。我使用 PowerNSX 和我自己的凭据,不,我不必使用 administrator@vsphere.local。我成功的唯一方法是小心地将帐户的域全部大写,Kerberos 风格。当我提供凭据时,唯一适用于我的格式是“username@MY.DOMAIN.COM”,它非常区分大小写。 vSphere 6.7、NSX 6.4.8、PowerNSX 3.0.1174