@Mahitha It could permission issue, Can re-create the secret with the new version and try again to encrypt.
For understanding the issue: Did you complete disk encryption prerequisites before encrypting the VM? If not, I would recommend you to refer here.
There is a similar thread discussion in GitHub forum, please refer to the suggestion Encountering the following error while azure disk encryption
Also check: Go to the disk of a VM that needs to be encrypted->Click Identity->Turn Status to "ON" for a system or user assigned.
Then execute below commands. It is available with explanation on https://video2.skills-academy.com/en-us/azure/virtual-machines/windows/encrypt-disks
- Check the values of the $KeyVault, $DiskEncryptionKeyVaultUrl, and $KeyVaultResourceId variables and make sure they are not null or empty.
Check the Key Vault creation process thoroughly, and check if it is in the same region as the VM and that it has been enabled for disk encryption:Set-AzKeyVaultAccessPolicy -VaultName $keyVaultName - EnabledForDiskEncryption
If the issue still persist, can you share the completed Powershell code code.
Hope this helps!
Kindly let us know if the above helps or you need further assistance on this issue.
-------------------------------------------------------------------------------------------------------------------------------------------------
Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.