Why env0
Solutions
Infrastructure as Code (IaC) Automation Teams and GovernanceManaged Self-Service env0 for the Enterprise
DocumentationPricing
Resources
Case StudiesIn the NewsVideosWebinars
Blog
Login
Get a Demo
FREE TRIALContact us
Feb 3, 2023

ServiceNow Integration with env0

Andrew Way
Director of Sales Engineering

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. env0 Organization
  3. env0 API Key

Overview

The purpose of this guide is to show the possibilities of integrating ServiceNow with env0 to create an env0 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.env0.com

Authentication type: “Basic” 

and add a new Basic auth profile.  You can retrieve the API key from env0 (https://app.env0.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.env0.com/environments

Authentication: Inherit from parent

HTTP Request:

{
 "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 env0 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.env0.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 env0 environment you want to create.
So the most important step is to trigger the env0 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 env0 to deploy
  4. Update ServiceNow Request with Status provisioned
Interested in learning more about env0?
Request a Demo
SHARE
You may also like
Day 0 Environment Creation
Share outputs between IaC stacks
Chris' Corner - March 2023
Go back to blog
CNCF Member Badge
Company
About UsIn the NewsPress ReleasesCase StudiesAdditional ResourcesCareers
Developer and DevOps
APITerraform ProviderTerratag Open Source
Terraform Cloud AlternativeDIY AlternativeAtlantis Alternative
FREE TRIAL
Follow Us
Terms of ServicePrivacy PolicySecuritySystem Status
© Copyright env0 2023
This website uses cookies. We use cookies to ensure that we give you the best experience on our website. Learn More
PreferencesDenyAccept
Privacy Preference Center
When you visit websites, they may store or retrieve data in your browser. This storage is often necessary for the basic functionality of the website. The storage may be used for marketing, analytics, and personalization of the site, such as storing your preferences. Privacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website.
Reject all cookiesAllow all cookies
Manage Consent Preferences by Category
Essential
Always Active
These items are required to enable basic website functionality.
Marketing
These items are used to deliver advertising that is more relevant to you and your interests. They may also be used to limit the number of times you see an advertisement and measure the effectiveness of advertising campaigns. Advertising networks usually place them with the website operator’s permission.
Personalization
These items allow the website to remember choices you make (such as your user name, language, or the region you are in) and provide enhanced, more personal features. For example, a website may provide you with local weather reports or traffic news by storing data about your current location.
Analytics
These items help the website operator understand how its website performs, how visitors interact with the site, and whether there may be technical issues. This storage type usually doesn’t collect information that identifies a visitor.
Confirm my preferences and close