Detection rules › Splunk

Azure AD Service Principal Created

Status
production
Severity
medium
Group by
aws::recipientAccountId, dest, displayName, result, signature, src, user, vendor_product
Author
Gowthamaraj Rajendran, Mauricio Velazco, Splunk
Source
github.com/splunk/security_content

The following analytic detects the creation of a Service Principal in an Azure AD environment. It leverages Azure Active Directory events ingested through EventHub, specifically monitoring the "Add service principal" operation. This activity is significant because Service Principals can be used by adversaries to establish persistence and bypass multi-factor authentication and conditional access policies. If confirmed malicious, this could allow attackers to maintain single-factor access to the Azure AD environment, potentially leading to unauthorized access to resources and prolonged undetected activity.

Known false positives

  • Administrator may legitimately create Service Principal. Filter as needed.

MITRE ATT&CK coverage

TacticTechniques
Persistence

Telemetry coverage

PlatformRecord / event type
AzureAdd service principal

Rules detecting the same action

These rules filter on the same operation.

Rule body

name: Azure AD Service Principal Created
id: f8ba49e7-ffd3-4b53-8f61-e73974583c5d
version: 11
creation_date: '2022-08-17'
modification_date: '2026-05-13'
author: Gowthamaraj Rajendran, Mauricio Velazco, Splunk
status: production
type: TTP
description: The following analytic detects the creation of a Service Principal in an Azure AD environment. It leverages Azure Active Directory events ingested through EventHub, specifically monitoring the "Add service principal" operation. This activity is significant because Service Principals can be used by adversaries to establish persistence and bypass multi-factor authentication and conditional access policies. If confirmed malicious, this could allow attackers to maintain single-factor access to the Azure AD environment, potentially leading to unauthorized access to resources and prolonged undetected activity.
data_source:
    - Azure Active Directory Add service principal
search: |-
    `azure_monitor_aad` operationName="Add service principal" properties.initiatedBy.user.id=*
      | rename properties.* as *
      | rename targetResources{}.displayName as displayName
      | rename targetResources{}.type as type
      | fillnull
      | stats count min(_time) as firstTime max(_time) as lastTime
        BY dest user src
           vendor_account vendor_product displayName
           result signature
      | `security_content_ctime(firstTime)`
      | `security_content_ctime(lastTime)`
      | `azure_ad_service_principal_created_filter`
how_to_implement: You must install the latest version of Splunk Add-on for Microsoft Cloud Services from Splunkbase(https://splunkbase.splunk.com/app/3110/#/details). You must be ingesting Azure Active Directory events into your Splunk environment thorough an EventHub. This analytic was written to be used with the azure:monitor:aad sourcetype leveraging the AuditLog log category.
known_false_positives: Administrator may legitimately create Service Principal. Filter as needed.
references:
    - https://docs.microsoft.com/en-us/azure/active-directory/develop/app-objects-and-service-principals
    - https://docs.microsoft.com/en-us/powershell/azure/create-azure-service-principal-azureps?view=azps-8.2.0
    - https://www.truesec.com/hub/blog/using-a-legitimate-application-to-create-persistence-and-initiate-email-campaigns
    - https://www.inversecos.com/2021/10/how-to-backdoor-azure-applications-and.html
    - https://attack.mitre.org/techniques/T1136/003/
finding:
    title: Service Principal named $displayName$ created by $user$
    entity:
        field: displayName
        type: user
        score: 50
analytic_story:
    - Azure Active Directory Persistence
    - NOBELIUM Group
asset_type: Azure Active Directory
mitre_attack_id:
    - T1136.003
product:
    - Splunk Enterprise
    - Splunk Enterprise Security
    - Splunk Cloud
category: cloud
security_domain: threat

Stages and Predicates

Stage 1: search

`azure_monitor_aad` operationName="Add service principal" properties.initiatedBy.user.id=*

Stage 2: rename

| rename properties.* as *

Stage 3: rename

| rename targetResources{}.displayName as displayName

Stage 4: rename

| rename targetResources{}.type as type

Stage 5: fillnull

| fillnull

Stage 6: stats

| stats count min(_time) as firstTime max(_time) as lastTime
    BY dest user src
       vendor_account vendor_product displayName
       result signature

Stage 7: search

| `security_content_ctime(firstTime)`

Stage 8: search

| `security_content_ctime(lastTime)`

Stage 9: search

| `azure_ad_service_principal_created_filter`

Indicators

These rows show field, operator, and value matches.