vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
743 stars 601 forks source link

Unexpected error Get-SsoPersonUser getting cloudadmin@vmc.local #612

Closed jd-sherman closed 1 year ago

jd-sherman commented 1 year ago

Describe the bug

I am able to connect to my cloud vcenter using cloudadmin@vmc.local. I am able to execute other Get-Sso commands

Get-SsoPasswordPolicy Get-SsoAuthenticationPolicy Get-SsoPersonUser

But when I try to specifically get the cloudadmin@vmc.local account:

Get-SsoPersonUser -Name cloudadmin -Domain vmc.local

I get the following error:

Get-SsoPersonUser : One or more errors occurred. At line:1 char:1 Get-SsoPersonUser -Name cloudadmin -Domain vmc.local CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-SsoPersonUser

I'm expecting to be able to login, get cloudadmin@vmc.local, change its password and disconnect as below

Connect-SsoAdminServer -Server vcenter.sddc-XX-XXX-XX-XXX.vmwarevmc.com -User cloudadmin@vmc.local -Password password -SkipCertificateCheck

Get-SsoPersonUser -Name cloudadmin -Domain vmc.local | Set-SsoPersonUser -NewPassword newpassword

Disconnect-SsoAdminServer -Server vcenter.sddc-XX-XXX-XX-XXX.vmwarevmc.com

Reproduction steps

Connect-SsoAdminServer -Server vcenter.sddc-XX-XXX-XX-XXX.vmwarevmc.com -User cloudadmin@vmc.local -Password password -SkipCertificateCheck

Get-SsoPersonUser -Name cloudadmin -Domain vmc.local 

Expected behavior

I expect to be able to connect, get the cloudadmin@vmc.local via Get-SsoPersonUser and pipe that to Set-SsoPersonUser to change the password. Finally disconnect.

Additional context

No response

jd-sherman commented 1 year ago

While it would be nice if this code worked the same in both environments, local and cloud, I have learned that Set-SsoSelfUserPersonPassword does the password change I need. So feel free to close this bug report as mostly unnecessary.