Well, first said I would. Then I said I didn’t have time. Then I woke up 5.30 in the morning. So I thought I would anyway. What’s that? Well, I thought I would check out the new cmdlets added in PowerCLI 5.1 that allow for the management of vCloud Director. The main reason for doing this is with 4 Organizations with 2 Organization vDC’s each that’s quite a bit of work to do via the UI of vCD, and I wanted to see how much I could achieve by just using the PowerCLI cmdlets. There’s two types of “scope” here by the way – there cmdlets that would be used by the SysAdmin say for creating a new Organization vDC and there are cmdlets for “Tenants” who’s scope it limited by the Organization, and rights within them.
First lets start with the basics. The vCloud Director cmdlets are installed when you setup PowerCLI 5.1 for the first time. If you opted not to install these, you may need to re-run the installer to enabled them. Typically, when faced with these sorts of options, I just install the whole darn thang. The PowerCLI for Tenants is seperate download/installation as its assumed that your tenants do not need access to the full vSphere/vCloud Director set – the “Tenant” download is available here:
http://communities.vmware.com/community/vmtn/server/vsphere/automationtools/powercli?view=overview
Note: If you install the core vSphere/vCD PowerCLI you good to go. The “tenant” edition does not install along side the core. The tenant version is intended to just give a smaller subset of PowerCLI commands to those who merely manage the Organization in vCD. To check if you have the cmdlets available you can run:
get-command -Module vmware.vimautomation.cloud | select name
This will give you a full listing of the cmdlets available (you can click on the image to get a bigger view!)
and if you want help on a particular cmdlet get-help followed by the cmdlet name will give you plenty of detail such as get-help connect-ciserver. Connect-ciserver is a pretty important cmdlet as it allows you to connect to the vCD “cell” with either SysAdmin rights or rights to specific Organization within the vCD instance. So for example,
If I was the SysAdmin I would use:
connect-ciserver -server mycloud.corp.com –user admin –password Password1
and to disconnect, just as with equivalent cmdlet with vSphere/vCenter we can do that with:
disconnect-ciserver * -confirm:$false
If I was the OrgAdmin I would use:
connect-ciserver -server mycloud.corp.com -userrmoorcroft@corp.com-password Password1 -Org CorpHQ
So really the difference between the two logins is the -Org parameter.
As a SysAdmin there are some reporting cmdlets to get you going, that will pull back information such as get-providervdc, get-org, get-orgvdc
So… (drumroll) what I want to do is create a new Organization Virtual Datacenter for COIG (Corp Oversea Investment Group). First I need to connect to the Organization COIG as the SysAdmin – remember only SysAdmins can create new Organization vDCs.
connect-ciserver -server mycloud.corp.com -user admin -password Password1
Next I need to specify the parameters for new Organization Virtual Datacenter. In my case I used the PAYG resource model for a new “Test/Dev” Virtual Datacenter using the New-OrgVdc cmdlet.