Unregister a Virtual machine via API calls from Aria Automation 8.x deployment
search cancel

Unregister a Virtual machine via API calls from Aria Automation 8.x deployment

book

Article ID: 398330

calendar_today

Updated On:

Products

VCF Operations/Automation (formerly VMware Aria Suite)

Issue/Introduction

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.

Environment

VMware Aria Automation 8.x

Resolution

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: