Not able to unregister the VM from deployments since the unregister option is is greyed out on UI or unregister action is available on UI but the unregister fails.
VMware Aria Automation 8.x
Prerequisite:
Take a non-memory snapshot of all the aria automation nodes.
Resolution:
1. Enable the config toggle with below command:
curl --location --request POST '\{vRA-url}/provisioning/config/toggles' --header 'Authorization: Bearer \{{{Token}}}' --header 'Content-Type: application/json' --data '\{"key": "enable.unregister.provisioned.machine", "value": "true"}' --insecure
Refer KB370719 for help on enabling the config toggle.
2. Get the compute ID for the deployment:
curl --location --insecure '{vRA-url}/deployment/api/deployments/{deployment-id}?expand=resources' \
--header 'Authorization: ••••••'
Compute id should be taken for the resource type "Cloud.vSphere.Machine"
3. Unregister the VM from deployment:
curl -k -X 'POST' \
'{vRA-url}/iaas/api/machines/{compute-id}/operations/unregister?apiVersion=2021-07-15' \
-H 'accept: application/json' \
-H 'Authorization: Bearer ****** ' \
-d ''
Replace the {compute-id} with the id collected from step 2: