6.5

Table Of Contents
VMware, Inc. 13
Chapter 1 Getting Started with vSphere SDK for Perl
Thisorderofprecedencealwaysapplies.Thatmeans,forexample,thatyoucannotoverrideanenvironment
variablesettinginaconfigurationfile.
Authenticating Through vCenter Server and vCenter Single Sign-On
ForallESXihoststhat aremanagedbyavCenterServersystemthatisintegratedwithvCenterSingleSignOn
6.0andlater,youcanauthenticatedirectlytothevCenterServersystem,oryoucanauthorizetovCenter
ServerthroughvCenterSingleSignOn.
BestpracticeistoauthenticatethroughvCenter
SingleSignOn.ThevCenterSingleSignOnserviceis
includedinthePlatformServicesController.ThePlatformServicesControllercanbeembeddedinyour
vCenterServerinstallation,oronePlatformServicesControllercanhandleauthentication,certificate
management,andsomeothertasksformultiplevCenterServersystems.
Youusethe
--pscoptionand,optionally,the--server option.
psc‐SpecifiesthePlatformServicesControllerinstanceassociatedwiththevCenterServersystemthat
managesthehost.
server‐SpecifiesthevCenterServersystemthatmanagesthehost.RequiredifthePlatformServices
ControllerinstanceisassociatedwithmorethanonevCenterServersystem.
vihost‐SpecifiestheESXihost,asinearlierversionsofvCLI.
Example
vminfo.pl --server <vc_HOSTNAME_OR_IP> --psc <psc_HOSTNAME_OR_IP> --vihost
<esxi_HOSTNAME_OR_IP>--username root --password vmware --vihost <esxi_host>
IfthespecifieduserisknowntovCenterSingleSignOn,asessioniscreated.Youcansavethesessionwiththe
--savesessionfileargument,andlaterusethatsessionwiththe--sessionfile argument.
UsingasessionfileresultsinlessoverheadandbetterperformancethanconnectingtothePlatformServices
Controller
repeatedly.
Using a Session File
Thesave_session.plscriptintheapps/sessiondirectoryillustrateshowtocreateasessionfile.Youcan
modifythescriptandincludeitinyourownapplication,orcreateasessionfileusingthescriptonthe
commandline,andthenpassinthatsessionfilewhenrunningvSphereSDKforPerl
commands.See“Saving
Sessions”onpage 36.
Thesessionfiledoesnotrevealpasswordinformation.Ifasessionfileisnotusedfor30minutes,thesession
expires.
To create and use a session file
1 Connecttothedirectorywherethescriptislocated,forexample,onWindows:
cd C:\Program Files\VMware\VMware vSphere CLI\Perl\apps\session
Environment
variable
Passwordspecifiedinanenvironment
variable.
“SettingEnvironmentVariables”onpage 14
Credentialstore Passwordretrievedfromthecredentialstore. “CredentialStorePerlLibraryonpage 61
Currentaccount
(ActiveDirectory)
Currentaccountinformationus edtoestablish
anSSPIconnection.Windowsonly.
.“UsingMicrosoftWindowsSecuritySupport
ProviderInterface(SSPI)”onpage 15
Prompttheuserfora
password.
NOTEYoucannotusethisapproachifvCenterServerisintegratedwithvCenterSingleSignOn5.0.
Table 1-2. vSphere CLI Authentication Precedence (Continued)
Authentication Description See