Integrations

ServiceNow Microsoft Azure Integration Guide

advancedOAuth 2.0 Client Credentials with Azure Active Directory service principalMicrosoft Azure

The ServiceNow Microsoft Azure integration enables organizations to manage Azure cloud resources directly from their ServiceNow instance, synchronizing virtual machines, storage accounts, and other Azure services into the CMDB while automating incident creation from Azure Monitor alerts. This integration is essential for enterprises running hybrid cloud infrastructures who need unified visibility and automated workflows across their Azure environments and ServiceNow ITSM processes. The integration supports bidirectional data flows through the official Azure IntegrationHub spoke, with outbound calls to Azure Resource Manager APIs for resource discovery and inbound webhook processing for Azure Monitor alert automation. Primary triggers include scheduled CMDB synchronization jobs and real-time webhook events, managed through the IntegrationHub and Event Management modules in ServiceNow.

Prerequisites

  • ServiceNow Quebec or later with IntegrationHub Professional license
  • Microsoft Azure subscription with Contributor or Reader role access
  • Azure Active Directory application registration with appropriate API permissions
  • ServiceNow System Administrator role for spoke configuration
  • Event Management plugin activated for Azure Monitor integration
  • MID Server with internet connectivity for outbound Azure API calls
  • Azure Monitor configured with action groups for webhook notifications

Architecture Overview

The ServiceNow Azure integration leverages the official Microsoft Azure IntegrationHub spoke, which provides pre-built actions for Azure Resource Manager API interactions including VM management, resource discovery, and CMDB synchronization. Authentication is established using OAuth 2.0 Client Credentials flow with Azure service principals, where credentials are securely stored in ServiceNow Connection & Credential Alias records and referenced by the spoke actions. Data flows bidirectionally with outbound calls through the MID Server to Azure APIs for resource discovery and management, while inbound Azure Monitor alerts are processed via ServiceNow's REST API endpoints to create incidents automatically. A MID Server is required for outbound connections to ensure secure communication with Azure APIs and to handle potential network restrictions in enterprise environments. Azure Resource Manager APIs have rate limits of 12,000 read requests and 1,200 write requests per hour per subscription, which must be considered when scheduling bulk CMDB synchronization jobs.

Sourdough
Chrome Extension

Sourdough: ServiceNow Monitoring and Analytics

A Chrome extension for ServiceNow Admins and Developers with essential tools, analytics, graphs and monitoring features.

Instance HealthGraphs & ChartsAPI HealthDeveloper ToolsQuick SearchInstance Switcher
Add to Chrome

Free to install. Pro $5/month after a 14-day no-card trial.
Pro requires the ServiceNow admin role. Upgrade inside the extension.

Overview
Tasks
CMDB
API
Metrics
Monitor
Internals
Instance:sourdoughdev·Version:Yokohama
Instance StateONLINE
System StatusFully Operational
Session Timeout90 minutes
Logged-In Sessions2 (20 active)
Build Nameyokohama-12-18-2024_p1
IP Address10.159.128.43
Instance HealthHealth Score: 90%
🔥 5dSourdough (Chrome Plugin)Dark Mode

Implementation Steps

1

Create Azure Active Directory application and service principal

Navigate to the Azure portal and access Azure Active Directory > App registrations, then click 'New registration' to create a new application. Provide a meaningful name like 'ServiceNow-Integration' and select 'Accounts in this organizational directory only' for supported account types, leaving the redirect URI blank since this will use client credentials flow. After creation, note the Application (client) ID and Directory (tenant) ID from the Overview page, then navigate to 'Certificates & secrets' and create a new client secret with appropriate expiration date. Copy the secret value immediately as it cannot be retrieved later, and assign the service principal appropriate RBAC roles at the subscription or resource group level (typically Reader for CMDB sync and Contributor for management actions).

2

Configure Azure API permissions and consent

In the Azure AD application, navigate to 'API permissions' and click 'Add a permission' to configure required Microsoft Graph and Azure Service Management permissions. Add Microsoft Graph permissions including 'User.Read' and 'Directory.Read.All' for user context, plus Azure Service Management 'user_impersonation' permission for resource access. Click 'Grant admin consent' to provide tenant-wide consent for these permissions, ensuring the status shows green checkmarks for all permissions. Verify that the service principal appears under 'Enterprise applications' in Azure AD and has the correct role assignments at the subscription level through Access control (IAM) blade.

3

Install and configure the Microsoft Azure IntegrationHub spoke

Navigate to System Applications > All Available Applications > All and search for 'Microsoft Azure' spoke, then request and install the latest version from the ServiceNow Store. After installation, go to IntegrationHub > Connections & Credentials > Credential and create a new OAuth Entity credential with credential name 'Azure_OAuth_Cred'. Fill in the OAuth Entity Profile with Authorization URL 'https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/authorize', Token URL 'https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token', replacing {tenant-id} with your actual tenant ID from step 1. Set the Client ID to your Azure application client ID, Client Secret to the secret value created earlier, and Scope to 'https://management.azure.com/.default'.

4

Create Azure connection alias and test connectivity

Navigate to IntegrationHub > Connections & Credentials > Connection Alias and create a new alias named 'Azure_Connection' with Connection URL set to 'https://management.azure.com'. Select the OAuth Entity credential created in the previous step and choose an appropriate MID Server for execution. Click 'Test Connection' to verify OAuth token acquisition and basic connectivity to Azure Resource Manager APIs. If the test fails, check the MID Server logs under System Logs > MID Server > [MID Server name] > Logs for detailed error messages, and verify that the service principal credentials and permissions are correctly configured in Azure.

5

Configure CMDB identification and mapping rules

Navigate to Configuration > CI Class Manager and verify that Azure-related CI classes like 'Computer' and 'Virtual Machine' have appropriate identification rules enabled. Go to Cloud Management > Cloud Providers and create a new provider record for Azure, specifying the connection alias created earlier and enabling CMDB integration options. Configure the CI mapping under Cloud Management > CI Mapping to define how Azure resource properties map to ServiceNow CMDB attributes, ensuring critical fields like name, IP address, status, and resource group are properly mapped. Set up discovery schedules under Discovery > Schedules to run Azure resource discovery at appropriate intervals, typically every 4-6 hours to balance freshness with API rate limits.

ServiceNow Script
// Example identification rule for Azure VMs
var azureVm = new GlideRecord('cmdb_ci_computer');
azureVm.addQuery('install_status', '!=', '7'); // Not retired
azureVm.addQuery('name', 'CONTAINS', 'azure');
azureVm.query();
while (azureVm.next()) {
    // Update Azure-specific attributes
    azureVm.cloud_provider = 'Microsoft Azure';
    azureVm.update();
}
6

Set up Azure Monitor webhook integration for incident creation

Navigate to System Web Services > Scripted REST APIs and create a new API called 'Azure_Monitor_Webhook' with base path '/api/azure/monitor'. Create a POST resource with relative path '/alert' to receive Azure Monitor webhook payloads. In the resource script, parse the incoming JSON payload to extract alert details like severity, resource information, and description, then create incident records automatically based on alert criteria. Configure the webhook URL in Azure Monitor action groups using the format 'https://[instance].service-now.com/api/azure/monitor/alert' and set up authentication using basic auth with a dedicated integration user account.

ServiceNow Script
(function process(request, response) {
    var payload = request.body.dataString;
    var alertData = JSON.parse(payload);
    
    var incident = new GlideRecord('incident');
    incident.initialize();
    incident.short_description = 'Azure Alert: ' + alertData.data.essentials.alertRule;
    incident.description = alertData.data.essentials.description;
    incident.priority = alertData.data.essentials.severity == 'Sev0' ? '1' : '3';
    incident.category = 'Infrastructure';
    incident.subcategory = 'Cloud Services';
    incident.assignment_group = 'Cloud Operations';
    incident.caller_id = 'azure.monitor';
    var incidentSysId = incident.insert();
    
    response.setStatus(200);
    response.setBody({result: 'Incident created: ' + incidentSysId});
})(request, response);
7

Create Azure resource management workflows

Navigate to Workflow > Workflow Editor and create workflows for common Azure operations like VM start/stop, resource provisioning, and scaling actions using the Azure spoke actions. Configure workflows to use the Azure connection alias and include proper error handling for API failures and rate limiting scenarios. Add Azure spoke actions like 'Start Virtual Machine', 'Stop Virtual Machine', and 'Get Resource Group Details' to workflow activities, mapping input parameters to workflow variables. Test workflows in the workflow editor using actual Azure resource IDs to ensure proper authentication and API interaction before deploying to production use cases.

ServiceNow Script
// Example workflow script for VM power management
var azureAction = new sn_hub_ctf.IntegrationHubActionRunner();
azureAction.setActionName('Microsoft Azure', 'Start Virtual Machine');
azureAction.setParameter('connection_alias', 'Azure_Connection');
azureAction.setParameter('subscription_id', workflow.variables.subscription_id);
azureAction.setParameter('resource_group', workflow.variables.resource_group);
azureAction.setParameter('vm_name', workflow.variables.vm_name);
var result = azureAction.execute();
if (result.getStatusCode() == 200) {
    workflow.variables.operation_status = 'Success';
} else {
    workflow.variables.operation_status = 'Failed: ' + result.getErrorMessage();
}
8

Test end-to-end integration and implement monitoring

Execute a complete test cycle by triggering Azure resource discovery to populate the CMDB, then generate a test alert in Azure Monitor to verify incident creation through the webhook integration. Navigate to Cloud Management > Discovery Status to monitor discovery job execution and verify that Azure resources are properly imported into the Configuration Management Database. Set up ServiceNow Event Management monitoring for the Azure integration by creating event rules that track authentication failures, API rate limit exceeded conditions, and webhook processing errors. Create dashboard components under Performance Analytics to track integration health metrics like successful API calls, failed authentications, and incident creation rates from Azure alerts.

ServiceNow Script
// Health check script for Azure integration
var healthCheck = new GlideRecord('sys_hub_action_status');
healthCheck.addQuery('action_name', 'CONTAINS', 'Microsoft Azure');
healthCheck.addQuery('sys_created_on', '>', gs.hoursAgoStart(1));
healthCheck.addQuery('status', 'error');
healthCheck.query();
if (healthCheck.getRowCount() > 5) {
    gs.eventQueue('azure.integration.health.warning', null, 
        'High error rate detected in Azure integration: ' + healthCheck.getRowCount() + ' errors in last hour');
}

Common Use Cases

Automated VM lifecycle management through ServiceNow catalog

Service catalog items trigger Azure spoke actions to provision, start, stop, or deallocate virtual machines based on user requests. Workflows integrate with ServiceNow's approval engine and CMDB updates to track VM state changes throughout the lifecycle. This use case eliminates manual Azure portal access for routine VM operations while maintaining proper governance and audit trails in ServiceNow. The integration automatically updates CMDB records to reflect current VM power states and configuration changes made through ServiceNow workflows.

Azure Monitor alert-driven incident management

Azure Monitor alerts for resource failures, performance thresholds, or security events automatically create ServiceNow incidents through webhook integration. The system maps Azure alert severity levels to ServiceNow priority values and assigns incidents to appropriate teams based on alert categories and affected resources. Business rules can automatically escalate critical infrastructure alerts or create parent-child incident relationships for cascade failures. This integration ensures no Azure alerts are missed while providing centralized incident tracking and resolution workflows in ServiceNow.

Comprehensive CMDB synchronization for hybrid cloud visibility

Scheduled discovery jobs synchronize Azure resources including virtual machines, storage accounts, network security groups, and databases into ServiceNow's CMDB for complete infrastructure visibility. The integration maintains relationships between Azure resources and their dependencies, enabling impact analysis and change management processes. Discovery jobs handle large Azure environments by batching API calls and respecting rate limits while ensuring data consistency. This provides a single source of truth for both on-premises and Azure cloud infrastructure within ServiceNow.

Automated scaling and cost optimization workflows

ServiceNow workflows monitor Azure resource utilization through integration APIs and automatically trigger scaling actions based on predefined thresholds or schedules. Change requests can be automatically generated for significant scaling operations, ensuring proper approval and documentation of infrastructure changes. The integration enables cost optimization by automatically deallocating unused VMs during off-hours or scaling down development environments according to business schedules. Integration with ServiceNow's change management ensures all scaling actions are tracked and can be rolled back if issues occur.

Security compliance monitoring and remediation

Azure Security Center findings and compliance violations trigger automated ServiceNow security incident creation with detailed remediation guidance. Workflows can automatically assign security incidents to appropriate teams based on resource ownership data synchronized from Azure tags and resource groups. The integration enables tracking of security remediation progress and can trigger follow-up actions if violations aren't addressed within SLA timeframes. This ensures security compliance requirements are managed through ServiceNow's proven ITSM processes while maintaining visibility into Azure security posture.

Troubleshooting

OAuth token acquisition fails with 'AADSTS70011: Invalid scope' error

This error indicates incorrect scope configuration in the OAuth credential. Navigate to the Connection & Credential alias and verify the scope is set to 'https://management.azure.com/.default' exactly as shown, not 'https://graph.microsoft.com/.default'. Check that the Azure AD application has 'Azure Service Management API' permissions granted with admin consent. Review the MID Server logs under System Logs > MID Server for detailed OAuth flow errors and ensure the tenant ID in the token URL matches your Azure AD tenant exactly.

Azure resource discovery completes but no CIs are created in CMDB

Verify that CI identification rules are properly configured for Azure resources under Configuration > CI Class Manager, ensuring that identification criteria match the data format returned by Azure APIs. Check the discovery log under Discovery > Discovery Log for specific errors during CI creation and validation. Confirm that the discovery schedule is configured to use the correct cloud provider record and connection alias. Review field mappings under Cloud Management > CI Mapping to ensure required fields like name and IP address have valid mappings from Azure resource properties.

Azure Monitor webhook returns 200 OK but incidents are not created

Examine the Scripted REST API execution logs under System Logs > System Log > All to identify JavaScript errors in the webhook processing script. Verify that the webhook payload structure matches your parsing logic by logging the raw request body and comparing it to Azure Monitor documentation. Check that the integration user account used for webhook authentication has the incident_admin role and necessary table access rights. Ensure that mandatory incident fields are properly populated in the script and that any referenced users or groups exist in the ServiceNow instance.

MID Server shows 'Connection timeout' errors for Azure API calls

Check MID Server connectivity to Azure endpoints by testing outbound HTTPS connections to management.azure.com and login.microsoftonline.com from the MID Server host. Review proxy settings in the MID Server config.xml file if your environment requires proxy access for external connections. Verify that corporate firewalls allow outbound connections to Microsoft Azure IP ranges and that DNS resolution works properly for Azure endpoints. Increase the connection timeout values in the MID Server parameters if network latency to Azure is consistently high due to geographic distance.

Azure spoke actions fail with '403 Forbidden' despite correct service principal setup

Verify that the service principal has been assigned appropriate RBAC roles at the correct scope level in Azure, checking both subscription-level and resource group-level permissions through the Azure portal's Access control (IAM) blade. Ensure that the resource being accessed is within the scope of the service principal's role assignments and that the subscription ID specified in spoke actions matches the subscription where permissions were granted. Check for Azure policy restrictions that might block API access even with proper RBAC permissions, and verify that the service principal hasn't been disabled or had its credentials rotated in Azure AD.

High volume Azure Monitor alerts cause webhook processing delays and missed incidents

Implement asynchronous processing by modifying the webhook script to queue alert data into a custom table and process incidents through scheduled jobs rather than synchronous creation. Configure Azure Monitor action groups to use different webhook endpoints for different alert severities, allowing critical alerts to be processed immediately while batching lower-priority alerts. Review and optimize the incident creation script to minimize database operations and avoid complex business rule triggers during webhook processing. Consider implementing rate limiting in the webhook script to prevent system overload during Azure outage scenarios that generate alert storms.

Pro Tips

  • Implement credential rotation automation by creating a scheduled script that monitors Azure service principal certificate expiration dates and generates ServiceNow tasks for renewal 30 days before expiration. This prevents integration outages due to expired credentials and provides audit trails for security compliance.
  • Use Azure resource tags strategically to drive ServiceNow automation by syncing tag values into CMDB CI attributes, enabling automatic assignment group determination and cost center allocation based on Azure tagging standards. Configure discovery schedules to prioritize critical resource types during business hours while running comprehensive scans during maintenance windows.
  • Optimize Azure API rate limit utilization by implementing intelligent batching in custom scripts that group multiple resource operations into single API calls where possible. Monitor rate limit headers in API responses and implement exponential backoff retry logic to handle temporary rate limiting gracefully without failing entire workflows.
  • Enhance security by implementing Azure Managed Identity authentication where possible for MID Servers running on Azure VMs, eliminating the need to store long-lived secrets in ServiceNow credential records. Use Azure Key Vault integration to dynamically retrieve credentials and implement automatic rotation workflows.
  • Create comprehensive integration dashboards using Performance Analytics to track key metrics like API call success rates, CMDB synchronization lag, incident creation velocity from Azure alerts, and cost optimization workflow effectiveness. Set up automated anomaly detection to alert on unusual integration patterns that might indicate configuration issues or Azure service problems.
  • Implement disaster recovery procedures by maintaining backup Connection & Credential aliases pointing to secondary Azure service principals in different regions, enabling quick failover if primary Azure AD tenant access is compromised. Document emergency procedures for manual Azure resource management when ServiceNow integration is unavailable.

Known Limitations

  • Azure Resource Manager APIs enforce rate limits of 12,000 read operations and 1,200 write operations per hour per subscription, which can constrain large-scale CMDB synchronization and bulk resource management operations. Organizations with multiple subscriptions need separate connection aliases and careful orchestration to avoid cross-subscription rate limit conflicts.
  • The Azure spoke requires IntegrationHub Professional licensing, which adds significant cost for organizations only needing basic Azure integration capabilities. Some advanced Azure services like Azure DevOps, Azure AD B2C, and specialized AI services require custom REST message development since they're not covered by the standard spoke actions.
  • Real-time synchronization is not supported due to Azure's webhook limitations for resource changes, meaning CMDB data can lag actual Azure state by several hours depending on discovery schedule frequency. Complex Azure resource hierarchies and cross-resource relationships may not be fully represented in ServiceNow's CMDB model without extensive customization.
  • MID Server dependency introduces additional infrastructure requirements and potential single points of failure, particularly for organizations preferring cloud-native integration architectures. The integration cannot leverage some advanced ServiceNow cloud features when MID Server connectivity is required for Azure API access.
  • Azure Monitor webhook payloads vary significantly between different alert types and versions, requiring constant maintenance of parsing logic as Microsoft updates alert schemas. Integration testing becomes complex when dealing with Azure's multi-tenant environments and service principal permissions that behave differently across tenant configurations.

Frequently Asked Questions

Can I use Azure Managed Service Identity instead of service principal client secrets for authentication?

Azure Managed Service Identity is supported when your MID Server runs on Azure infrastructure, but requires custom configuration since the standard OAuth credential type expects client secrets. You'll need to modify the connection authentication to use Azure Instance Metadata Service endpoints for token acquisition. This approach enhances security by eliminating stored credentials but limits deployment flexibility since MID Servers must run on Azure VMs. The ServiceNow documentation provides guidance on implementing MSI authentication for Azure integrations in hybrid cloud scenarios.

How do I handle Azure subscriptions across multiple tenants in a single ServiceNow instance?

Multi-tenant Azure environments require separate Connection & Credential alias records for each tenant, each configured with tenant-specific service principals and OAuth endpoints. Create distinct cloud provider records under Cloud Management to maintain subscription isolation and prevent cross-tenant data mixing in the CMDB. Use naming conventions like 'Azure_Prod_Tenant' and 'Azure_Dev_Tenant' for connection aliases to clearly identify tenant scope. Discovery schedules and workflows must explicitly reference the appropriate connection alias for the target tenant to ensure proper authentication and data isolation.

What's the recommended approach for handling Azure resource dependencies in ServiceNow CMDB?

Azure resource dependencies should be modeled using ServiceNow's relationship framework under Configuration > Relationship Types, creating custom relationships like 'VM-to-VNet' and 'Storage-to-ResourceGroup' that reflect Azure's resource hierarchy. The discovery process can populate these relationships by parsing Azure resource properties that reference other resources by ID or name. Consider using the Dependency View functionality to visualize complex Azure architectures and enable impact analysis for change management processes. Custom business rules can maintain relationship consistency when Azure resources are modified or deleted through ServiceNow workflows.

How can I implement automated cost optimization workflows based on Azure usage patterns?

Cost optimization requires integrating Azure Cost Management APIs through custom REST messages since the standard Azure spoke doesn't include billing actions. Create scheduled jobs that retrieve Azure cost and usage data, then trigger workflows based on spending thresholds or resource utilization patterns. Implement workflows that automatically resize or deallocate underutilized resources during off-hours, with appropriate change management approval workflows for production environments. Use ServiceNow's Performance Analytics to track cost savings and create executive dashboards showing optimization ROI across your Azure infrastructure.

What happens to ServiceNow incidents when Azure alerts are resolved or suppressed?

Azure Monitor sends separate webhook notifications for alert resolution, which requires configuring your Scripted REST API to handle both 'Fired' and 'Resolved' alert states from the incoming payload. Implement logic to automatically resolve corresponding ServiceNow incidents when Azure alerts clear, matching incidents by alert ID or resource identifier stored in custom fields. Consider implementing correlation rules that prevent duplicate incident creation for rapidly firing and clearing alerts. The Event Management module provides additional correlation capabilities for managing alert storms and automatic incident resolution based on Azure alert lifecycle events.

Can I use the Azure integration to manage Azure DevOps work items and pipelines?

Azure DevOps requires separate integration implementation since it uses different APIs and authentication methods than Azure Resource Manager, and isn't covered by the standard Microsoft Azure spoke. You'll need to create custom REST messages targeting Azure DevOps Services APIs with Personal Access Token authentication stored in ServiceNow credential records. This enables scenarios like creating Azure DevOps work items from ServiceNow incidents or triggering deployment pipelines from ServiceNow change requests. Consider the Azure DevOps ServiceNow integration app available in the ServiceNow Store for pre-built Azure DevOps connectivity without custom development.

How do I troubleshoot slow performance in large-scale Azure CMDB synchronization jobs?

Performance optimization requires implementing parallel processing by configuring multiple discovery schedules with different resource type filters, distributing load across time windows to avoid API rate limits. Use the Discovery Status dashboard to identify bottlenecks and optimize CI identification rules to minimize database operations during discovery processing. Consider implementing incremental synchronization by tracking Azure resource modification timestamps and only processing changed resources rather than full discovery scans. Monitor MID Server performance metrics and consider deploying additional MID Servers with load balancing for high-volume Azure environments with thousands of resources requiring regular synchronization.

Test Your Knowledge

Quick 3-question quiz — see how your ServiceNow skills stack up.

Question 1 of 3Performance

A list view on a table with millions of records is slow. Best fix?

Select an answer to continue