vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
757 stars 603 forks source link

Implement update authentication credential for LDAP identity sources #516

Closed dmilov closed 2 years ago

dmilov commented 2 years ago

Fixes issue #508

New module version 1.3.7

Changelog:

Testing done: All unit tests pass Integration tests for the new features

# test update certificates
 Get-IdentitySource -External | Set-LDAPIdentitySource -Certificates 'C:\Temp\test.cer'

# test update authentication with username and password
 Get-IdentitySource -External | Set-LDAPIdentitySource -Username 'apifvt@sof-powercli-qe' -Password 'CENSORED'

# test update authentication with bad username and password
 Get-IdentitySource -External | Set-LDAPIdentitySource -Username 'apdd@sof-powercli-qe' -Password 'CENSORED'
Set-LDAPIdentitySource: Failed to probe provider connectivity [URI: ldap://sof-powercli-qe.eng.vmware.com:389 ]; tenantName [vsphere.local], userName [apdd@sof-powercli-qe]
Caused by: Invalid credentials

# test add LDAP identity source with username and password
Add-LDAPIdentitySource `
           -Name 'sof-powercli' `
           -DomainName 'sof-powercli.vmware.com' `
           -DomainAlias 'sof-powercli' `
           -PrimaryUrl 'ldap://sof-powercli.vmware.com:389' `
           -BaseDNUsers 'CN=Users,DC=sof-powercli,DC=vmware,DC=com' `
           -BaseDNGroups 'CN=Users,DC=sof-powercli,DC=vmware,DC=com' `
           -Username 'apifvt@sof-powercli.vmware.com' `
           -Password 'CENSORED' `
           -Certificates 'C:\Temp\test.cer'
# test add LDAP identity source with credential
Add-LDAPIdentitySource `
           -Name 'sof-powercli' `
           -DomainName 'sof-powercli.vmware.com' `
           -DomainAlias 'sof-powercli' `
           -PrimaryUrl 'ldap://sof-powercli.vmware.com:389' `
           -BaseDNUsers 'CN=Users,DC=sof-powercli,DC=vmware,DC=com' `
           -BaseDNGroups 'CN=Users,DC=sof-powercli,DC=vmware,DC=com' `
           -Credential $cr `
           -Certificates 'C:\Temp\test.cer'

Signed-off-by: Dimitar Milov dmilov@vmware.com