Home
Blog
ServiceNow Integration with env zero

ServiceNow Integration with env zero

Andrew Way
Sales Engineering
with special guest
Mitchell
Hashimoto
Mitchell Hashimoto headshot

Many Enterprise customers have a workflow approval process already in place with tools like ServiceNow.Ā  Today, I wanted to show you how you can quickly take advantage of your existing ITSM tooling, and business processes - while enabling self-service infrastructure provisioning with env0.Ā 

Pre-Requisites

  1. ServiceNow - Outbound Rest Integration
  2. env zero Organization
  3. env zero API Key

Overview

The purpose of this guide is to show the possibilities of integrating ServiceNow with env zero to create an env zero Environment through the ServiceNow Catalog.Ā 

Outbound Rest Integration

First, we are going to create a new REST Message Record.

We are going to take advantage of ServiceNow’s outbound REST integration and env0’s API.

In ServiceNow, search for ā€œREST Messageā€ and create a ā€œNewā€ record.

Name: env0

Endpoint: https://api.envzero.com

Authentication type: ā€œBasicā€Ā 

and add a new Basic auth profile.Ā  You can retrieve the API key from env zero (https://app.envzero.com/organizations/ under the ā€œAPI KEYSā€ tab)

Hit ā€œsubmitā€

Next, we are going to create a new HTTP Method to create the desired environment.

Click on the ā€œenv0ā€ Rest Message you just created and Create a ā€œNewā€ HTTP Methods

Name: Create Environment

HTTP method: POST

Endoint: https://api.envzero.com/environments

Authentication: Inherit from parent

HTTP Request:

((log_record.log_record -> ā€˜attributes’::text) @> ā€˜{  "name": "${name}",  "projectId": "${ENV0_PROJECT_ID}",  "requiresApproval": true,  "ttl": {    "type": "INFINITE",    "value": "string"  },  "configurationChanges": [{    "name": "refresh_date",    "value": "${refresh_date}",    "scope": "DEPLOYMENT",    "type": 1,    "description": "refresh date is used to reset the random var",    "isSensitive": false  },{    "name": "storage_size",    "value": "${storage_size}",    "scope": "ENVIRONMENT",    "type": 1,    "description": "adding additional variable through payload",    "isSensitive": false  }],  "deployRequest": {    "blueprintId": "${ENV0_TEMPLATE_ID}",     "ttl": {      "type": "INFINITE"    },    "userRequiresApproval": true  }}
  • callout: You will need to modify the ā€œconfigurationChangesā€ based on your env zero environment variables required.
  • callout: I’m using several variables that will get replaced during the execution of the script.

Lastly, we are going to copy the Preview Script Usage.

Click on the Preview Script Usage, and make a copy of the script, we will use it later.

  • Note: if you want to test the API key you can create another HTTP Method that queries the organization: https://docs.envzero.com/reference/organization-find-organization-by-id

Create a Business Rule.

I’m going to assume you know how to create a ServiceNow catalog item, and that you’ve created a catalog item for the env zero environment you want to create.
So the most important step is to trigger the env zero deployment when a new catalog item is being requested.

For that we will use ServiceNow Business Rule to detect when a catalog item has been Requested.Ā 

Advanced:

We will paste in the script we copied from above.


Voila!

Now request a new S3 Bucket from the Service Catalog, and watch the deployment trigger in env0.Ā 

Next Steps:

  1. Send Plan details back to ServiceNow for review
  2. Request Approval Process in ServiceNow
  3. Send Approval to env zero to deploy
  4. Update ServiceNow Request with Status provisioned
Schedule a technical demo
See env zero in action
Schedule demo

Related Content

All articles