Import/export blueprint of vRealize Automation can be done on two different way.
We can use vRealize Automation REST API or Cloud Client
- vRealize Automation REST API
vRealize Automation REST API provide us many powerfull services for managing our vRA. To use the REST API we only need application which is able to send request.
We can use curl,Postman or some plugins to web browser.
For import and export blueprint we will use Content Management service
Content Management Service | Access and manage the content controller and package controller for export and import processes. This includes export and import for blueprints and software. |
To use REST API for import and export blueprint we need one of those roles
Application architect To successfully add software components to the design canvas, you must also have business group member, business group administrator, or tenant administrator role access to the target catalog. | Assemble and manage composite blueprints. |
Infrastructure architect To successfully add software components to the design canvas, you must also have business group member, business group administrator, or tenant administrator role access to the target catalog. | Create and manage infrastructure blueprint components. Assemble and manage composite blueprints. |
Software architect To successfully add software components to the design canvas, you must also have business group member, business group administrator, or tenant administrator role access to the target catalog. | Create and manage software blueprint components. Assemble and manage composite blueprints. |
Firtstly we need to request for Bearer toke which is used for authentication
curl --insecure -H "Accept: application/json" -H 'Content-Type: application/json' --data '{"username":"vra-user@company.com","password":"vra-user-password","tenant":"company.com"}' https://$vRA/identity/api/tokens
In response we got json with ID
As we have our Bearer now we are able to work with REST API.
List Content
To List Content we can use full command
$curl --insecure -s -H "Content-Type: application/json"-H "Authorization: Bearer $token" https://$vRA/content-management-service/api/contents
or filter it by content ID in this case as composite blueprint
$curl --insecure -s -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA/content-management-service/api/contents?%24filter=contentTypeId+eq+%27composite-blueprint%27
In reply we will get ID which will be used for creating package
Create Package
$curl --insecure -s -H "Content-Type: application/json" -H "Authorization: Bearer $token" https://$vRA/content-management-service/api/packages -d'{"name" : "Demo Package", "description" : "Package for demo purposes", "contents" : ["content_ID" ]}'
after creation we can list this for getting ID for export
$curl --insecure -s -H"Content-Type: application/json" -H "Authorization: Bearer $token"https://$vRA/content-management-service/api/packages
Export Package
$curl --insecure -s -H "Accept: application/zip" -H "Authorization: Bearer $token" https://$vRA/content-management-service/api/packages/package_ID -o package.zip
Import Package
$curl --insecure -s -H "Content-Type: multipart/form-data" -H "Authorization: Bearer $token" https://$vRA/content-management-service/api/packages -F "file=@package_name.zip"
- Cloud Client
To use CloudClient we must have those specific role
Infrastructure architect To successfully add software components to the design canvas, you must also have business group member, business group administrator, or tenant administrator role access to the target catalog. | Create and manage infrastructure blueprint components. Assemble and manage composite blueprints. |
Software architect To successfully add software components to the design canvas, you must also have business group member, business group administrator, or tenant administrator role access to the target catalog. | Create and manage software blueprint components. Assemble and manage composite blueprints. |
Before we start using Cloud Client we need to download it from VMware site CloudClient.
This tool is a simple command line interface and to run it we need to extract file go to the folder and run bin\cloudclient.bat
First step is to login into our vRealize environment. To do this we need to have
vra login userpass –user username –tenant tenant_name –server server_name —password password
For some task we also need to login as an IaaS admin. For that we are providing the WEB server parameter
vra login iaas –user username –password password –domain domain_name –server server_name
Before we export plugin we need to know what we have in our vRA. To do this we can use command
- EXPORTING
vra blueprint list
Unfortunatelly we cannot use this id and we need content id which we get with this command
vra content list
Now we can download our blueprint with this command
vra content export –path path_on_disk –id id_from_content_list –content-id content_id
- IMPORTING
In quite same simple way we are able to import blueprint for vRA
vra content import –path path_to_file –resolution OVERWRITE/SKIP –verbose –precheck WARN