Use Case:- I have developed a customized solution for migrating Deployment/workload
VMs from vRA7.x to vRA8.x.
The onboarding process for a VM
required manual intervention, which is time-consuming and prone to
human errors when updating custom properties, lease, owner, and other
details. However, with this automation, administrators and developers
can migrate deployments with just a few clicks, significantly reducing
complexity and the likelihood of errors. I have provided high-level
steps and API details for reference. If you require further information/automation and help,
please don't hesitate to reach out to me.
Pre Requisite:-
vSphere endpoint configuration in vRA8 |
Connectivity from vRA7-vRA8 for API (80/443) |
Service Account for both vRA’s (should have organization level access) |
Projects should configured properly like user and group |
VMs should discovered by vRA 8 |
Any deployments that are stuck in Day 2 operations, destroy or in-progress, should be cleared or resolved. |
High Level Steps:-
- Get vRA7 token (Add vRA7 as endpoint and use below API to generate the token, using vRA8 as development plane)
- "https://<VRA7 URL>/identity/api/tokens"
- Get vRA7 deployment based on API filter (sharing some for reference paging needed)
- "https://<VRA7 URL>/catalog-service/api/consumer/deployments?subtenants=" + businessGroupId + "&components=Infrastructure.Machine&page=1&limit=30"
- "https://<VRA7 URL>/catalog-service/api/consumer/deployments?subtenants=" + businessGroupId + "&components=Infrastructure.Machine&Owner=rishabh@vsphere.local&page=1&limit=30"
- Get project ID/ Endpoint ID (needed for vRA8 onborading plan)
- endpointId = vsphereEndpoint.id; projectId = project.id
- Create vRA8 plan
- "https://<VRA8 URL>/relocation/onboarding/plan"
- Discover VM which is planned for migrated and fetched in step2
- "https://<VRA8 URL>/relocation/api/wo/query-unmanaged-machine" (var fiter = [{"field": "ID", "values": machineID}]; payload = {"planLink":planLink,"expandFields":["id","documentSelfLink","name","powerState","address","creationTimeMicros","expandedTags","tagLinks","endpointLinks"],"optionExcludePlanMachines":true,"filters":fiter,"pageResultLimit": 5000})
- Add VMs to the plan using resourec link
- "https://<VRA8 URL>/relocation/onboarding/task/create-deployment-bulk"
- Rename the deployment (optional)
- "https://<VRA8 URL>/relocation/onboarding/resource?expand&$filter=deploymentLink%20eq%20%27" + Planlink + "%27"
- Execute Plan (onboard VMs)
- "https://<VRA8 URL>/relocation/api/wo/execute-plan"
- Update onboarded custom properties (optional)
- Update Owner of the deployment (optional)
- Update lease of the deployment (optional)
- Gather evidence (optional)