Aria Automation offers five runtime environments: JavaScript, Node.js, PowerCLI (PowerShell), PowerShell and Python. VMware PowerCLI is a command-line and scripting tool built on PowerShell, to manage and automate VMware infrastructure. For similar purposes VMware also offers pyVmomi, which is based on Python. This now raises the question whether it is possible to build an equivalent runtime environment with Python and pyVmomi. This blog describes how this can be achieved.

Building a Python Runtime Environment with pyVmomi

First we need to prepare pyVmomi for the use in Aria Automation.
To get the source code move your mouse pointer into the source code section and press on the upper right side the copy button. This copies the source code to the clipboard and now it can be pasted and saved into your target.
@runtime python:3.10
@memoryLimit 512000000
@timeout 600
@param {SecureString} in_password
@outputType Properties

import json
from pyVim.connect import *
import ssl

def handler(context, inputs):
  jsonOut = json.dumps(inputs, separators = (",", ":"))
  # print("Inputs were {0}".format(jsonOut))

  context = ssl._create_unverified_context()


    # The information on the connection is exemplary from the HOL
    serviceInstance = Connect(
      host = "",
      port = 443,
      user = "",
      # pwd = "VMware1!",
      pwd = inputs["in_password"],
      sslContext = context

    serviceInstanceContent = serviceInstance.RetrieveContent()

    aboutInfo = serviceInstanceContent.about
    print("Fullname:", aboutInfo.fullName)
    print("Vendor:", aboutInfo.vendor)
    print("Version:", aboutInfo.version)
    print("OS:", aboutInfo.osType)
    print("API Type:", aboutInfo.apiType)
    print("API Version:", aboutInfo.apiVersion)
    print("Unique Id:", aboutInfo.instanceUuid)
    print("License Product Name", aboutInfo.licenseProductName)
    print("License Product Version:", aboutInfo.licenseProductVersion)


  except Exception as ex:

  outputs = {
    "status": "done"

  return outputs

Now we can import this ZIP package into Aria Automation. Switch to runtime environment Python, choose the type Zip and import it. As return type choose Properties and add to the inputs the argument in_password with the SecureString type. Now it is possible to execute the action, after the password has been entered.

vmware aria automation with pyvmomi in python runtime environment
VMware Aria Automation with pyVmomi in Python runtime environment


As we can see, it is possible with just a few steps to build an environment to manage and automate VMware infrastructure on Python. pyVmomi, which comes from VMware itself, is designed for this. Combining this with Aria Automation offers us the possibility to work with pyVmomi, similar to PowerCLI, in this context.

This site is part of