vmware / PowerCLI-Example-Scripts

http://blogs.vmware.com/powercli
Other
765 stars 608 forks source link

Set-VsanEncryptionKms does not appear to work with vCenter 8 #635

Open smoonen opened 2 months ago

smoonen commented 2 months ago

Describe the bug

The function Set-VsanEncryptionKms seems to no longer work with vCenter 8. The KMS cluster object no longer appears to have a Name attribute which results in the function blowing up.

Reproduction steps

  1. Import the VMware.VMEncryption and VMware.VsanEncryption modules
  2. Connect to vCenter
  3. Run Set-VsanEncryptionKms, for example: Set-VsanEncryptionKms -Cluster cluster1 -KMSCluster kmip1

Expected behavior

Expected to reconfigure vSAN key provider if valid. Instead, an exception occurs:

You cannot call a method on a null-valued expression.
At C:\Users\Administrator\Downloads\PowerCLI-Example-Scripts-master\PowerCLI-Example-Scripts-master\Modules\VMware.VsanEncryption\VMware.VsanEncryption.psm1:136 char:13
+         If ($KmsClusterList.Name.Contains($KmsCluster)) {
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Changing the KMS Profile to  on Cluster cluster1
Exception calling "VsanClusterReconfig" with "2" argument(s): "General vSAN error."
At C:\Users\Administrator\Downloads\PowerCLI-Example-Scripts-master\PowerCLI-Example-Scripts-master\Modules\VMware.VsanEncryption\VMware.VsanEncryption.psm1:191 char:13
+             $ChangeKmsTask = $VsanVcClusterConfig.VsanClusterReconfig ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FaultException

Additional context

No response