VMware vSphere

 View Only
  • 1.  Ansible - Unable to log on to vCenter or ESXi API

    Posted Nov 05, 2023 12:42 PM

    I get "Unable to log on to vCenter or ESXi API at x.x.x.x:443 as ansible@vsphere.local: Cannot complete login due to an incorrect user name or password." when trying to connect to vCenter via Ansbile. I also tried to use the administrator@vshpere.local account to my vSphere and it doesn't work. Here is an example: https://192.168.1.251/api/appliance/system/version. I am presented with a login box and use administrator account with no luck. Here is the message when I click on the cancel button: {"error_type":"UNAUTHENTICATED","messages":[{"args":[],"default_message":"Authentication required.","id":"com.vmware.vapi.endpoint.method.authentication.required"}]}
    Is there a way that I can verify or create a user that has access to the API?

    I am able to log into the vCenter console using the same credentials. Is there a setting that I am missing?

    I am using administrator@vshpere.local as the login user.

    Here is some info from the ESXI directly.
    {
    "summary": "VMware vCenter Server 8.0 Update 2",
    "install_time": "2023-10-10T03:15:25.604Z",
    "product": "VMware vCenter Server",
    "build": "22385739",
    "releasedate": "September 21, 2023",
    "type": "vCenter Server with an embedded Platform Services Controller",
    "version": "8.0.2.00000"
    }
    Any help would be greatly appreciated.



  • 2.  RE: Ansible - Unable to log on to vCenter or ESXi API

    Posted Nov 14, 2023 02:27 AM

    Bump



  • 3.  RE: Ansible - Unable to log on to vCenter or ESXi API

    Posted Nov 14, 2023 06:10 AM

    Use token authentication for API, look here for more info: https://developer.vmware.com/apis/vsphere-automation/latest/vcenter/api/vcenter/authentication/token/post/

    If you really want to use un/pw, try a different format: 

    For example: using username@vsphere.local in curl calls gives authentication errors.

    switching format to VSPHERE.LOCAL\username will work without issues.