Thursday, November 13, 2014

Log in securely to a vCAC server using command Line Interface (vcac-cli)

With vcac-cli you can do the same stuff what would be doing from vCAC Console, you may request machine from catalog, re-provision a machine, view request and more.  There are 3 different modes,

  1. Interactive Mode

  1. Command Line Mode :
The command line mode lets you incorporate vcac-cli commands in other scripts and programs.

  1. CLI Script Mode
The CLI Script mode is similar to the command line mode, except that you can invoke multiple commands in sequence.

There are 2 prerequisites to install vCAC-CLI

  • Your machine must have Java SE Development Kit (JDK) 7 installed and running.
  • Your PATH environment variable must include the location of the correct version of Java.

Steps:

  1. Open a browser and enter the vCAC appliance name or IP.
  2. Download the command-line interface (vcac-cli) distribution package.
  3. After extracting, you would get 3 folders, i.e., BIN, ETC and REPO.
  4. Open the BIN and there would be 3 files. (spring-shell keeps the history of commands run)
  5. Right click on vcac-cli (batch file) and click on run as Administrator, that should log you in to vCAC cli utility.

To open a secure connection to your respective vCAC server, follow below steps:

Syntax -  " login --sessionid, --url, --user, --password, --tenant "

I used the below command to connect to my default tenant (vsphere.local), even if you omit the --tenant it will log in to the default Tenant.

 login --sessionid 01 --url https://lab-vcac-server.ps.local --user administrator@vsphere.local  --tenant vsphere.local

It will prompt for the password, enter the password for the entered user and make sure you get the "login successful" message.

Now you are connected to your vCAC server and you may perform all steps which could do from console.

Sample commands:

Type "rest get --service authentication --uri tenants" to get the list of tenants

To see the running services, just type "services"


I hope this post was informative. 

No comments:

Post a Comment