vmware / pyvmomi-community-samples

A place for community contributed samples for the pyVmomi library.
Apache License 2.0
1.01k stars 922 forks source link

NoPermission error while trying to set encryption policy with administrator user #724

Open deepaliamali opened 1 year ago

deepaliamali commented 1 year ago

Describe the bug

I'm trying to set default encryption policy "VM Encryption Policy" to a VM using community sample script. The script completes without any issues. On vCenter UI I see the error "Permission to perform this operation was denied. NoPermission.message.format" I can set the other storage policies correctly to the VM where encryption is not involved. I can perform the same operations using powerCLI scripts with the same user. the pyvmomi library I'm using in on Python2 and is of version : 6.7.1

I was not able to get the information related to the mentioned error in vCenter logs. Can someone point me to correct direction for the logs and possible reason of this issue.

Screenshot 2023-06-20 at 2 27 44 PM

Update

Issue still persists With python3 and pyvmomi version being 8.0.0.1.2

Reproduction steps

  1. Connected to vCenter server.
  2. Got the vm object I wanted to set encryption policy for.
  3. set storage policy for the VM with _ReconfigVMTask on VirtualMachine Managed Object.

Expected behavior

Encryption policy should be applied to VM.

Additional context

No response