Getting started with using functions

The steps below describe a generalized deployment step of a function on the VMware Event Broker Appliance configured with OpenFaaS as the Event Processor. For customers looking to get started quickly, please look at deploying from our growing list of Prebuilt Functions. The functions are organized by the language that they are written in and have well-documented files with detailed deployment steps.

Function deployment steps

For this walk-through, the host-maint-alarms function from the example folder is used.


Before proceeding to deploy a function, you must have VMware Event Broker Appliance deployed and be able to login to OpenFaaS.

#Use your appliance URL and OpenFaaS password 
export OPENFAAS_URL=''
faas-cli login -p YourPassword

NOTE: You may have to use the --tls-no-verify flag as the appliance utilizes self-signed certificates by default. You can update the certificates following this guide here

An alternative way to log in if you don’t want your password showing up in command history is to put the password in a text file and use this command:

cat password.txt | faas-cli login --password-stdin

Step 1 - Clone repo

git clone
cd vcenter-event-broker-appliance/examples/powercli/hostmaint-alarms
git checkout master

Step 2 - Edit the configuration files

  • Edit stack.yml to update gateway: with the specific appliance URL in your environment. Notice event(s) next to topics: - all available events can be reviewed in the vCenter Event Mapping document.
version: 1.0
  name: openfaas
    lang: powercli
    handler: ./handler
    image: vmware/veba-powercli-esx-maintenance:latest
      write_debug: true
      read_debug: true
      function_debug: false
      - vc-hostmaint-config
      topic: EnteredMaintenanceModeEvent,ExitMaintenanceModeEvent
  • Most functions also have a secrets configuration file that you must edit to match your environment. For the hostmaint-alarms function, the file is named vc-hostmaint-config.json
      "VC" : "",
      "VC_USERNAME" : "veba@vsphere.local",
      "VC_PASSWORD" : "FillMeIn"

    Then create the secret in OpenFaaS with this command:

    faas-cli secret create vc-hostmaint-config --from-file=vc-hostmaint-config.json 

Step 3 - Deploy function to VMware Event Broker Appliance

faas-cli deploy -f stack.yml

Step 4 - Test and Invoke your functions

  • Your function is now deployed to OpenFaaS and available for VMware Event Router to invoke when it sees a matching event
  • You can also test or invoke your functions using the http endpoint for the function that OpenFaaS makes available. Pass the expected CloudEvents to the function as the http request parameter

What's next?

Extend your vCenter quickly with our pre-built functions

  • See our complete list of prebuilt functions - here

  • Learn how to write your own function - here.