Azure DevOps Integration

Integrate ServiceNow with Azure DevOps Pipelines for automated change management and deployment tracking

Overview

This guide demonstrates how to integrate ServiceNow change management with Azure DevOps Pipelines. ServiceNow provides an official Azure DevOps extension that simplifies integration, along with REST API options for custom workflows.

Integration Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚       Azure DevOps Pipeline                β”‚
β”‚                                            β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚  β”‚Build │─→│ Test │─→│ Create SNOW   β”‚   β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”˜  β”‚ Change Requestβ”‚   β”‚
β”‚                       β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                               β”‚           β”‚
β”‚                               β–Ό           β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚                    β”‚ Approval Gate      β”‚ β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                               β”‚           β”‚
β”‚                               β–Ό           β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚                    β”‚ Deploy to Prod     β”‚ β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                               β”‚           β”‚
β”‚                               β–Ό           β”‚
β”‚                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚                    β”‚ Close Change       β”‚ β”‚
β”‚                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                        β”‚
                        β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚   ServiceNow     β”‚
              β”‚  Change Request  β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Method 1: Official ServiceNow Extension

Installation

  1. Install Extension from Marketplace:

    • Navigate to: https://marketplace.visualstudio.com/items?itemName=ServiceNow.vss-services-servicenow-cicd

    • Click "Get it free"

    • Select your Azure DevOps organization

    • Install the extension

  2. Configure Service Connection:

    • Go to Project Settings > Service Connections

    • Click New service connection

    • Select ServiceNow

    • Fill in:

      • ServiceNow URL: https://your-instance.service-now.com

      • Username: ServiceNow service account

      • Password: Service account password

      • Service connection name: ServiceNow-Prod

Using ServiceNow Tasks

Method 2: REST API Integration

Using PowerShell

Using Bash/cURL

Method 3: Azure DevOps Extensions with Variable Groups

Configure Variable Group

  1. Create Variable Group (Pipelines > Library):

    • Name: ServiceNow-Config

    • Variables:

      • ServiceNowInstance: your-instance

      • ServiceNowUsername: service-account

      • ServiceNowPassword: β€’β€’β€’β€’β€’β€’β€’ (mark as secret)

      • AssignmentGroup: DevOps Team

      • CMDB_CI: prod-k8s-cluster

  2. Link to Pipeline:

Standard Changes for Faster Deployments

Multi-Stage Deployments

Integrating with Azure DevOps Environments

Error Handling and Rollback

Best Practices

Use Service Principal Authentication

Instead of username/password, use Service Principal:

Cache ServiceNow Metadata

Parallel Deployments with Change Tracking

Troubleshooting

Enable Debug Logging

Common Issues

Issue
Solution

Service connection fails

Verify URL format: https://instance.service-now.com

Extension tasks not found

Install ServiceNow extension in Azure DevOps organization

Variable not available

Use stageDependencies syntax for cross-stage variables

PowerShell authentication fails

Check Base64 encoding of credentials

Next Steps

Additional Resources

Last updated