Solving problems invented by others...
My journey to automate vCloud Director with PowerShell – part #1: access the API

My journey to automate vCloud Director with PowerShell – part #1: access the API

prolog

My employer was discussing the installation of vCloud Director for years now. After the decision was made, I finally got the chance to play around with the installation. So, I could start my journey of exploring the functionality of this product.

how to access the API

I’m a PowerShell guy. Therefore, I updated my powercli modules to the latest version and start to explore the functions they gave me. I soon realized that they are only a subset of the functionality of the API. (For example: One of the first things I searched was to create an Organization VDC template. Till now, I did not found a powercli command to accomplish this.)

Because I got some experience with PowerShell and REST APIs, I started to search a way to access the API directly.

My search for documentation of the vCloud Director API led me soon to this page:
https://docs.vmware.com/en/vCloud-Director/index.html

Unfortunately, I have really great problems to understand it. Since I’m a PowerShell guy, I’m not really familiar with REST APIs. I used them of course in the past for products like checkmk or Zerto. But the documentation and examples for that products I found on the web were quite better to understand for me. What I really missed here are some simple examples how to accomplish some basic task.

I tried it anyways, but I couldn’t even get a proper logon to work.

What I found while searching for PowerShell examples were some scripts showing me a combined approach. Using PowerCli as much as possible and dive into the underlying REST API objects if necessary.

For example, I found no way to add a user to an organization. I only found the Get-CIUser commandlet (https://code.vmware.com/docs/11794/cmdlet-reference/doc/Get-CIUser.html) but there is no New-CIUser.

My search discovered that I can use a method of the organization object I got with the Get-Org commandlet to create a user for that OrgVDC. (I will later describe the details.)

I began to understand that PowerCli is not limited to the given commandlets. It rather offers the whole spectrum of the API.

With this in mind, I started my journey using PowerCli as far as possible and dive into the REST API sub-objects whenever necessary.


Next article in this series:

Part #2 : connect

Leave a Reply

Your email address will not be published. Required fields are marked *

thirty seven − = twenty eight