VMware VSphere Automation SDK For Python Programming Guide - VSphere .

Transcription

VMware vSphere Automation SDK forPython Programming GuideModified on 18 JUN 2018vSphere Automation SDK for Python 6.5vCenter Server 6.5VMware ESXi 6.5

VMware vSphere Automation SDK for Python Programming GuideYou can find the most up-to-date technical documentation on the VMware website at:https://docs.vmware.com/VMware, Inc.3401 Hillview Ave.Palo Alto, CA 94304www.vmware.comCopyrightVMware, Inc. 2015-2018 VMware, Inc. All rights reserved. Copyright and trademark information.2

ContentsAbout VMware vSphere Automation SDK for Python Programming Guide 6Updated Information 71 Introduction to the vSphere Automation SDKs 8vSphere Automation SDKs Overview8Supported Programming Languages102 Components of the vSphere Automation Virtualization Layer 11Components and Services of a Virtual EnvironmentvSphere Deployment Configurations11123 Retrieving Service Endpoints 15Filtering for Predefined Service Endpoints16Filter Parameters for Predefined Service Endpoints17Connect to the Lookup Service and Retrieve the Service Registration Object18Python Example of Connecting to the Lookup Service and Retrieving a Service RegistrationObject 18Retrieve Service Endpoints on vCenter Server Instances19Python Example of Retrieving a Service Endpoint on a vCenter Server InstanceRetrieve a vCenter Server ID by Using the Lookup Service2020Python Example of Retrieving a vCenter Server ID by Using the Lookup ServiceRetrieve a vSphere Automation Endpoint on a vCenter Server Instance2122Python Example of Retrieving a vSphere Automation Endpoint on a vCenter Server Instance224 Authentication Mechanisms 23Retrieve a SAML Token24Python Example of Retrieving a SAML Token25Create a vSphere Automation Session with a SAML Token25Python Example of Creating a vSphere Automation API Session with a SAML TokenCreate a vSphere Automation Session with User CredentialsCreate a Web Services Session262728Python Example of Creating a Web Services Session285 Accessing vSphere Automation Services 30Access a vSphere Automation ServiceVMware, Inc.303

VMware vSphere Automation SDK for Python Programming Guide6 Content Library Service 32Content Library Overview33Content Library Types33Content Library Items33Content Library StorageQuerying Content Libraries3435Listing All Content Libraries35Listing Content Libraries of a Specific Type35List Content Libraries by Using Specific Search CriteriaContent Libraries36Create a Local Content Library37Publish an Existing Content Library38Publish a Library at the Time of CreationSubscribe to a Content Library3940Synchronize a Subscribed Content LibraryEditing the Settings of a Content Library4242Removing the Content of a Subscribed LibraryDelete a Content LibraryLibrary Items36434444Create an Empty Library ItemQuerying Library Items4546Edit the Settings of a Library Item47Upload a File from a Local System to a Library ItemUpload a File from a URL to a Library Item4849Download Files to a Local System from a Library Item50Synchronizing a Library Item in a Subscribed Content LibraryRemoving the Content of a Library ItemDeleting a Library Item5252527 Content Library Support for OVF Packages 53Using the Content Library Service to Handle OVF PackagesUpload an OVF Package from a URL to a Library Item5353Upload an OVF Package from a Local File System to a Library ItemUsing the LibraryItem Service to Execute OVF-Specific Tasks5556Deploy a Virtual Machine or Virtual Appliance from an OVF Package in a Content Library57Create an OVF Package in a Content Library from a Virtual Machine588 Tagging Service 60Creating Tags60Creating a Tag CategoryVMware, Inc.614

VMware vSphere Automation SDK for Python Programming GuideCreating a Tag62Creating Tag Associations62Assign the Tag to a Content LibraryAssign a Tag to a ClusterUpdating a Tag636364Python Example of Updating a Tag Description649 Virtual Machine Configuration and Operations 66Filtering Virtual Machines66Python Example of Filtering Virtual MachinesCreate a Virtual Machine6767Python Example of Creating a Basic Virtual MachineConfiguring a Virtual MachineName and PlacementBoot Options686970Operating System71CPU and Memory72Networks74Performing Virtual Machine Power Operations76Python Example of Powering On a Virtual MachineVMware, Inc.67775

About VMware vSphere Automation SDKfor Python Programming GuideVMware vSphere Automation SDK for Python Programming Guide describes how to use theVMware vSphere Automation SDK for Python. VMware provides different APIs and SDKs fordifferent applications and goals. The vSphere Automation SDK for Python supports thedevelopment of clients that use the vSphere Automation SDK for infrastructure support tasks .Intended AudienceThis information is intended for anyone who will develop applications using the vSphereAutomation SDK for Python. Some programming background in Python is required.VMware, Inc.6

Updated InformationThis VMware vSphere Automation SDK for Python Programming Guide is updated with eachrelease of the product or when necessary.This table provides the update history of the VMware vSphere Automation SDK for PythonProgramming Guide.RevisionDescription18 JUN 2018Updated some code snippets.15 NOV 2016Initial release.VMware, Inc.7

Introduction to the vSphereAutomation SDKs1The vSphere Automation SDKs bundle client libraries for accessing new vSphere Automationfeatures like Content Library and existing features like Tagging. The vSphere Automation SDKscontain sample applications and API reference documentation for the Content Library andTagging services. The vSphere Automation SDKs also provide sample code that retrieves theendpoints of vSphere Automation and vSphere services and establishes a secure connection withthe vSphere Automation endpoint.vSphere Automation supports six languages for accessing the vSphere Automation API servicesand provides six SDKs for developing client applications for managing components in your virtualenvironment.This chapter includes the following topics:nvSphere Automation SDKs OverviewnSupported Programming LanguagesvSphere Automation SDKs OverviewThe vSphere Automation API provides a unified programming interface to vSphere Automationservices that you can use through SDKs provided in six programming languages. The vSphereAutomation API provides a service-oriented architecture for accessing resources in the virtualenvironment by issuing requests to the vSphere Automation Endpoint.vSphere Automation API client applications communicate with services on the Platform ServicesController and vCenter Server.VMware, Inc.8

VMware vSphere Automation SDK for Python Programming GuideFigure 1-1. Communication Model of vSphere Automation API Client ApplicationsRetrieve serviceendpointsPlatform Services ControllerLookup ServiceEstablishauthenticatedsessionvCenter Single Sign-OnClientApplicationCommunicatewith servicesvCenter ServervSphere AutomationAPI EndpointContentLibraryТaggingServicevSphere API ServicesvSphere Automation API client applications use the Lookup Service to retrieve the vCenter SingleSign-On endpoint, the vSphere Automation Endpoint, and the endpoints of services that areexposed through the vSphere API. To access vSphere Automation services such as ContentLibrary and Tagging, client applications issue requests to the vSphere Automation Endpoint. Byusing the vCenter Single Sign-On service, client applications can either establish an authenticatedvSphere Automation session, or authenticate individual requests to the vSphere AutomationEndpoint.Client applications can access services that are exposed through the vSphere API by using thevSphere Management SDK.Depending on the vSphere deployment model, client applications can communicate with vSphereAutomation services on a single vCenter Server instance or multiple vCenter Server instances.For more information about the vSphere deployment models, see Chapter 2 Components of thevSphere Automation Virtualization LayerSDK Developer SetupTo start developing a vSphere Automation API client application, you must download thesoftware and set up a development environment. You can find instructions for setting up adevelopment environment in the README for each vSphere Automation SDK.VMware, Inc.9

VMware vSphere Automation SDK for Python Programming GuideSDK SamplesThe vSphere Automation SDKs provide sample applications that you can extend to implementclient applications that serve your needs. The code examples in the vSphere Automation SDKsdocumentation are based on these sample applications.Supported Programming LanguagesThe vSphere Automation SDKs are packed in six different programming languages that let youbuild client applications on your preferred programming language.nvSphere Automation SDK for JavanvSphere Automation SDK for PythonnvSphere Automation SDK for .NETnvSphere Automation SDK for PerlnvSphere Automation SDK for RubynvSphere Automation SDK for RESTVMware, Inc.10

Components of the vSphereAutomation Virtualization Layer2At the core of vSphere Automation is vSphere, which provides the virtualization layer of thesoftware-defined data center. You can use vSphere deployment options for vCenter Server andESXi hosts to build virtual environments of different scales.This chapter includes the following topics:nComponents and Services of a Virtual EnvironmentnvSphere Deployment ConfigurationsComponents and Services of a Virtual EnvironmentStarting with vSphere 6.0, the deployment of the virtual environment consists of two majorcomponents that provide different sets of services, the VMware Platform Services Controller andvCenter Server. You can deploy vCenter Server with an embedded or external Platform ServicesController.Services Installed with Platform Services ControllerThe Platform Services Controller group of infrastructure services contains vCenter Single SignOn, License Service, Lookup Service, and VMware Certificate Authority. The services installedwith the Platform Services Controller are common to the entire virtual environment. A PlatformServices Controller can be connected to one or more vCenter Server instances. In a deploymentthat consists of more than one Platform Services Controller, the data of each service is replicatedacross all Platform Services Controller instances.In vSphere Automation API client applications, you use the vCenter Single Sign-On and theLookup Service on the Platform Services Controller to provide a range of functionality.Authentication and Session ManagementYou use the vCenter Single Sign-On service to establish an authenticated session with thevSphere Automation Endpoint. You send credentials to the vCenter Single Sign-On serviceand receive a SAML token that you use to obtain a session ID from the vSphere AutomationEndpoint. Alternatively, you can access the vSphere Automation APIs in a sessionless mannerVMware, Inc.11

VMware vSphere Automation SDK for Python Programming Guideby including the SAML token in every request that you issue to the vSphere AutomationEndpoint.Service DiscoveryYou use the Lookup Service to discover the endpoint URL for the vCenter Single Sign-Onservice on the Platform Services Controller, the location of the vCenter Server instances, andthe vSphere Automation Endpoint.Services Installed with vCenter ServervCenter Server is a central administration point for ESXi hosts. The vCenter Server group of services contains vCenter Server, vSphere Web Client, Inventory Service, vSphere Auto Deploy , vSphere ESXi Dump Collector, VMware vSphere Syslog Collector on Windows andVMware vSphere Syslog Service for the vCenter Server Appliance.vCenter Server also provides services that you can access through the vSphere AutomationEndpoint.Content Library ServiceYou can use the Content Library Service to share VM templates, vApp templates, and otherfiles across the software-defined data center. You can create, share, and subscribe tocontent libraries on the same vCenter Server instance or on a remote instance. This promotesconsistency, compliance, efficiency, and automation in deploying workloads at scale. By usingcontent libraries, you can also create OVF packages from virtual machines and virtualappliances in hosts, resource pools, and clusters. You can then use the OVF packages toprovision new virtual machines in hosts, resource pools, and clusters.Tagging ServiceThis service supports the definition of tags that you can associate with vSphere objects orvSphere Automation resources. The vSphere Automation SDKs provide the capability tomanage tags programmatically.vSphere Deployment ConfigurationsvSphere Automation client applications communicate with services on the Platform ServicesController and vCenter Server components of the virtual environment. vCenter Server can bedeployed with an embedded or external Platform Services Controller.vCenter Server with an Embedded Platform Services ControllervCenter Server and Platform Services Controller reside on the same virtual machine or physicalserver. This deployment is most suitable for small environments such as development or testbeds.VMware, Inc.12

VMware vSphere Automation SDK for Python Programming GuideYou can use the Platform Services Controller in two ways to establish secure, authenticatedsessions for your client application, by making requests to the Lookup Service and the vCenterSingle Sign-On Service.One way to use the Platform Services Controller is to request an authentication token that can beused to authenticate requests across services. The client connects to the Lookup Service andretrieves the vCenter Single Sign-On Service endpoint and the vSphere Automation API endpoint.The client then uses the vCenter Single Sign-On endpoint to authenticate with user credentialsand receive a token that securely verifies the client's credentials. This allows the client toauthenticate with a number of service endpoints without sending user credentials over thenetwork repeatedly.Alternatively, if the client connects directly to the vSphere Automation API endpoint, there is noneed for the client to interact with the vCenter Single Sign-On Service. The client sends usercredentials to the vSphere Automation API endpoint, which creates a session identifier thatpersists across requests.Figure 2-1. vCenter Server with Embedded Platform Services ControllerVM or Physical ServerPlatform Services ControllerLookupServiceSingle Sign-OnService URLvSphere AutomationEndpoint URLvCenter ServerURLOther ServicesURLsSingleSign-ONServiceSAML TokenVMware ESXivCenter ServervAPIEndpointContent LibraryServiceТaggingServiceOther ServicesVMVMware ESXiVMware, Inc.13

VMware vSphere Automation SDK for Python Programming GuidevCenter Server with an External Platform Services ControllerIn the case of an external Platform Services Controller, the vCenter Server and the PlatformServices Controller are deployed on separate virtual machines or physical servers. The PlatformServices Controller can be shared across several vCenter Server instances. For largerdeployments or to provide better availability, more than one Platform Services Controller can bedeployed. When configured as replication partners within a single vCenter Single Sign-Ondomain, Platform Services Controller instances replicate all user and system data within thecluster.A client application functions in a similar way as in a Platform Services Controller with embeddedvCenter Server deployment. The only difference is that the client application can access serviceson multiple vCenter Server instances, or services only on a particular vCenter Server instance.Figure 2-2. vCenter Server with External Platform Services ControllerVM or Physical ServerPlatform Services ControllerLookupServiceSingle Sign-OnService URLvSphere AutomationEndpoint URLvCenter ServerURLOther ServicesURLsSingleSign-ONServiceSAML TokenVM or Physical ServerVM or Physical ServervCenter ServervAPIEndpointVMware ESXiVMware, Inc.vCenter ServerContent LibraryServiceТaggingServiceOther ServicesVMware ESXivAPIEndpointVMware ESXiContent LibraryServiceТaggingServiceOther ServicesVMware ESXi14

Retrieving Service Endpoints3To access services and resources in the virtual environment, vSphere Automation API clientapplications must know the endpoints of vSphere Automation and vSphere services. Clientapplications retrieve service endpoints from the Lookup Service that runs on the PlatformServices Controller.The Lookup Service provides service registration and discovery by using a Web services API. Byusing the Lookup Service, you can retrieve endpoints of services on the Platform ServicesController and vCenter Server. The following endpoints are available from the Lookup Service.nThe vCenter Single Sign-On endpoint on the Platform Services Controller. You use thevCenter Single Sign-On service to get a SAML token and establish an authenticated sessionwith a vSphere Automation endpoint or a vCenter Server endpoint.nThe vSphere Automation Endpoint on vCenter Server. Through the vSphere AutomationEndpoint, you can make requests to vSphere Automation API services such as virtualmachine management, Content Library, and Tagging.nThe vCenter Server endpoint. In an environment with external Platform Services Controllerinstances, you can use the vCenter Server endpoint to get the node ID of a particular vCenterServer instance. By using the node ID , you can retrieve service endpoints on that vCenterServer instance.nThe vSphere API endpoint and endpoints of other vSphere services that run on vCenterServer.Workflow for Retrieving Service EndpointsThe workflow that you use to retrieve service endpoints from the Lookup Service might varydepending on the endpoints that you need and their number. Follow this general workflow forretrieving service endpoints.1Connect to the Lookup Service on the Platform Services Controller and service registrationobject so that you can query for registered services.2Create a service registration filter for the endpoints that you want to retrieve.3Use the filter to retrieve registration information for services from the Lookup Service.VMware, Inc.15

VMware vSphere Automation SDK for Python Programming Guide4Extract one or more endpoint URLs from the array of registration information that youreceive from the Lookup Service.This chapter includes the following topics:nFiltering for Predefined Service EndpointsnFilter Parameters for Predefined Service EndpointsnConnect to the Lookup Service and Retrieve the Service Registration ObjectnRetrieve Service Endpoints on vCenter Server InstancesnRetrieve a vCenter Server ID by Using the Lookup ServicenRetrieve a vSphere Automation Endpoint on a vCenter Server InstanceFiltering for Predefined Service EndpointsThe Lookup Service maintains a registration list of vSphere services. You can use the LookupService to retrieve registration information for any service by setting a registration filter that youpass to the List() function on the Lookup Service. The functions and objects that you can usewith the Lookup Service are defined in the lookup.wsdl file that is part of the SDK.Lookup Service Registration FiltersYou can query for service endpoints through a service registration object that you obtain fromthe Lookup Service. You invoke the List() function on the Lookup Service to list the endpointsthat you need by passing LookupServiceRegistrationFilter. LookupServiceRegistrationFilteridentifies the service and the endpoint type that you can retrieve.Optionally, you can include the node ID parameter in the filter to identify the vCenter Serverinstance where the endpoint is hosted. When the node ID is omitted, the List() function returnsthe set of endpoint URLs for all instances of the service that are hosted on different vCenterServer instances in the environment.For example, a LookupServiceRegistrationFilter for querying the vSphere Automation service hasthese service endpoint elements.Table 3-1. Service Registration Filter ParametersFilter iceTypeproduct "com.vmware.cis"vSphere Automationnamespace.type "cs.vapi"Identifies the vSphereAutomation service.type "com.vmware.vapi.endpoint"Specifies the endpoint path forthe service.protocol Identifies the protocol that willbe used for communicationwith the endpoint ttps.public"VMware, Inc.16

VMware vSphere Automation SDK for Python Programming GuideFor information about the filter parameter of the available predefined service endpoints, seeFilter Parameters for Predefined Service Endpoints.Filter Parameters for Predefined Service EndpointsDepending on the service endpoint that you want to retrieve, you provide different parametersto the LookupServiceRegistrationFilter that you pass to the List() function on the LookupService. To search for services on a particular vCenter Server instance, set the node ID parameterto the filter.Table 3-2. Input Data for URL Retrieval for the Lookup Service Registration FilterServiceInput DataValuevCenter Single Sign-Onproduct namespacecom.vmware.cisservice typecs.identityprotocolwsTrustendpoint typecom.vmware.cis.cs.identity.ssoproduct namespacecom.vmware.cisservice typecs.vapiprotocolvapi.json.https.publicendpoint typecom.vmware.vapi.endpointproduct namespacecom.vmware.cisservice typevcenterserverprotocolvmomiendpoint typecom.vmware.vimproduct namespacecom.vmware.vim.smsservice typesmsprotocolhttpsendpoint typecom.vmware.vim.smsproduct namespacecom.vmware.vim.smsservice typesmsprotocolhttpsendpoint typecom.vmware.vim.pbmproduct namespacecom.vmware.vim.smsservice typecs.eamvSphere Automation EndpointvCenter ServervCenter Storage MonitoringServicevCenter Storage Policy-BasedManagementvSphere ESX Agent ManagerVMware, Inc.17

VMware vSphere Automation SDK for Python Programming GuideTable 3-2. Input Data for URL Retrieval for the Lookup Service Registration Filter (continued)ServiceInput DataValueprotocolvmomiendpoint typecom.vmware.cis.cs.eam.sdkConnect to the Lookup Service and Retrieve the ServiceRegistration ObjectYou must connect to the Lookup Service to gain access to its operations. After you connect tothe Lookup Service, you must retrieve the service registration object to make registrationqueries.Python Example of Connecting to the Lookup Service and Retrieving a Service RegistrationObjectnThe example is based on the code from the lookup service helper.py sample file.Procedure1Connect to the Lookup Service.2aConfigure a connection stub for the Lookup Service endpoint, which uses SOAP bindings,by using the HTTPS protocol.bCreate a connection object to communicate with the Lookup Service.Retrieve the Service Registration Object.aCreate a managed object reference to the Service Instance.bInvoke the RetrieveServiceContent() method to retrieve the ServiceContent data object.cSave the managed object reference to the service registration object.With the service registration object, you can make registration queries.Python Example of Connecting to the Lookup Service and Retrievinga Service Registration ObjectThe example is based on the code from the lookup service helper.py sample file.Note For a complete and up-to-date version of the sample code, see the vSphere AutomationSDK Python samples at GitHub.# 1 - Create SOAP client object to communicate with the Lookup Service.my ls stub Client(url wsdl url, location ls url)# 2 - Configure service & port type for client transaction.VMware, Inc.18

VMware vSphere Automation SDK for Python Programming Guidemy ls stub.set options(service 'LsService', port 'LsPort')# 3 - Manufacture a managed object reference.managed object ref \my ls anaged object ref. type 'LookupServiceInstance'managed object ref.value 'ServiceInstance'# 4 - Retrieve the ServiceContent object.ls service content \my ls stub.service.RetrieveServiceContent(managed object ref)# 5 - Retrieve the service registration object.service registration ls service content.serviceRegistrationRetrieve Service Endpoints on vCenter Server InstancesYou can create a function that obtains the endpoint URLs of a service on all vCenter Serverinstances in the environment. You can modify that function to obtain the endpoint URL of aservice on a particular vCenter Server instance.PrerequisitesnEstablish a connection with the Lookup Service.nRetrieve a service registration object.Procedure12Create a registration filter object, which contains the following parts:nA filter criterion for service informationnA filter criterion for endpoint informationOptionDescriptionOmit the node ID parameterRetrieves the endpoint URLs of the service on all vCenter Server instances.Include the node ID parameterRetrieves the endpoint URL of the service on a particular vCenter Serverinstance.Retrieve the specified service information by using the List() function.ResultsDepending on whether you included the node ID parameter, the List() function returns one ofthe following results:nA list of endpoint URLs for a service that is hosted on all vCenter Server instances in theenvironment.nAn endpoint URL of a service that runs on a particular vCenter Server instance.VMware, Inc.19

VMware vSphere Automation SDK for Python Programming GuideWhat to do nextCall the function that you implemented to retrieve service endpoints. You can pass different filterparameters depending on the service endpoints that you need. For more information, see FilterParameters for Predefined Service Endpoints.To retrieve a service endpoint on a particular vCenter Server instance, you must retrieve thenode ID of that instance and pass it to the function. For information about how to retrieve the IDof a vCenter Server instance, see Retrieve a vCenter Server ID by Using the Lookup Service.Python Example of Retrieving a Service Endpoint on a vCenterServer InstanceThis example provides a common pattern for filtering Lookup Service registration data. Thisexample is based on the code in the lookup service helper.py sample file.Note For a complete and up-to-date version of the sample code, see the vSphere AutomationSDK Python samples at GitHub.def lookup service infos(prod, svc type, proto, ep type, node id) :# 1 - Create a filter criterion for service info.filter service type \my ls ServiceType')filter service type.product prodfilter service type.type svc type# 2 - Create a filter criterion for endpoint info.filter endpoint type \my ls EndpointType')filter endpoint type.protocol protofilter endpoint type.type ep type# 3 - Create the registration filter object.filter criteria \my ls Filter')filter criteria.serviceType filter service typefilter criteria.endpointType filter endpoint typefilter criteria.nodeId node id# 4 - Retrieve specified service info with the List() method.service infos my ls stub.service.List(service registration,filter criteria)return service infosRetrieve a vCenter Server ID by Using the Lookup ServiceYou use the node ID of a vCenter Server instance to retrieve the endpoint URL of a service onthat vCenter Server instance. You specify the node ID in the service registration filter that youpass to the List() function on the Lookup Service.VMware, Inc.20

VMware vSphere Automation SDK for Python Programming GuideManaged services are registered with the instance name of the vCenter Server instance wherethey run. The instance name maps to a unique vCenter Server ID. The instance name of a vCenterServer system is specified during installation and might be an FQDN or an IP address.PrerequisitesnEstablish a connection with the Lookup Service.nRetrieve a service registration object.Procedure1List the vCenter Server instances.2Find the matching node name of the vCenter Server instance and save the ID.ResultsUse the node ID of the vCenter Server instance to filter subsequent endpoint requests. You canuse the node ID in a function that retrieves the endpoint URL of a service on a vCenter Serverinstance. For information about implementing such a function, see Retrieve Service Endpoints onvCenter Server Instances.Python Example of Retrieving a vCenter Server ID by Using theLookup ServiceThis example provides a common pattern for filtering Lookup Service registration data. Thisexample is based on the code in the lookup service helper.py sample file.Note For a complete and up-to-date version of the sample code, see the vSphere AutomationSDK Python samples at GitHub.def get mgmt node id(node instance name) :# 1 - List the vCenter Server instances.mgmt node infos lookup service infos(prod 'com.vmware.cis',svc type 'vcenterserver',proto 'vmomi', ep type 'com.vmware.vim',node id '*')# 2 - Find the matching node name and save the ID.for node in mgmt node infos :for attribute in node.serviceAttributes :if attribute.key 'com.vmware.vim.vcenter.instanceName' :if attribute.value node instance name :return node.nodeIdVMware, Inc.21

VMware vSphere Automation SDK for Python Programming GuideRetrieve a vSphere Automation Endpoint on a vCenterServer InstanceThrough the vSphere Automation Endpoint, you can access other vSphere Automation servicesthat run on vCenter Server, such as Content Library and Tagging. To use a vSphere Automationservice, you must retrieve the vSphere Automation Endpoint.PrerequisitesnEstablish a connection with the Lookup Service.nRetrieve a service registration object.nDetermine the node ID of the vCenter Server instance where the vSphere Automation serviceruns.nImplement a function that retrieves the endpoint URL of a service on a vCenter Serverinstance.Procedure1Invoke the function for retrieving the endpoint URL of a service on a vCenter Server instanceby passing filter strings that are specific to the vSphere Automation endpoint.2Save the URL from the resulting single-element list.Python Example of Retrieving

Python Example of Creating a Basic Virtual Machine 67 Configuring a Virtual Machine 68 Name and Placement 69 Boot Options 70 Operating System 71 CPU and Memory 72 Networks 74 Performing Virtual Machine Power Operations 76 Python Example of Powering On a Virtual Machine 77 VMware vSphere Automation SDK for Python Programming Guide VMware, Inc. 5