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

New Office User Agent in Dynamics 365

Back
Id572f3951-5fa3-4e42-9640-fe194d859419
RulenameNew Office User Agent in Dynamics 365
DescriptionDetects users accessing Dynamics from a User Agent that has not been seen in any Office 365 workloads in the last 7 days. Has configurable filter for known good user agents such as PowerApps.
SeverityLow
TacticsInitialAccess
TechniquesT1078
Required data connectorsDynamics365
KindScheduled
Query frequency1d
Query period7d
Trigger threshold0
Trigger operatorgt
Source Urihttps://github.com/Azure/Azure-Sentinel/blob/master/Detections/Dynamics365Activity/NewOfficeUserAgentinDynamics.yaml
Version1.0.1
Arm template572f3951-5fa3-4e42-9640-fe194d859419.json
Deploy To Azure
let timeframe = 1h;
let lookback = 7d;
let known_useragents = dynamic([]);
Dynamics365Activity
| where TimeGenerated > ago(timeframe)
| extend Message = tostring(split(OriginalObjectId, ' ')[0])
| where Message =~ "UserSignIn"
| extend IPAddress = tostring(split(ClientIP, ":")[0])
| where isnotempty(UserAgent)
// Exclude user agents with a render agent to reduce noise
| where UserAgent has_any ("Gecko", "WebKit", "Presto", "Trident", "EdgeHTML", "Blink")
| join kind=leftanti(
OfficeActivity
| where TimeGenerated > ago(lookback)
| where UserAgent !in~ (known_useragents))
on UserAgent
| summarize MostRecentActivity=max(TimeGenerated), IPs=make_set(IPAddress), Users=make_set(UserId), Actions=make_set(OriginalObjectId) by UserAgent
| extend timestamp = MostRecentActivity
triggerOperator: gt
id: 572f3951-5fa3-4e42-9640-fe194d859419
queryFrequency: 1d
requiredDataConnectors:
- dataTypes:
  - Dynamics365Activity
  connectorId: Dynamics365
severity: Low
metadata:
  source:
    kind: Community
  categories:
    domains:
    - Cloud Provider
    - IT Operations
    - Storage
  support:
    tier: Microsoft
  author:
    name: Microsoft
triggerThreshold: 0
kind: Scheduled
status: Available
queryPeriod: 7d
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Detections/Dynamics365Activity/NewOfficeUserAgentinDynamics.yaml
query: |
  let timeframe = 1h;
  let lookback = 7d;
  let known_useragents = dynamic([]);
  Dynamics365Activity
  | where TimeGenerated > ago(timeframe)
  | extend Message = tostring(split(OriginalObjectId, ' ')[0])
  | where Message =~ "UserSignIn"
  | extend IPAddress = tostring(split(ClientIP, ":")[0])
  | where isnotempty(UserAgent)
  // Exclude user agents with a render agent to reduce noise
  | where UserAgent has_any ("Gecko", "WebKit", "Presto", "Trident", "EdgeHTML", "Blink")
  | join kind=leftanti(
  OfficeActivity
  | where TimeGenerated > ago(lookback)
  | where UserAgent !in~ (known_useragents))
  on UserAgent
  | summarize MostRecentActivity=max(TimeGenerated), IPs=make_set(IPAddress), Users=make_set(UserId), Actions=make_set(OriginalObjectId) by UserAgent
  | extend timestamp = MostRecentActivity  
description: |
    'Detects users accessing Dynamics from a User Agent that has not been seen in any Office 365 workloads in the last 7 days. Has configurable filter for known good user agents such as PowerApps.'
name: New Office User Agent in Dynamics 365
relevantTechniques:
- T1078
tactics:
- InitialAccess
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": [
    {
      "id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/572f3951-5fa3-4e42-9640-fe194d859419')]",
      "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/572f3951-5fa3-4e42-9640-fe194d859419')]",
      "type": "Microsoft.OperationalInsights/workspaces/providers/alertRules",
      "kind": "Scheduled",
      "apiVersion": "2022-11-01",
      "properties": {
        "displayName": "New Office User Agent in Dynamics 365",
        "description": "'Detects users accessing Dynamics from a User Agent that has not been seen in any Office 365 workloads in the last 7 days. Has configurable filter for known good user agents such as PowerApps.'\n",
        "severity": "Low",
        "enabled": true,
        "query": "let timeframe = 1h;\nlet lookback = 7d;\nlet known_useragents = dynamic([]);\nDynamics365Activity\n| where TimeGenerated > ago(timeframe)\n| extend Message = tostring(split(OriginalObjectId, ' ')[0])\n| where Message =~ \"UserSignIn\"\n| extend IPAddress = tostring(split(ClientIP, \":\")[0])\n| where isnotempty(UserAgent)\n// Exclude user agents with a render agent to reduce noise\n| where UserAgent has_any (\"Gecko\", \"WebKit\", \"Presto\", \"Trident\", \"EdgeHTML\", \"Blink\")\n| join kind=leftanti(\nOfficeActivity\n| where TimeGenerated > ago(lookback)\n| where UserAgent !in~ (known_useragents))\non UserAgent\n| summarize MostRecentActivity=max(TimeGenerated), IPs=make_set(IPAddress), Users=make_set(UserId), Actions=make_set(OriginalObjectId) by UserAgent\n| extend timestamp = MostRecentActivity\n",
        "queryFrequency": "P1D",
        "queryPeriod": "P7D",
        "triggerOperator": "GreaterThan",
        "triggerThreshold": 0,
        "suppressionDuration": "PT1H",
        "suppressionEnabled": false,
        "tactics": [
          "InitialAccess"
        ],
        "techniques": [
          "T1078"
        ],
        "alertRuleTemplateName": "572f3951-5fa3-4e42-9640-fe194d859419",
        "customDetails": null,
        "entityMappings": null,
        "status": "Available",
        "templateVersion": "1.0.1",
        "OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Detections/Dynamics365Activity/NewOfficeUserAgentinDynamics.yaml"
      }
    }
  ]
}