VMware Cloud Community
Zsoldier
Expert
Expert
Jump to solution

vCenter 6.5U1 VAMI API com.vmware.appliance.techpreview.networking.proxy

Anyone mess w/ the VAMI api for vcenter 6.5U1 using powershell?  Specifically looking for some direction on com.vmware.appliance.techpreview.networking.proxy (edited)

it is techpreview, so expected issues, but always getting errors w/ `get` and unclear formatting for `configlist`

error I get for `get`  `A server error occurred: 'com.vmware.vapi.std.errors.unauthorized': Unable to authorize user (Server error id: 'vapi.security.authorization.invalid'). Check $Error[0].Exception.ServerError for more details.`

Even though I am authenticated via connect-cisserver.  Doesn't even matter if I'm accessing non-techpreview spaces.  Same error.

:smileyconfused:

To clarify, I have two issues:

  1. Authentication doesn’t appear to be functioning for me properly.   Getting unauthorized error even when properly authenticated.
  2. Proxy API not clear for me on how to define a simple IP address and port
    • Here is what I have so far:
    • $PodvCvAMI = Connect-CisServer $PodvCenterName -Credential $podvcenterRootCreds

    • $ProxyConfigAPI = Get-CisService -name "com.vmware.appliance.techpreview.networking.proxy"

    • $ProxyConfigSpec = $ProxyConfigAPI.help.set.config.CreateExample()

    • $ProxyConfigSpec.status = "enabled"
    • $ProxyConfigSpec.configList = @{"username"="test";"protocol"="http";"port"=3128;"server"="192.168.1.2"}

Message was edited by: Chris Nakagaki

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
1 Solution

Accepted Solutions
Zsoldier
Expert
Expert
Jump to solution

I see where my issue is now.  I was so focused on just changing the proxy config, that I assumed that I should be authenticating against the 'VAMI' REST API as the VCSA local root user.  Which, by the way, authenticates just fine, but does not seem to grant any worthwhile access.  I had to authenticate using my SSO admin account.

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

You need to authorise before making the call, see my VSphere Automation SDKs, PowerShell And You – Part 1 post.

I just added function Get-rProxyConfig and updated Sample1.

See Sample1 in my OpenSdk repo.

Sample output from my test system with no proxy configured.

proxyconfig.png


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Zsoldier
Expert
Expert
Jump to solution

Thanks LucD​.  Isn't the point of "connect-cisserver" to authorize my connection to the VAMI REST API?  I was hoping to avoid making something custom, although if that's what I'm going to need to do so be it.

Thanks for the proxy output, seems I was on the right track, just needed to get past the authorization problem.

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos
Zsoldier
Expert
Expert
Jump to solution

I see where my issue is now.  I was so focused on just changing the proxy config, that I assumed that I should be authenticating against the 'VAMI' REST API as the VCSA local root user.  Which, by the way, authenticates just fine, but does not seem to grant any worthwhile access.  I had to authenticate using my SSO admin account.

Chris Nakagaki (中垣浩一)
Blog: https://tech.zsoldier.com
Twitter: @zsoldier
0 Kudos