v2026.1 Open Portal ↗
On this page

Microsoft Azure Integration

Prerequisites

RequirementDetails
Azure subscriptionContributor or Reader role on target subscriptions
Azure ADApplication registration permissions
Tenant IDdf4d171f-6cca-4c87-84cd-f299e4fca3a9 (StackFlow default) or your org tenant
StackFlow rolesuper_admin or cloud_admin

Step 1: Create Service Principal

# Create a service principal with Reader role on your subscription
az ad sp create-for-rbac   --name "StackFlow-CloudIntegration"   --role Reader   --scopes /subscriptions/YOUR_SUBSCRIPTION_ID   --sdk-auth

# Output includes:
# {
#   "clientId": "...",
#   "clientSecret": "...",
#   "subscriptionId": "...",
#   "tenantId": "df4d171f-6cca-4c87-84cd-f299e4fca3a9"
# }

# For Azure Monitor alert webhooks, also grant Monitoring Reader:
az role assignment create   --assignee SERVICE_PRINCIPAL_OBJECT_ID   --role "Monitoring Reader"   --scope /subscriptions/YOUR_SUBSCRIPTION_ID
Service Principal Secret Rotation: Azure service principal client secrets expire (default 1 year). StackFlow stores them in Secrets Manager and the StackFlowGenericSecretRotation Lambda handles rotation. Configure a reminder 30 days before expiry.

Step 2: Configure Azure Monitor Alerts

  1. In Azure Portal, go to Monitor → Alerts → Action Groups → Create
  2. Create an action group named StackFlow Alerts
  3. Add an action of type Webhook with URL: https://your-instance.stackflow-tech.com/prod/api/webhooks/inbound/azure-monitor
  4. Enable Use common alert schema
  5. Assign this action group to your Azure Monitor alert rules

Step 3: Enable Entra ID User Sync

StackFlow can sync users and groups from Microsoft Entra ID (formerly Azure AD) using the Microsoft Graph API. Grant the service principal the following Graph API application permissions:

PermissionPurpose
User.Read.AllRead user profiles for sync
Group.Read.AllRead group memberships for role mapping
Directory.Read.AllRead org structure for department mapping

Step 4: AKS and VM CMDB Sync

StackFlow discovers Azure resources via the Azure Resource Manager API and creates CMDB CIs:

Azure ResourceCMDB CI ClassKey Attributes
Virtual Machineazure_vmname, size, OS, resource group, region, private IP
AKS Clusterazure_akscluster_name, k8s_version, node_pools, region
Azure SQL / Cosmos DBazure_databaseserver_name, database, tier, region
App Serviceazure_app_serviceapp_name, plan, region, runtime
Storage Accountazure_storageaccount_name, sku, access_tier, region

Step 5: Connect in StackFlow

  1. Navigate to Admin → Integration Hub → Microsoft Azure → Configure
  2. Enter Tenant ID, Subscription ID, Client ID, and Client Secret
  3. Select Azure regions and resource types to discover
  4. Enable Entra ID user sync and configure group-to-role mapping
  5. Set the Azure Monitor webhook URL in the Azure action group
  6. Click Save & Test

Field Reference

FieldRequiredDescription
Tenant IDYesAzure AD tenant ID
Subscription IDYesTarget Azure subscription
Client IDYesService principal application (client) ID
Client SecretYesService principal client secret
RegionsNoAzure regions to discover (default: all)
Entra ID SyncNoEnable user/group sync from Entra ID (default: false)
CMDB DiscoveryNoEnable Azure resource discovery to CMDB (default: true)

Testing the Integration

  1. Click Test Service Principal to verify credentials and permissions
  2. Click Run Discovery Now and verify Azure VMs/AKS clusters appear in CMDB
  3. Send a test alert from Azure Monitor action group and verify incident creation

Troubleshooting

IssueCauseFix
AADSTS70011 errorInvalid scope for Graph APIAdd https://graph.microsoft.com/.default to token request scope
Resources not discoveredReader role not applied to all resource groupsApply Reader role at subscription scope, not resource group level
Alert webhook 400 errorCommon schema not enabledEnable Use common alert schema in Azure action group
User sync incompleteDirectory.Read.All not consentedGrant admin consent for Graph API permissions in Azure AD app registration