Microsoft Sentinel Analytic Rules
cloudbrothers.infoAzure Sentinel RepoToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeToggle Dark/Light/Auto modeBack to homepage

User Account Created Using Incorrect Naming Format

Back
Idee55dc85-d2da-48c1-a6c0-3eaee62a8d56
RulenameUser Account Created Using Incorrect Naming Format
DescriptionThis query looks for accounts being created where the name does not match a defined pattern.

Attackers may attempt to add accounts as a means of establishing persistant access to an environment, looking for anomalies in created accounts may help identify illegitimately created accounts.

Created accounts should be investigated to ensure they were legitimated created.

The user_regex field in the query needs to be populated with the expected pattern for the environment before deployment.

Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#accounts-not-following-naming-policies
SeverityLow
TacticsPersistence
TechniquesT1136.003
Required data connectorsAzureActiveDirectory
KindScheduled
Query frequency1d
Query period1d
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/UserAccountCreatedUsingIncorrectNamingFormat.yaml
Version1.0.1
Arm templateee55dc85-d2da-48c1-a6c0-3eaee62a8d56.json
Deploy To Azure
// Add the environments expected username format regex below before deploying
  let user_regex = "";
  AuditLogs
  | where OperationName =~ "Add user"
  | where Result =~ "success"
  | extend userAgent = tostring(AdditionalDetails[0].value)
  | extend addingUser = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
  | extend addingApp = tostring(parse_json(tostring(InitiatedBy.app)).displayName)
  | extend AddedBy = iif(isnotempty(addingUser), addingUser, addingApp)
  | extend ipAddress = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress)
  | extend AddedUser = tostring(TargetResources[0].userPrincipalName)
  | where AddedUser matches regex user_regex
id: ee55dc85-d2da-48c1-a6c0-3eaee62a8d56
queryPeriod: 1d
severity: Low
kind: Scheduled
query: |
  // Add the environments expected username format regex below before deploying
    let user_regex = "";
    AuditLogs
    | where OperationName =~ "Add user"
    | where Result =~ "success"
    | extend userAgent = tostring(AdditionalDetails[0].value)
    | extend addingUser = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)
    | extend addingApp = tostring(parse_json(tostring(InitiatedBy.app)).displayName)
    | extend AddedBy = iif(isnotempty(addingUser), addingUser, addingApp)
    | extend ipAddress = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress)
    | extend AddedUser = tostring(TargetResources[0].userPrincipalName)
    | where AddedUser matches regex user_regex  
entityMappings:
- fieldMappings:
  - identifier: FullName
    columnName: AddedBy
  entityType: Account
- fieldMappings:
  - identifier: FullName
    columnName: AddedUser
  entityType: Account
triggerThreshold: 0
metadata:
  categories:
    domains:
    - Security - Others
  author:
    name: Pete Bryan
  source:
    kind: Community
  support:
    tier: Community
description: |
  'This query looks for accounts being created where the name does not match a defined pattern.
    Attackers may attempt to add accounts as a means of establishing persistant access to an environment, looking for anomalies in created accounts may help identify illegitimately created accounts.
    Created accounts should be investigated to ensure they were legitimated created.
    The user_regex field in the query needs to be populated with the expected pattern for the environment before deployment.
    Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#accounts-not-following-naming-policies'  
tags:
- AADSecOpsGuide
name: User Account Created Using Incorrect Naming Format
relevantTechniques:
- T1136.003
queryFrequency: 1d
requiredDataConnectors:
- connectorId: AzureActiveDirectory
  dataTypes:
  - AuditLogs
tactics:
- Persistence
triggerOperator: gt
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/UserAccountCreatedUsingIncorrectNamingFormat.yaml
version: 1.0.1
{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "workspace": {
      "type": "String"
    }
  },
  "resources": [
    {
      "apiVersion": "2023-02-01-preview",
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/ee55dc85-d2da-48c1-a6c0-3eaee62a8d56')]",
      "kind": "Scheduled",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/ee55dc85-d2da-48c1-a6c0-3eaee62a8d56')]",
      "properties": {
        "alertRuleTemplateName": "ee55dc85-d2da-48c1-a6c0-3eaee62a8d56",
        "customDetails": null,
        "description": "'This query looks for accounts being created where the name does not match a defined pattern.\n  Attackers may attempt to add accounts as a means of establishing persistant access to an environment, looking for anomalies in created accounts may help identify illegitimately created accounts.\n  Created accounts should be investigated to ensure they were legitimated created.\n  The user_regex field in the query needs to be populated with the expected pattern for the environment before deployment.\n  Ref: https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#accounts-not-following-naming-policies'\n",
        "displayName": "User Account Created Using Incorrect Naming Format",
        "enabled": true,
        "entityMappings": [
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "AddedBy",
                "identifier": "FullName"
              }
            ]
          },
          {
            "entityType": "Account",
            "fieldMappings": [
              {
                "columnName": "AddedUser",
                "identifier": "FullName"
              }
            ]
          }
        ],
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Detections/AuditLogs/UserAccountCreatedUsingIncorrectNamingFormat.yaml",
        "query": "// Add the environments expected username format regex below before deploying\n  let user_regex = \"\";\n  AuditLogs\n  | where OperationName =~ \"Add user\"\n  | where Result =~ \"success\"\n  | extend userAgent = tostring(AdditionalDetails[0].value)\n  | extend addingUser = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)\n  | extend addingApp = tostring(parse_json(tostring(InitiatedBy.app)).displayName)\n  | extend AddedBy = iif(isnotempty(addingUser), addingUser, addingApp)\n  | extend ipAddress = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress)\n  | extend AddedUser = tostring(TargetResources[0].userPrincipalName)\n  | where AddedUser matches regex user_regex\n",
        "queryFrequency": "P1D",
        "queryPeriod": "P1D",
        "severity": "Low",
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "Persistence"
        ],
        "tags": [
          "AADSecOpsGuide"
        ],
        "techniques": [
          "T1136"
        ],
        "templateVersion": "1.0.1",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0
      },
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
    }
  ]
}