Skip to content

VMware.vSphere.SsoAdmin: Glitch that leads Set-VcenterServerGlobalPermission usage to fail (and test of proposed correction of the glitch seems to solve the issue) #640

@fbarutel

Description

@fbarutel

Describe the bug

When using the module Set-VcenterServerGlobalPermission using the following kind of usage:

Install-Module VMware.vSphere.SsoAdmin
$MobConnection = Connect-VcenterServerMOB -SkipCertificateCheck -Server <vcenter_FQDN> -User <vcenter administrator user from vsphere.local domain> -Password <Password of provided vcenter administrator account>
Set-VcenterServerGlobalPermission -Server $MobConnection -TargetUser <test001@vsphere.local> -RoleID (Get-VIRole -Name $RoleName).ExtensionData.RoleId -Propagate

, I got the following error:

InvalidOperation: /root/.local/share/powershell/Modules/VMware.vSphere.SSoAdmin/1.4.0/MobConnect.ps1:398
Line |
 398 |         $Server.SetPermissions($TargetUser, $RoleId, $Propagate)
     |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Method invocation failed because [MobConnection] does not contain a method named 'SetPermissions'.

I used VMware.vSphere.SsoAdmin module version 1.4.0 (the last version, freshly published 7 days ago at the timing of writing this issue)

Reproduction steps

  1. Install-Module VMware.vSphere.SsoAdmin
  2. $MobConnection = Connect-VcenterServerMOB -SkipCertificateCheck -Server <vcenter_FQDN> -User -Password
  3. Set-VcenterServerGlobalPermission -Server $MobConnection -TargetUser test001@vsphere.local -RoleID (Get-VIRole -Name $RoleName).ExtensionData.RoleId -Propagate
  4. Disconnected-VcenterServerMOB -Server $MobConnection

Expected behavior

At the Set-VcenterGlobalPermission step, prompt is given back without any error.
The role with name "$RoleName" is seen allocated at a GlobalPermission within the Adminstration>Access Control>Global Permissions part in vCenter HMI.

Additional context

I update the line 398 of /root/.local/share/powershell/Modules/VMware.vSphere.SSoAdmin/1.4.0/MobConnect.ps1 replacing "SetPermissions" by "SetGlobalPermissions"
And I imported with force the slighlty updated local module:
Import-Module -Name '/root/.local/share/powershell/Modules/Vmware.vSphere.SsoAdmin' -Force -Verbose

Then reproduction steps were done again with successfull results, as described in 'Expected behavior' chapter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions