ServiceNow with Azure DevOps

ServiceNow with Azure DevOps brings integration of Azure Pipelines with ServiceNow Change Management to enhance collaboration between development and IT teams.

Image for post

By including change management in CI/CD pipelines, teams can reduce the risks associated with changes and follow service management methodologies such as ITIL, while gaining all DevOps benefits from Azure Pipelines.

ServiceNow is a software-as-a-service (SaaS) provider of IT service management (ITSM) software, including change management. Specific change management subprocesses include change risk assessment, change scheduling, change approvals and oversight. With change management, your organization can reduce the risks associated with change, while speeding up the deployments with Azure Pipelines.

Image for post

Configure the ServiceNow instance :

  1. Install the Azure Pipelines application on your ServiceNow instance, we require credentials to complete the installation.
  2. Create a new user in ServiceNow and grant themx_mioms_azpipeline.pipelinesExecution role.
Image for post

Set up the Azure DevOps organization

  1. Install the ServiceNow Change Management extension on your Azure DevOps organization.
  2. This extension enables integration of ServiceNow Change Management with Azure Pipelines.Follow the instructions to “Get it Free”
Image for post

3. Create a new ServiceNow service connection in the Azure DevOps project used for managing your releases. Enter the user name and password for the service account created in ServiceNow.

Image for post
Image for post

Basic authentication

This needs a service account (user) to be created in ServiceNow. Provide username and password for the service account configured for basic auth.

Use Verify connection before using it in the gate or task.

OAuth2 authentication

In addition to granting role to a user in ServiceNow, Azure DevOps should be registered in ServiceNow as an OAuth app.

Register your OAuth configuration in Azure DevOps Services

  1. Sign into Azure DevOps Services.
  2. Add OAuth configuration from Organization settings>Oauth configurations
Image for post

Create an OAuth configuration using the OAuth application details obtained while registering Azure DevOps as an OAuth app in ServiceNow.

Image for post

Create OAuth service connection for ServiceNow

Use the OAuth configuration created above and provide the ServiceNow instance Url.

Configure a release pipeline

  1. In your release pipeline, add a pre-deployment gate for ServiceNow Change Management.
Image for post

2. Select the ServiceNow service connection you created earlier and enter the values for the properties of the change request.

Image for post

Gate can be configured to create a new change request for every run of the pipeline or use an existing request. Inputs provided in the gate are used as properties for the new change request in ServiceNow, if applicable.

Inputs for Gate:

Additional properties can be set in the created change request using the following inputs. Note: Available inputs change based on the selected change type.

Gate Success Criteria :

Gate Output Variables :
ServiceNow gate produces output variables. You must specify reference name to be able to use these output variables in the deployment workflow. Gate variables can be accessed by using "PREDEPLOYGATE" as a prefix in an agentless job in the workflow. For eg. when reference name is set to ‘gate1’, then the change number can be obtained as $(PREDEPLOYGATE.gate1.CHANGE_REQUEST_NUMBER).

Add a task to update the change request

Image for post

Inputs for Update change request task:

The update task would fail if none of the fields in the change request are updated during the execution of the task. ServiceNow ignores invalid fields and values passed to the task.

Image for post

Running a Azure release

  1. Create a new release from the configured release pipeline in Azure DevOps
  2. After completing the Dev stage, the pipeline creates a new change request in ServiceNow for the release and waits for it to reach the desired state.
Image for post

3. The values defined as gate parameters will be used. You can get the change number that was created from the logs.

Image for post

4. The ServiceNow change owner will see the release in the queue as a new change.

Image for post

5. The release that caused the change to be requested can be tracked from the Azure DevOps Pipeline metadata section of the change.

Image for post

6. The change goes through its normal life cycle: Approval, Scheduled, and more until it is ready for implementation.

7. When the change is ready for implementation (it is in the Implement state), the release in Azure DevOps proceeds. The gates status will be as shown here:

Image for post

After the deployment, the change request is closed automatically.

VILT & Self-Paced

AZ-204 Developing Solutions for Microsoft Azure

This self-paced course will help you prepare for the Azure Developer certification exam AZ-204: Developing Solutions for Microsoft Azure.


AZ-900: Microsoft Azure Fundamentals Tutorial

AZ-900: Microsoft Azure Fundamentals Tutorial provides foundational level knowledge on cloud concepts; core Azure services; security, privacy, compliance, and trust; and Azure pricing and support.


AZ-400 Designing and Implementing Microsoft DevOps Solutions

This self-paced course will help you prepare for the Azure DevOps certification exam AZ-400: Designing and Implementing Microsoft DevOps Solutions.