【问题标题】:Getting an error with Connect-NsxServer with powershell PowerNSX module使用带有 powershell PowerNSX 模块的 Connect-NsxServer 出现错误
【发布时间】:2020-01-31 18:55:23
【问题描述】:

运行此命令后

$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\3.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 模块成功登录 Vsphere 并针对它运行 cmdlet。特别是当我尝试连接到 NSX 时出现错误。迷失在这一点上。不知道为什么它不起作用。通过 IP 和 FQDN 尝试。根据他们的文档,首选 -vcenterserver 参数,我确实看到绿色文本响应指向正确的 nsx 管理器 IP 地址。一切看起来都对,但显然有些不对。

【问题讨论】:

标签: powershell vsphere powercli


【解决方案1】:

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

在 powernsx 文档中没有看到。如果这不仅仅是我的过度网站,那真的应该在他们的文档中处于前沿和中心。

【讨论】:

    【解决方案2】:

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

    【讨论】:

    • 除非您在不使用全大写字母时遇到原始帖子中描述的相同错误,否则我认为这不能回答问题。
    猜你喜欢
    • 1970-01-01
    • 2014-09-09
    • 1970-01-01
    • 2021-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-31
    相关资源
    最近更新 更多