From 4c7f64146b9dff76c0bd8176d44325a5171d3dab Mon Sep 17 00:00:00 2001 From: Adam Kinniburgh Date: Tue, 24 Nov 2026 16:42:13 +0000 Subject: [PATCH 1/5] Add Microsoft Purview Data Security plugin --- plugins/MicrosoftPurview/v1/docs/README.md | 2 +- plugins/MicrosoftPurview/v1/icon.svg | 63 +- plugins/MicrosoftPurview/v1/metadata.json | 8 +- .../v1/configValidation.json | 34 + .../v1/custom_types.json | 30 + .../v1/dataStreams/aiInteractions.json | 237 +++++++ .../v1/dataStreams/alerts.json | 330 +++++++++ .../v1/dataStreams/cloudAppEventsQuery.json | 49 ++ .../v1/dataStreams/fileActivity.json | 237 +++++++ .../v1/dataStreams/importAiApps.json | 47 ++ .../v1/dataStreams/importSites.json | 56 ++ .../v1/dataStreams/importUsers.json | 76 +++ .../v1/dataStreams/labelActivity.json | 304 +++++++++ .../v1/dataStreams/scripts/aiInteractions.js | 11 + .../v1/dataStreams/scripts/alerts.js | 53 ++ .../scripts/cloudAppEventsQuery.js | 11 + .../errorHandling/microsoftGraphApi.js | 31 + .../v1/dataStreams/scripts/fileActivity.js | 11 + .../v1/dataStreams/scripts/labelActivity.js | 13 + .../v1/dataStreams/sensitivityLabels.json | 110 +++ .../v1/dataStreams/validationAlerts.json | 35 + .../v1/dataStreams/validationHunting.json | 29 + .../v1/defaultContent/aiApp.dash.json | 397 +++++++++++ .../v1/defaultContent/aiRisk.dash.json | 559 ++++++++++++++++ .../v1/defaultContent/manifest.json | 28 + .../v1/defaultContent/overview.dash.json | 624 ++++++++++++++++++ .../v1/defaultContent/scopes.json | 70 ++ .../defaultContent/sensitivityLabel.dash.json | 428 ++++++++++++ .../v1/defaultContent/site.dash.json | 395 +++++++++++ .../v1/defaultContent/user.dash.json | 527 +++++++++++++++ .../v1/docs/README.md | 74 +++ .../MicrosoftPurviewDataSecurity/v1/icon.svg | 49 ++ .../v1/indexDefinitions/default.json | 199 ++++++ .../v1/metadata.json | 81 +++ .../MicrosoftPurviewDataSecurity/v1/ui.json | 29 + 35 files changed, 5210 insertions(+), 27 deletions(-) create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/configValidation.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/custom_types.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/aiInteractions.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/alerts.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/cloudAppEventsQuery.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/fileActivity.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importAiApps.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importSites.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importUsers.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/labelActivity.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/aiInteractions.js create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/alerts.js create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/cloudAppEventsQuery.js create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/errorHandling/microsoftGraphApi.js create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/fileActivity.js create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/labelActivity.js create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/sensitivityLabels.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/validationAlerts.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/validationHunting.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiApp.dash.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiRisk.dash.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/manifest.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/overview.dash.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/scopes.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/sensitivityLabel.dash.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/docs/README.md create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/icon.svg create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/indexDefinitions/default.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/metadata.json create mode 100644 plugins/MicrosoftPurviewDataSecurity/v1/ui.json diff --git a/plugins/MicrosoftPurview/v1/docs/README.md b/plugins/MicrosoftPurview/v1/docs/README.md index 6114cb5d8..ae4f87146 100644 --- a/plugins/MicrosoftPurview/v1/docs/README.md +++ b/plugins/MicrosoftPurview/v1/docs/README.md @@ -1,5 +1,5 @@ -This plugin connects SquaredUp to Microsoft Purview and surfaces data governance posture across collections, data sources, scans, classifications, policies, and lineage. +This plugin connects SquaredUp to the [Microsoft Purview](https://learn.microsoft.com/en-us/purview/purview) data governance solutions, the Data Map and Unified Catalog, and surfaces data governance posture across collections, data sources, scans, classifications, policies, and lineage. For Microsoft Purview data security, such as Copilot and AI app activity and sensitivity labels, use the **Microsoft Purview Data Security** plugin. ## What it does diff --git a/plugins/MicrosoftPurview/v1/icon.svg b/plugins/MicrosoftPurview/v1/icon.svg index b8fcf8425..ff2c0b0ec 100644 --- a/plugins/MicrosoftPurview/v1/icon.svg +++ b/plugins/MicrosoftPurview/v1/icon.svg @@ -1,30 +1,49 @@ - + - + + + + + + + + + - - - + + + - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + - - - - diff --git a/plugins/MicrosoftPurview/v1/metadata.json b/plugins/MicrosoftPurview/v1/metadata.json index 0bbeb4d40..e0bcb8dae 100644 --- a/plugins/MicrosoftPurview/v1/metadata.json +++ b/plugins/MicrosoftPurview/v1/metadata.json @@ -1,10 +1,10 @@ { "name": "microsoft-purview", - "displayName": "Microsoft Purview", - "version": "1.7.5", + "displayName": "Microsoft Purview Data Governance", + "version": "1.7.6", "author": { - "name": "johnhayes-squaredup", - "type": "community" + "name": "SquaredUp Labs", + "type": "labs" }, "description": "Visualize Microsoft Purview data governance: assets by collection, classification coverage, scan status and history, policy coverage, and lineage.", "category": "Security", diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/configValidation.json b/plugins/MicrosoftPurviewDataSecurity/v1/configValidation.json new file mode 100644 index 000000000..f8ff82b3f --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/configValidation.json @@ -0,0 +1,34 @@ +{ + "steps": [ + { + "displayName": "Sensitivity labels access", + "dataStream": { + "name": "sensitivityLabels" + }, + "required": true, + "success": "Successfully read sensitivity labels.", + "error": "Cannot read sensitivity labels. Check the tenant ID, client ID and client secret, and grant the 'InformationProtectionPolicy.Read.All' application permission with admin consent in Microsoft Entra ID." + }, + { + "displayName": "Alerts access", + "dataStream": { + "name": "validationAlerts" + }, + "required": false, + "success": "Successfully read alerts.", + "error": "Cannot read alerts, so alert tiles will not work. Grant the 'SecurityAlert.Read.All' application permission with admin consent in Microsoft Entra ID." + }, + { + "displayName": "AI interactions", + "dataStream": { + "name": "validationHunting", + "config": { + "errorOnEmptyResults": true + } + }, + "required": false, + "success": "Found Copilot and AI app interactions in advanced hunting.", + "error": "Found no Copilot or AI app interactions in advanced hunting in the last 30 days, so AI interaction tiles will be empty. They need the 'ThreatHunting.Read.All' application permission and the Microsoft Defender for Cloud Apps Microsoft 365 app connector with its 'Microsoft 365 activities' component selected. Alerts and sensitivity labels work without it." + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/custom_types.json b/plugins/MicrosoftPurviewDataSecurity/v1/custom_types.json new file mode 100644 index 000000000..8b80c4015 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/custom_types.json @@ -0,0 +1,30 @@ +[ + { + "name": "Sensitivity Label", + "sourceType": "Sensitivity Label", + "icon": "tag", + "singular": "Sensitivity Label", + "plural": "Sensitivity Labels" + }, + { + "name": "User", + "sourceType": "User", + "icon": "user", + "singular": "User", + "plural": "Users" + }, + { + "name": "AI App", + "sourceType": "AI App", + "icon": "robot", + "singular": "AI App", + "plural": "AI Apps" + }, + { + "name": "Site", + "sourceType": "Site", + "icon": "folder-open", + "singular": "Site", + "plural": "Sites" + } +] diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/aiInteractions.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/aiInteractions.json new file mode 100644 index 000000000..1e85e5b6e --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/aiInteractions.json @@ -0,0 +1,237 @@ +{ + "name": "aiInteractions", + "displayName": "AI Interactions", + "description": "Copilot and AI app interactions, grouped as you choose (time, user, AI app, app host, sensitivity label), with the sensitivity labels of the data they reach (needs Defender for Cloud Apps with the Microsoft 365 connector)", + "tags": [ + "AI", + "Information Protection" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "post", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "none" + }, + "expandInnerObjects": false, + "endpointPath": "v1.0/security/runHuntingQuery", + "postBody": { + "Query": "let binSize = {{ (new Date(timeframe.end) - new Date(timeframe.start)) <= 86400000 ? '1h' : '1d' }};\nlet groups = dynamic({{ JSON.stringify(((typeof groupBy === 'undefined' || groupBy === null) ? ['time', 'aiApp'] : [].concat(groupBy).map((m) => (m && typeof m === 'object') ? m.value : m)).filter((v) => ['time', 'user', 'aiApp', 'appHost', 'label'].includes(v))) }});\nlet gTime = set_has_element(groups, 'time');\nlet gUser = set_has_element(groups, 'user');\nlet gApp = set_has_element(groups, 'aiApp');\nlet gHost = set_has_element(groups, 'appHost');\nlet gLabel = set_has_element(groups, 'label');\nlet topLimit = {{ (() => { const n = Math.floor(Number(typeof top === 'undefined' ? 0 : top)); return n > 0 ? n : 1000000000; })() }};\nlet selectedLabels = dynamic({{ JSON.stringify((labels || []).map(o => [].concat(o.rawId)[0]).filter(Boolean).map(s => String(s).toLowerCase())) }});\nlet selectedUsers = dynamic({{ JSON.stringify((users || []).map(o => [].concat(o.rawId)[0]).filter(Boolean).map(s => String(s).toLowerCase())) }});\nlet selectedApps = dynamic({{ JSON.stringify((aiApps || []).map(o => [].concat(o.rawId)[0]).filter(Boolean)) }});\nlet needExpand = gLabel or array_length(selectedLabels) > 0;\nCloudAppEvents\n| where Timestamp between (datetime({{timeframe.start}}) .. datetime({{timeframe.end}}))\n| where ActionType in ('CopilotInteraction', 'AIAppInteraction')\n| extend uid = tolower(tostring(AccountObjectId))\n| where array_length(selectedUsers) == 0 or set_has_element(selectedUsers, uid)\n| extend raw = todynamic(RawEventData)\n| extend ced = raw.CopilotEventData\n| extend appId = tostring(raw.AppIdentity)\n| where array_length(selectedApps) == 0 or set_has_element(selectedApps, appId)\n| extend user = iff(gUser, tolower(tostring(raw.UserId)), ''), userId = iff(gUser, uid, ''), aiApp = iff(gApp, appId, ''), appHost = iff(gHost, tostring(ced.AppHost), ''), topLabel = tolower(tostring(ced.SensitivityLabelId))\n| extend res = iff(array_length(ced.AccessedResources) > 0, ced.AccessedResources, dynamic([]))\n| extend labelSet = iff(needExpand, set_union(extract_all('\"sensitivitylabelid\":\"([0-9a-f-]+)\"', tolower(tostring(res))), iff(isempty(topLabel), dynamic([]), pack_array(topLabel))), dynamic([]))\n| extend jailbreak = tostring(ced.Messages) has '\"JailbreakDetected\":true'\n| extend rs = array_concat(res, pack_array(bag_pack('sentinel', true, 'SensitivityLabelId', topLabel)))\n| project Timestamp, user, userId, aiApp, appHost, labelSet, jailbreak, rs\n| serialize\n| extend ix = row_number()\n| mv-apply r = rs on (\n extend isRes = isempty(tostring(r.sentinel)), isLab = isnotempty(tostring(r.SensitivityLabelId)), rl = iff(needExpand, tolower(tostring(r.SensitivityLabelId)), '')\n | summarize resourcesAccessed = countif(isRes), labelledResources = countif(isRes and isLab), dlpPolicyMatches = countif(isRes and isnotempty(tostring(r.PolicyDetails)) and tostring(r.PolicyDetails) !in ('[]', '{}')), xpiaDetections = countif(isRes and tobool(r.XPIADetected)) by rl\n)\n| extend counted = iff(isnotempty(rl) or array_length(labelSet) == 0, 1, 0)\n| extend pick = iff(array_length(set_intersect(labelSet, selectedLabels)) > 0, set_intersect(labelSet, selectedLabels), labelSet)\n| extend primary = iff(counted == 1 and rl == iff(array_length(pick) == 0, '', tostring(array_sort_asc(pick)[0])), 1, 0)\n| where counted == 1 or resourcesAccessed > 0\n| where array_length(selectedLabels) == 0 or set_has_element(selectedLabels, rl)\n| summarize c = max(counted), pr = max(iff(gLabel, primary, counted)), resourcesAccessed = sum(resourcesAccessed), labelledResources = sum(labelledResources), dlpPolicyMatches = sum(dlpPolicyMatches), xpiaDetections = sum(xpiaDetections), jb = max(toint(jailbreak)) by ix, timestamp = iff(gTime, bin(Timestamp, binSize), datetime({{timeframe.start}})), user, userId, aiApp, appHost, sensitivityLabelId = iff(gLabel, rl, '')\n| summarize interactions = sum(c), uniqueInteractions = sum(pr), resourcesAccessed = sum(resourcesAccessed), labelledResources = sum(labelledResources), dlpPolicyMatches = sum(dlpPolicyMatches), xpiaDetections = sum(xpiaDetections), jailbreakAttempts = sumif(pr, jb == 1) by timestamp, user, userId, aiApp, appHost, sensitivityLabelId\n| extend gk = strcat(user, '|', userId, '|', aiApp, '|', appHost, '|', sensitivityLabelId)\n| as hint.materialized=true T\n| join kind=leftsemi (T | summarize tot = sum(uniqueInteractions) by gk | top topLimit by tot desc | project gk) on gk\n| project-away gk\n| order by timestamp asc, uniqueInteractions desc" + }, + "pathToData": "results", + "postRequestScript": "aiInteractions.js", + "getArgs": [], + "headers": [] + }, + "matches": "none", + "metadata": [ + { + "name": "timestamp", + "displayName": "Time", + "shape": "date", + "role": "timestamp" + }, + { + "name": "user", + "displayName": "User", + "shape": "string", + "role": "label" + }, + { + "name": "userId", + "displayName": "User ID", + "shape": "string", + "sourceType": "User", + "visible": false + }, + { + "name": "userName", + "displayName": "User Name", + "sourceId": "userId", + "objectPropertyPath": "name", + "valueExpression": "{{ (typeof object !== 'undefined' && object && object.name) || null }}" + }, + { + "name": "aiApp", + "displayName": "AI App", + "shape": "string", + "sourceType": "AI App" + }, + { + "name": "appHost", + "displayName": "App Host", + "shape": "string" + }, + { + "name": "sensitivityLabelId", + "displayName": "Sensitivity Label ID", + "shape": "string", + "sourceType": "Sensitivity Label", + "visible": false + }, + { + "name": "sensitivityLabel", + "displayName": "Sensitivity Label", + "sourceId": "sensitivityLabelId", + "objectPropertyPath": "name", + "valueExpression": "{{ (typeof object !== 'undefined' && object && object.name) || null }}" + }, + { + "name": "labelPriority", + "displayName": "Label Priority", + "sourceId": "sensitivityLabelId", + "objectPropertyPath": "priority", + "shape": "number", + "valueExpression": "{{ (typeof object !== 'undefined' && object && typeof object.priority !== 'undefined') ? object.priority : null }}" + }, + { + "name": "interactions", + "displayName": "Interactions", + "shape": "number" + }, + { + "name": "uniqueInteractions", + "displayName": "Unique Interactions", + "shape": "number" + }, + { + "name": "resourcesAccessed", + "displayName": "Resources Accessed", + "shape": "number" + }, + { + "name": "labelledResources", + "displayName": "Labelled Resources", + "shape": "number" + }, + { + "name": "dlpPolicyMatches", + "displayName": "DLP Policy Matches", + "shape": "number" + }, + { + "name": "xpiaDetections", + "displayName": "XPIA Detections", + "shape": "number" + }, + { + "name": "jailbreakAttempts", + "displayName": "Jailbreak Attempts", + "shape": "number" + }, + { + "sourceId": "userId", + "sourceType": "User", + "name": "userName" + }, + { + "sourceId": "aiApp", + "sourceType": "AI App", + "name": "aiApp" + }, + { + "sourceId": "sensitivityLabelId", + "sourceType": "Sensitivity Label", + "name": "sensitivityLabel" + } + ], + "timeframes": [ + "last1hour", + "last12hours", + "last24hours", + "last7days", + "last30days" + ], + "providesPluginDiagnostics": true, + "manualConfigApply": true, + "ui": [ + { + "type": "autocomplete", + "name": "groupBy", + "label": "Group by", + "isMulti": true, + "isClearable": true, + "data": { + "source": "fixed", + "values": [ + { + "value": "time", + "label": "Time" + }, + { + "value": "user", + "label": "User" + }, + { + "value": "aiApp", + "label": "AI app" + }, + { + "value": "appHost", + "label": "App host" + }, + { + "value": "label", + "label": "Sensitivity label" + } + ] + }, + "defaultValue": [ + "time", + "aiApp" + ], + "help": "Sets what each row represents. Fewer dimensions return a smaller, faster result." + }, + { + "type": "number", + "name": "top", + "label": "Top", + "help": "Keeps only the N groups with the most unique interactions, not counting time. Leave empty for all groups.", + "validation": { + "min": 1 + } + }, + { + "type": "objects", + "name": "labels", + "label": "Sensitivity labels", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Sensitivity Label" + ] + } + } + }, + { + "type": "objects", + "name": "users", + "label": "Users", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "User" + ] + } + } + }, + { + "type": "objects", + "name": "aiApps", + "label": "AI apps", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "AI App" + ] + } + } + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/alerts.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/alerts.json new file mode 100644 index 000000000..61163edf4 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/alerts.json @@ -0,0 +1,330 @@ +{ + "name": "alerts", + "displayName": "Alerts", + "description": "Microsoft Purview data loss prevention, insider risk and Security for AI alerts", + "tags": [ + "Alerts", + "AI" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "nextUrl", + "pageSize": { + "realm": { + "value": "none", + "label": "none" + } + }, + "in": { + "realm": { + "value": "payload", + "label": "payload" + }, + "path": "@odata.nextLink" + } + }, + "endpointPath": "v1.0/security/alerts_v2", + "postRequestScript": "alerts.js", + "getArgs": [ + { + "key": "$filter", + "value": "{{ (() => { const vals = (a) => (Array.isArray(a) ? a : (a ? [a] : [])).map((m) => (m && typeof m === 'object' ? m.value : m)).filter((m) => m); const any = (field, list) => '(' + list.map((v) => field + \" eq '\" + v + \"'\").join(' or ') + ')'; const all = ['dataLossPrevention', 'microsoftInsiderRiskManagement', 'microsoftSecurityForAI']; const src = vals(typeof source === 'undefined' ? null : source); const sev = vals(typeof severity === 'undefined' ? null : severity); const sta = vals(typeof status === 'undefined' ? null : status); const col = vals(typeof timeframeCol === 'undefined' ? null : timeframeCol)[0] || 'createdDateTime'; const parts = [any('serviceSource', src.length ? src : all)]; if (sev.length) parts.push(any('severity', sev)); if (sta.length) parts.push(any('status', sta)); if (timeframe.enum !== 'none') parts.push(col + ' ge ' + timeframe.start + ' and ' + col + ' le ' + timeframe.end); return parts.join(' and '); })() }}" + } + ], + "headers": [ + { + "key": "Prefer", + "value": "include-unknown-enum-members" + } + ] + }, + "matches": "none", + "metadata": [ + { + "name": "id", + "displayName": "ID", + "shape": "string", + "role": "id", + "visible": false + }, + { + "name": "title", + "displayName": "Alert", + "shape": "string", + "role": "label" + }, + { + "name": "severity", + "displayName": "Severity", + "shape": [ + "state", + { + "map": { + "error": [ + "high" + ], + "warning": [ + "medium" + ], + "unknown": [ + "low", + "informational", + "unknown", + "unknownFutureValue" + ] + } + } + ] + }, + { + "name": "status", + "displayName": "Status", + "shape": "string" + }, + { + "name": "serviceSource", + "displayName": "Source", + "shape": "string" + }, + { + "name": "detectionSource", + "displayName": "Detection Source", + "shape": "string" + }, + { + "name": "category", + "displayName": "Category", + "shape": "string" + }, + { + "name": "productName", + "displayName": "Product Name", + "shape": "string" + }, + { + "name": "description", + "displayName": "Description", + "shape": "string" + }, + { + "name": "createdDateTime", + "displayName": "Created", + "shape": "date" + }, + { + "name": "firstActivityDateTime", + "displayName": "First Activity", + "shape": "date" + }, + { + "name": "lastActivityDateTime", + "displayName": "Last Activity", + "shape": "date" + }, + { + "name": "lastUpdateDateTime", + "displayName": "Last Update", + "shape": "date" + }, + { + "name": "resolvedDateTime", + "displayName": "Resolved", + "shape": "date" + }, + { + "name": "assignedTo", + "displayName": "Assigned To", + "shape": "string" + }, + { + "name": "classification", + "displayName": "Classification", + "shape": "string" + }, + { + "name": "determination", + "displayName": "Determination", + "shape": "string" + }, + { + "name": "incidentId", + "displayName": "Incident ID", + "shape": "string" + }, + { + "name": "alertWebUrl", + "displayName": "Alert Link", + "shape": [ + "url", + { + "label": "Open alert" + } + ] + }, + { + "name": "users", + "displayName": "Users", + "shape": [ + "array", + { + "itemShape": "string" + } + ] + }, + { + "name": "userIds", + "displayName": "User IDs", + "shape": [ + "array", + { + "itemShape": "string" + } + ], + "visible": false + }, + { + "name": "files", + "displayName": "Files", + "shape": [ + "array", + { + "itemShape": "string" + } + ] + }, + { + "name": "evidenceCount", + "displayName": "Evidence Count", + "shape": "number" + } + ], + "timeframes": true, + "supportsNoneTimeframe": true, + "manualConfigApply": true, + "providesPluginDiagnostics": true, + "ui": [ + { + "name": "source", + "label": "Source", + "type": "autocomplete", + "isMulti": true, + "isClearable": true, + "data": { + "source": "fixed", + "values": [ + { + "value": "dataLossPrevention", + "label": "Data loss prevention" + }, + { + "value": "microsoftInsiderRiskManagement", + "label": "Insider risk management" + }, + { + "value": "microsoftSecurityForAI", + "label": "Security for AI" + } + ] + } + }, + { + "name": "severity", + "label": "Severity", + "type": "autocomplete", + "isMulti": true, + "isClearable": true, + "data": { + "source": "fixed", + "values": [ + { + "value": "high", + "label": "High" + }, + { + "value": "medium", + "label": "Medium" + }, + { + "value": "low", + "label": "Low" + }, + { + "value": "informational", + "label": "Informational" + } + ] + } + }, + { + "name": "status", + "label": "Status", + "type": "autocomplete", + "isMulti": true, + "isClearable": true, + "data": { + "source": "fixed", + "values": [ + { + "value": "new", + "label": "New" + }, + { + "value": "inProgress", + "label": "In progress" + }, + { + "value": "resolved", + "label": "Resolved" + } + ] + } + }, + { + "name": "users", + "label": "Users", + "type": "objects", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "User" + ] + } + } + }, + { + "name": "timeframeCol", + "label": "Timeframe column", + "type": "autocomplete", + "tileEditorStep": [ + "Timeframe" + ], + "isMulti": false, + "isClearable": false, + "defaultValue": "createdDateTime", + "data": { + "source": "fixed", + "values": [ + { + "value": "createdDateTime", + "label": "Creation time" + }, + { + "value": "lastActivityDateTime", + "label": "Last activity time" + }, + { + "value": "lastUpdateDateTime", + "label": "Last update time" + } + ] + } + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/cloudAppEventsQuery.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/cloudAppEventsQuery.json new file mode 100644 index 000000000..cfae00ff5 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/cloudAppEventsQuery.json @@ -0,0 +1,49 @@ +{ + "name": "cloudAppEventsQuery", + "displayName": "Cloud App Events Query", + "description": "Your own KQL over Defender for Cloud Apps activity in the timeframe, starting from the advanced hunting CloudAppEvents table (needs Defender for Cloud Apps with the Microsoft 365 connector)", + "tags": [ + "Activity" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "post", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "none" + }, + "expandInnerObjects": false, + "endpointPath": "v1.0/security/runHuntingQuery", + "postBody": { + "Query": "CloudAppEvents\n| where Timestamp between (datetime({{timeframe.start}}) .. datetime({{timeframe.end}}))\n{{ ((q) => q.startsWith('|') ? q : '| ' + q)(String(query || '').trim()) }}" + }, + "getArgs": [], + "headers": [], + "postRequestScript": "cloudAppEventsQuery.js" + }, + "matches": "none", + "timeframes": [ + "last1hour", + "last12hours", + "last24hours", + "last7days", + "last30days" + ], + "manualConfigApply": true, + "providesPluginDiagnostics": true, + "ui": [ + { + "name": "query", + "label": "Query", + "type": "code", + "language": "kusto", + "help": "Continues from CloudAppEvents, already filtered to the timeframe. Start with a pipe, for example: | where ActionType == 'FileDownloaded' | summarize Downloads = count() by Application. Avoid backslashes, which are removed.", + "validation": { + "required": true + } + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/fileActivity.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/fileActivity.json new file mode 100644 index 000000000..f5d5980e9 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/fileActivity.json @@ -0,0 +1,237 @@ +{ + "name": "fileActivity", + "displayName": "File Activity", + "description": "File and sharing activity in SharePoint and OneDrive, grouped by the dimensions you choose (time, user, site, workload, category, activity), with sharing and anonymous link use separated out (needs Defender for Cloud Apps with the Microsoft 365 connector)", + "tags": [ + "Activity" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "post", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "none" + }, + "expandInnerObjects": false, + "endpointPath": "v1.0/security/runHuntingQuery", + "postBody": { + "Query": "let binSize = {{ (new Date(timeframe.end) - new Date(timeframe.start)) <= 86400000 ? '1h' : '1d' }};\nlet selectedSites = dynamic({{ JSON.stringify((sites || []).map(o => [].concat(o.rawId)[0]).filter(Boolean)) }});\nlet selectedUsers = dynamic({{ JSON.stringify((users || []).map(o => [].concat(o.rawId)[0]).filter(Boolean)) }});\nlet source = CloudAppEvents\n| where Timestamp between (datetime({{timeframe.start}}) .. datetime({{timeframe.end}}))\n| where Application in ('Microsoft SharePoint Online', 'Microsoft OneDrive for Business')\n| extend userId = tolower(AccountObjectId), activity = ActionType, workload = iff(Application == 'Microsoft OneDrive for Business', 'OneDrive', 'SharePoint')\n| where array_length(selectedUsers) == 0 or set_has_element(selectedUsers, userId)\n| extend category = case(\n activity startswith 'AnonymousLink', 'Anonymous link',\n activity startswith 'SharingLink' or activity startswith 'SecureLink' or activity startswith 'CompanyLink' or activity startswith 'SharingInvitation' or activity startswith 'AddedTo' and activity contains 'Link' or activity in ('SharingSet', 'SharingRevoked', 'Broke sharing inheritance', 'SharingInheritanceBroken', 'FileRequestUsed'), 'Share',\n activity contains 'Deleted' or activity contains 'Recycled' or activity contains 'Purged', 'Delete',\n activity startswith 'FileSync' or activity contains 'Downloaded', 'Download/Sync',\n activity in ('FileUploaded', 'FileUploadedPartial', 'FolderCreated', 'FileCreated', 'TeamsMeetingRecordingUploaded'), 'Create/Upload',\n activity startswith 'FileModified' or activity startswith 'FolderModified' or activity contains 'Renamed' or activity contains 'Moved' or activity contains 'Copied', 'Modify',\n activity startswith 'FileAccessed' or activity in ('FilePreviewed', 'FileTranscriptContentAccessed', 'FileTimelineMetadataAccessed'), 'Access',\n 'Other')\n{{ (() => { const vals = (a) => (Array.isArray(a) ? a : (a ? [a] : [])).map((m) => (m && typeof m === 'object' ? m.value : m)).filter((m) => m); const ok = ['Access', 'Modify', 'Create/Upload', 'Download/Sync', 'Delete', 'Share', 'Anonymous link', 'Other']; const c = vals(typeof categories === 'undefined' ? null : categories).filter((v) => ok.includes(v)); return c.length ? '| where category in (' + c.map((v) => \"'\" + v + \"'\").join(', ') + ')' : ''; })() }}\n| extend raw = todynamic(RawEventData)\n| extend siteUrl = tolower(trim_end('/', tostring(raw.SiteUrl))), uid = tolower(tostring(raw.UserId)), objectKey = tostring(raw.ObjectId)\n| where array_length(selectedSites) == 0 or set_has_element(selectedSites, siteUrl)\n| extend user = iff(uid contains '@', uid, iff(isempty(uid) or uid == 'anonymous' or uid startswith 'urn:spo:', 'Anonymous', uid));\n{{ (() => { const vals = (a) => (Array.isArray(a) ? a : (a ? [a] : [])).map((m) => (m && typeof m === 'object' ? m.value : m)).filter((m) => m); const known = ['time', 'user', 'site', 'workload', 'category', 'activity']; const sel = ((typeof groupBy === 'undefined' || groupBy === null) ? ['time', 'category'] : vals(groupBy)).filter((d) => known.includes(d)); const cols = { time: ['timestamp = bin(Timestamp, binSize)'], user: ['user', 'userId'], site: ['siteUrl'], workload: ['workload'], category: ['category'], activity: ['activity'] }; const names = (d) => cols[d].map((c) => c.split(' = ')[0]); const by = sel.flatMap((d) => cols[d]); const nt = sel.filter((d) => d !== 'time').flatMap(names); const t = typeof top === 'undefined' ? null : (top && typeof top === 'object' ? top.value : top); const n = Math.floor(Number(t)); const byFiles = by.concat(['objectKey']).join(', '); const stage1 = '| summarize eventCount = count() by ' + byFiles; const grp = by.length ? ' by ' + sel.flatMap(names).join(', ') : ''; let q = ''; const ranked = (n > 0 && nt.length) ? 'let ranked = base | summarize rankTotal = sum(eventCount) by ' + nt.join(', ') + ' | top ' + n + ' by rankTotal desc | project ' + nt.join(', ') + '; ' : ''; q = 'let base = materialize(source ' + stage1 + '); ' + ranked + 'base' + ((n > 0 && nt.length) ? ' | join kind=inner ranked on ' + nt.join(', ') : '') + ' | summarize events = sum(eventCount), files = countif(isnotempty(objectKey))' + grp; const missing = []; if (!sel.includes('time')) missing.push('timestamp = datetime(' + timeframe.start + ')'); if (!sel.includes('user')) missing.push(\"user = ''\", \"userId = ''\"); if (!sel.includes('site')) missing.push(\"siteUrl = ''\"); if (!sel.includes('workload')) missing.push(\"workload = ''\"); if (!sel.includes('category')) missing.push(\"category = ''\"); if (!sel.includes('activity')) missing.push(\"activity = ''\"); return q + (missing.length ? ' | extend ' + missing.join(', ') : '') + ' | project timestamp, user, userId, siteUrl, workload, category, activity, events, files | order by timestamp asc, events desc'; })() }}" + }, + "pathToData": "results", + "postRequestScript": "fileActivity.js", + "getArgs": [], + "headers": [] + }, + "matches": "none", + "metadata": [ + { + "name": "timestamp", + "displayName": "Time", + "shape": "date", + "role": "timestamp" + }, + { + "name": "user", + "displayName": "User", + "shape": "string", + "role": "label" + }, + { + "name": "userId", + "displayName": "User ID", + "shape": "string", + "sourceType": "User", + "visible": false + }, + { + "name": "userName", + "displayName": "User Name", + "sourceId": "userId", + "objectPropertyPath": "name", + "valueExpression": "{{ (typeof object !== 'undefined' && object && object.name) || null }}" + }, + { + "name": "siteUrl", + "displayName": "Site URL", + "shape": "string", + "sourceType": "Site", + "visible": false + }, + { + "name": "site", + "displayName": "Site", + "sourceId": "siteUrl", + "objectPropertyPath": "name", + "valueExpression": "{{ (typeof object !== 'undefined' && object && object.name) || null }}" + }, + { + "name": "workload", + "displayName": "Workload", + "shape": "string" + }, + { + "name": "category", + "displayName": "Category", + "shape": "string" + }, + { + "name": "activity", + "displayName": "Activity", + "shape": "string" + }, + { + "name": "events", + "displayName": "Events", + "shape": "number" + }, + { + "name": "files", + "displayName": "Files", + "shape": "number" + }, + { + "sourceId": "userId", + "sourceType": "User", + "name": "userName" + }, + { + "sourceId": "siteUrl", + "sourceType": "Site", + "name": "site" + } + ], + "timeframes": [ + "last1hour", + "last12hours", + "last24hours", + "last7days", + "last30days" + ], + "providesPluginDiagnostics": true, + "manualConfigApply": true, + "ui": [ + { + "name": "groupBy", + "label": "Group by", + "type": "autocomplete", + "isMulti": true, + "isClearable": true, + "defaultValue": [ + "time", + "category" + ], + "data": { + "source": "fixed", + "values": [ + { + "value": "time", + "label": "Time" + }, + { + "value": "user", + "label": "User" + }, + { + "value": "site", + "label": "Site" + }, + { + "value": "workload", + "label": "Workload" + }, + { + "value": "category", + "label": "Category" + }, + { + "value": "activity", + "label": "Activity" + } + ] + }, + "help": "Sets what each row represents. Fewer dimensions return a smaller, faster result." + }, + { + "name": "top", + "label": "Top", + "type": "number", + "help": "Keeps only the N groups with the most events, not counting time. Leave empty for all groups.", + "validation": { + "min": 1 + } + }, + { + "name": "categories", + "label": "Categories", + "type": "autocomplete", + "isMulti": true, + "isClearable": true, + "data": { + "source": "fixed", + "values": [ + { + "value": "Access", + "label": "Access" + }, + { + "value": "Modify", + "label": "Modify" + }, + { + "value": "Create/Upload", + "label": "Create/Upload" + }, + { + "value": "Download/Sync", + "label": "Download/Sync" + }, + { + "value": "Delete", + "label": "Delete" + }, + { + "value": "Share", + "label": "Share" + }, + { + "value": "Anonymous link", + "label": "Anonymous link" + }, + { + "value": "Other", + "label": "Other" + } + ] + } + }, + { + "type": "objects", + "name": "users", + "label": "Users", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "User" + ] + } + } + }, + { + "type": "objects", + "name": "sites", + "label": "Sites", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Site" + ] + } + } + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importAiApps.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importAiApps.json new file mode 100644 index 000000000..aa2e77a57 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importAiApps.json @@ -0,0 +1,47 @@ +{ + "name": "importAiApps", + "displayName": "Import - AI Apps", + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "post", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "none" + }, + "expandInnerObjects": false, + "endpointPath": "v1.0/security/runHuntingQuery", + "postBody": { + "Query": "CloudAppEvents | where Timestamp > ago(30d) | where ActionType in ('CopilotInteraction', 'AIAppInteraction') | extend appId = tostring(RawEventData.AppIdentity) | where isnotempty(appId) | summarize arg_max(Timestamp, Application, ActionType) by appId | project appId, application = Application, interactionType = iff(ActionType == 'CopilotInteraction', 'Copilot', 'Third-party AI')" + }, + "pathToData": "results", + "getArgs": [], + "headers": [] + }, + "matches": "none", + "metadata": [ + { + "name": "appId", + "displayName": "AI App", + "shape": "string", + "role": "id" + }, + { + "name": "application", + "displayName": "Application", + "shape": "string" + }, + { + "name": "interactionType", + "displayName": "Type", + "shape": "string" + } + ], + "timeframes": false, + "providesPluginDiagnostics": true, + "visibility": { + "type": "hidden" + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importSites.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importSites.json new file mode 100644 index 000000000..f8e3b30a0 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importSites.json @@ -0,0 +1,56 @@ +{ + "name": "importSites", + "displayName": "Import - Sites", + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "post", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "none" + }, + "expandInnerObjects": false, + "endpointPath": "v1.0/security/runHuntingQuery", + "postBody": { + "Query": "CloudAppEvents | where Timestamp > ago(30d) | where Application in ('Microsoft SharePoint Online', 'Microsoft OneDrive for Business') | extend rawSite = trim_end('/', tostring(RawEventData.SiteUrl)) | where isnotempty(rawSite) | extend siteUrl = tolower(rawSite) | where hash(siteUrl, 2) == {{shardIndex}} | summarize arg_max(Timestamp, rawSite, Application) by siteUrl | extend path = trim('/', tostring(parse_url(rawSite).Path)) | project siteUrl, name = iff(isempty(path), tostring(parse_url(rawSite).Host), path), workload = iff(Application has 'OneDrive', 'OneDrive', 'SharePoint')" + }, + "pathToData": "results", + "getArgs": [], + "headers": [] + }, + "matches": "none", + "metadata": [ + { + "name": "siteUrl", + "displayName": "Site URL", + "shape": "string", + "role": "id" + }, + { + "name": "name", + "displayName": "Site", + "shape": "string", + "role": "label" + }, + { + "name": "workload", + "displayName": "Workload", + "shape": "string" + } + ], + "timeframes": false, + "providesPluginDiagnostics": true, + "visibility": { + "type": "hidden" + }, + "ui": [ + { + "name": "shardIndex", + "label": "Shard index", + "type": "text", + "defaultValue": "0" + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importUsers.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importUsers.json new file mode 100644 index 000000000..fe128424b --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importUsers.json @@ -0,0 +1,76 @@ +{ + "name": "importUsers", + "displayName": "Import - Users", + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "post", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "none" + }, + "expandInnerObjects": false, + "endpointPath": "v1.0/security/runHuntingQuery", + "postBody": { + "Query": "IdentityInfo | where Timestamp > ago(14d) | where isnotempty(AccountObjectId) and isnotempty(AccountUpn) and Type == 'User' | extend entraObjectId = tolower(AccountObjectId) | where hash(entraObjectId, 4) == {{shardIndex}} | summarize arg_max(Timestamp, AccountUpn, AccountDisplayName, Department, JobTitle, IsAccountEnabled) by entraObjectId | project entraObjectId, displayName = iff(isempty(AccountDisplayName), tolower(AccountUpn), AccountDisplayName), userPrincipalName = tolower(AccountUpn), department = Department, jobTitle = JobTitle, accountEnabled = IsAccountEnabled, userType = iff(AccountUpn contains '#ext#', 'Guest', 'Member')" + }, + "pathToData": "results", + "getArgs": [], + "headers": [] + }, + "matches": "none", + "metadata": [ + { + "name": "entraObjectId", + "displayName": "Entra Object ID", + "shape": "string", + "role": "id" + }, + { + "name": "displayName", + "displayName": "Name", + "shape": "string", + "role": "label" + }, + { + "name": "userPrincipalName", + "displayName": "User Principal Name", + "shape": "string" + }, + { + "name": "department", + "displayName": "Department", + "shape": "string" + }, + { + "name": "jobTitle", + "displayName": "Job Title", + "shape": "string" + }, + { + "name": "accountEnabled", + "displayName": "Account Enabled", + "shape": "boolean" + }, + { + "name": "userType", + "displayName": "User Type", + "shape": "string" + } + ], + "timeframes": false, + "providesPluginDiagnostics": true, + "visibility": { + "type": "hidden" + }, + "ui": [ + { + "name": "shardIndex", + "label": "Shard index", + "type": "text", + "defaultValue": "0" + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/labelActivity.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/labelActivity.json new file mode 100644 index 000000000..456e34079 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/labelActivity.json @@ -0,0 +1,304 @@ +{ + "name": "labelActivity", + "displayName": "Label Activity", + "description": "Sensitivity label activity (applied, changed, removed, opened and more), grouped by the dimensions you choose: time, user, label, previous label, action, activity, application and site (needs Defender for Cloud Apps with the Microsoft 365 connector)", + "tags": [ + "Information Protection" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "post", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "none" + }, + "expandInnerObjects": false, + "endpointPath": "v1.0/security/runHuntingQuery", + "postBody": { + "Query": "let binSize = {{ (new Date(timeframe.end) - new Date(timeframe.start)) <= 86400000 ? '1h' : '1d' }};\nlet selectedLabels = dynamic({{ JSON.stringify((labels || []).map(o => [].concat(o.rawId)[0]).filter(Boolean).map(s => String(s).toLowerCase())) }});\nlet selectedUsers = dynamic({{ JSON.stringify((users || []).map(o => [].concat(o.rawId)[0]).filter(Boolean).map(s => String(s).toLowerCase())) }});\nlet selectedSites = dynamic({{ JSON.stringify((sites || []).map(o => [].concat(o.rawId)[0]).filter(Boolean).map(s => String(s).toLowerCase())) }});\nlet selectedActions = dynamic({{ JSON.stringify((typeof actions === 'undefined' || !actions ? [] : [].concat(actions)).map((m) => (m && typeof m === 'object' ? m.value : m)).filter((m) => ['Detected in email', 'Applied', 'Changed', 'Upgraded', 'Downgraded', 'Removed', 'Opened', 'Renamed', 'Change failed'].includes(m))) }});\nlet agg = materialize(CloudAppEvents\n| where Timestamp between (datetime({{timeframe.start}}) .. datetime({{timeframe.end}}))\n| where ActionType contains 'SensitivityLabel' or ActionType == 'MipLabel'\n| where AccountType != 'Application'\n| where array_length(selectedUsers) == 0 or set_has_element(selectedUsers, tolower(AccountObjectId))\n| extend raw = todynamic(RawEventData)\n| extend led = raw.SensitivityLabelEventData\n| extend wLabel = tolower(coalesce(tostring(led.SensitivityLabelId), tostring(raw.LabelId))), wPrev = tolower(tostring(led.OldSensitivityLabelId)), eventType = tostring(led.LabelEventType)\n| where isnotempty(wLabel) or isnotempty(wPrev)\n| where array_length(selectedLabels) == 0 or set_has_element(selectedLabels, wLabel) or set_has_element(selectedLabels, wPrev)\n| extend wSite = tolower(trim_end('/', tostring(raw.SiteUrl)))\n| where array_length(selectedSites) == 0 or set_has_element(selectedSites, wSite)\n| extend hasPrevious = isnotempty(wPrev)\n| extend wAction = case(\n ActionType contains 'ChangeFailed', 'Change failed',\n ActionType endswith 'Removed', 'Removed',\n ActionType == 'SensitivityLabeledFileOpened', 'Opened',\n ActionType == 'SensitivityLabeledFileRenamed', 'Renamed',\n ActionType == 'MipLabel', 'Detected in email',\n isempty(wLabel), 'Removed',\n hasPrevious and eventType == '1', 'Upgraded',\n hasPrevious and eventType == '2', 'Downgraded',\n hasPrevious and eventType == '3', 'Removed',\n hasPrevious or eventType == '4' or ActionType endswith 'Changed' or ActionType endswith 'Updated', 'Changed',\n 'Applied')\n| where array_length(selectedActions) == 0 or set_has_element(selectedActions, wAction)\n{{ (() => { const sel = (() => { const v = (a) => (Array.isArray(a) ? a : (a ? [a] : [])).map((m) => (m && typeof m === 'object' ? m.value : m)).filter((m) => m); return (typeof groupBy === 'undefined' || groupBy === null) ? ['time', 'action'] : v(groupBy); })(); const M = { time: ['timestamp'], user: ['user', 'userId'], label: ['labelId'], previousLabel: ['previousLabelId'], action: ['action'], activity: ['activity'], application: ['application'], site: ['siteUrl'] }; const D = { timestamp: 'bin(Timestamp, binSize)', user: 'tolower(tostring(raw.UserId))', userId: 'tolower(AccountObjectId)', labelId: 'wLabel', previousLabelId: 'wPrev', action: 'wAction', activity: 'ActionType', application: 'Application', siteUrl: 'wSite' }; const E = { timestamp: 'datetime(' + timeframe.start + ')' }; const by = []; const off = []; Object.keys(M).forEach((k) => { (sel.includes(k) ? by : off).push(...M[k]); }); return by.length ? '| extend ' + by.map((c) => c + ' = ' + D[c]).join(', ') : ''; })() }}\n| extend objectKey = tostring(raw.ObjectId)\n| summarize events = count() by {{ (() => { const sel = (() => { const v = (a) => (Array.isArray(a) ? a : (a ? [a] : [])).map((m) => (m && typeof m === 'object' ? m.value : m)).filter((m) => m); return (typeof groupBy === 'undefined' || groupBy === null) ? ['time', 'action'] : v(groupBy); })(); const M = { time: ['timestamp'], user: ['user', 'userId'], label: ['labelId'], previousLabel: ['previousLabelId'], action: ['action'], activity: ['activity'], application: ['application'], site: ['siteUrl'] }; const D = { timestamp: 'bin(Timestamp, binSize)', user: 'tolower(tostring(raw.UserId))', userId: 'tolower(AccountObjectId)', labelId: 'wLabel', previousLabelId: 'wPrev', action: 'wAction', activity: 'ActionType', application: 'Application', siteUrl: 'wSite' }; const E = { timestamp: 'datetime(' + timeframe.start + ')' }; const by = []; const off = []; Object.keys(M).forEach((k) => { (sel.includes(k) ? by : off).push(...M[k]); }); return by.length ? by.join(', ') + ', ' : ''; })() }}objectKey\n| summarize events = sum(events), items = countif(isnotempty(objectKey)){{ (() => { const sel = (() => { const v = (a) => (Array.isArray(a) ? a : (a ? [a] : [])).map((m) => (m && typeof m === 'object' ? m.value : m)).filter((m) => m); return (typeof groupBy === 'undefined' || groupBy === null) ? ['time', 'action'] : v(groupBy); })(); const M = { time: ['timestamp'], user: ['user', 'userId'], label: ['labelId'], previousLabel: ['previousLabelId'], action: ['action'], activity: ['activity'], application: ['application'], site: ['siteUrl'] }; const D = { timestamp: 'bin(Timestamp, binSize)', user: 'tolower(tostring(raw.UserId))', userId: 'tolower(AccountObjectId)', labelId: 'wLabel', previousLabelId: 'wPrev', action: 'wAction', activity: 'ActionType', application: 'Application', siteUrl: 'wSite' }; const E = { timestamp: 'datetime(' + timeframe.start + ')' }; const by = []; const off = []; Object.keys(M).forEach((k) => { (sel.includes(k) ? by : off).push(...M[k]); }); return by.length ? ' by ' + by.join(', ') : ''; })() }});\nagg\n{{ (() => { const sel = (() => { const v = (a) => (Array.isArray(a) ? a : (a ? [a] : [])).map((m) => (m && typeof m === 'object' ? m.value : m)).filter((m) => m); return (typeof groupBy === 'undefined' || groupBy === null) ? ['time', 'action'] : v(groupBy); })(); const M = { time: ['timestamp'], user: ['user', 'userId'], label: ['labelId'], previousLabel: ['previousLabelId'], action: ['action'], activity: ['activity'], application: ['application'], site: ['siteUrl'] }; const D = { timestamp: 'bin(Timestamp, binSize)', user: 'tolower(tostring(raw.UserId))', userId: 'tolower(AccountObjectId)', labelId: 'wLabel', previousLabelId: 'wPrev', action: 'wAction', activity: 'ActionType', application: 'Application', siteUrl: 'wSite' }; const E = { timestamp: 'datetime(' + timeframe.start + ')' }; const by = []; const off = []; Object.keys(M).forEach((k) => { (sel.includes(k) ? by : off).push(...M[k]); }); const n = Math.floor(Number(typeof top === 'undefined' ? 0 : top)); const nt = by.filter((c) => c !== 'timestamp'); if (!(n > 0) || !nt.length) { return ''; } const k = nt.join(', '); return '| join kind=inner (agg | summarize total = sum(events) by ' + k + ' | top ' + Math.min(n, 10000) + ' by total desc | project ' + k + ') on ' + k; })() }}\n{{ (() => { const sel = (() => { const v = (a) => (Array.isArray(a) ? a : (a ? [a] : [])).map((m) => (m && typeof m === 'object' ? m.value : m)).filter((m) => m); return (typeof groupBy === 'undefined' || groupBy === null) ? ['time', 'action'] : v(groupBy); })(); const M = { time: ['timestamp'], user: ['user', 'userId'], label: ['labelId'], previousLabel: ['previousLabelId'], action: ['action'], activity: ['activity'], application: ['application'], site: ['siteUrl'] }; const D = { timestamp: 'bin(Timestamp, binSize)', user: 'tolower(tostring(raw.UserId))', userId: 'tolower(AccountObjectId)', labelId: 'wLabel', previousLabelId: 'wPrev', action: 'wAction', activity: 'ActionType', application: 'Application', siteUrl: 'wSite' }; const E = { timestamp: 'datetime(' + timeframe.start + ')' }; const by = []; const off = []; Object.keys(M).forEach((k) => { (sel.includes(k) ? by : off).push(...M[k]); }); return off.length ? '| extend ' + off.map((c) => c + ' = ' + (E[c] || \"''\")).join(', ') : ''; })() }}\n| project timestamp, user, userId, labelId, previousLabelId, action, activity, application, siteUrl, events, items\n| order by timestamp asc, events desc" + }, + "pathToData": "results", + "postRequestScript": "labelActivity.js", + "getArgs": [], + "headers": [] + }, + "matches": "none", + "metadata": [ + { + "name": "timestamp", + "displayName": "Time", + "shape": "date", + "role": "timestamp" + }, + { + "name": "user", + "displayName": "User", + "shape": "string", + "role": "label" + }, + { + "name": "userId", + "displayName": "User ID", + "shape": "string", + "sourceType": "User", + "visible": false + }, + { + "name": "userName", + "displayName": "User Name", + "sourceId": "userId", + "objectPropertyPath": "name", + "valueExpression": "{{ (typeof object !== 'undefined' && object && object.name) || null }}" + }, + { + "name": "labelId", + "displayName": "Sensitivity Label ID", + "shape": "string", + "sourceType": "Sensitivity Label", + "visible": false + }, + { + "name": "sensitivityLabel", + "displayName": "Sensitivity Label", + "sourceId": "labelId", + "objectPropertyPath": "name", + "valueExpression": "{{ (typeof object !== 'undefined' && object && object.name) || null }}" + }, + { + "name": "labelPriority", + "displayName": "Label Priority", + "sourceId": "labelId", + "objectPropertyPath": "priority", + "shape": "number", + "valueExpression": "{{ (typeof object !== 'undefined' && object && typeof object.priority !== 'undefined') ? object.priority : null }}" + }, + { + "name": "previousLabelId", + "displayName": "Previous Label ID", + "shape": "string", + "sourceType": "Sensitivity Label", + "visible": false + }, + { + "name": "previousLabel", + "displayName": "Previous Label", + "sourceId": "previousLabelId", + "objectPropertyPath": "name", + "valueExpression": "{{ (typeof object !== 'undefined' && object && object.name) || null }}" + }, + { + "name": "action", + "displayName": "Action", + "shape": "string" + }, + { + "name": "activity", + "displayName": "Activity", + "shape": "string", + "visible": false + }, + { + "name": "application", + "displayName": "Application", + "shape": "string" + }, + { + "name": "siteUrl", + "displayName": "Site URL", + "shape": "string", + "sourceType": "Site", + "visible": false + }, + { + "name": "site", + "displayName": "Site", + "sourceId": "siteUrl", + "objectPropertyPath": "name", + "valueExpression": "{{ (typeof object !== 'undefined' && object && object.name) || null }}" + }, + { + "name": "events", + "displayName": "Events", + "shape": "number" + }, + { + "name": "items", + "displayName": "Items", + "shape": "number" + }, + { + "sourceId": "userId", + "sourceType": "User", + "name": "userName" + }, + { + "sourceId": "labelId", + "sourceType": "Sensitivity Label", + "name": "sensitivityLabel" + }, + { + "sourceId": "siteUrl", + "sourceType": "Site", + "name": "site" + } + ], + "timeframes": [ + "last1hour", + "last12hours", + "last24hours", + "last7days", + "last30days" + ], + "providesPluginDiagnostics": true, + "manualConfigApply": true, + "ui": [ + { + "type": "autocomplete", + "name": "groupBy", + "label": "Group by", + "isMulti": true, + "isClearable": true, + "defaultValue": [ + "time", + "action" + ], + "data": { + "source": "fixed", + "values": [ + { + "value": "time", + "label": "Time" + }, + { + "value": "user", + "label": "User" + }, + { + "value": "label", + "label": "Label" + }, + { + "value": "previousLabel", + "label": "Previous label" + }, + { + "value": "action", + "label": "Action" + }, + { + "value": "activity", + "label": "Activity" + }, + { + "value": "application", + "label": "Application" + }, + { + "value": "site", + "label": "Site" + } + ] + }, + "help": "Sets what each row represents. Fewer dimensions return a smaller, faster result." + }, + { + "type": "number", + "name": "top", + "label": "Top", + "help": "Keeps only the N groups with the most events, not counting time. Leave empty for all groups.", + "validation": { + "min": 1 + } + }, + { + "type": "autocomplete", + "name": "actions", + "label": "Actions", + "isMulti": true, + "isClearable": true, + "data": { + "source": "fixed", + "values": [ + { + "value": "Detected in email", + "label": "Detected in email" + }, + { + "value": "Applied", + "label": "Applied" + }, + { + "value": "Changed", + "label": "Changed" + }, + { + "value": "Upgraded", + "label": "Upgraded" + }, + { + "value": "Downgraded", + "label": "Downgraded" + }, + { + "value": "Removed", + "label": "Removed" + }, + { + "value": "Opened", + "label": "Opened" + }, + { + "value": "Renamed", + "label": "Renamed" + }, + { + "value": "Change failed", + "label": "Change failed" + } + ] + } + }, + { + "type": "objects", + "name": "labels", + "label": "Sensitivity labels", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Sensitivity Label" + ] + } + } + }, + { + "type": "objects", + "name": "users", + "label": "Users", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "User" + ] + } + } + }, + { + "type": "objects", + "name": "sites", + "label": "Sites", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Site" + ] + } + } + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/aiInteractions.js b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/aiInteractions.js new file mode 100644 index 000000000..1544286aa --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/aiInteractions.js @@ -0,0 +1,11 @@ +// Keeps the label ID key on every row, empty when unlabelled, so the label lookup columns +// stay in the result even when no row has a label. Drops empty user IDs. +result = (data && Array.isArray(data.results) ? data.results : []).map((row) => { + if (!row.sensitivityLabelId) { + row.sensitivityLabelId = ''; + } + if (!row.userId) { + delete row.userId; + } + return row; +}); diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/alerts.js b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/alerts.js new file mode 100644 index 000000000..420567e3b --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/alerts.js @@ -0,0 +1,53 @@ +// Flattens evidence into per-alert lists and maps serviceSource to a friendly name +const sourceNames = { + dataLossPrevention: 'Data loss prevention', + microsoftInsiderRiskManagement: 'Insider risk management', + microsoftSecurityForAI: 'Security for AI' +}; + +const distinct = (values) => [...new Set(values.filter((v) => typeof v === 'string' && v !== ''))]; + +// Optional Users filter (consolidated stream: selection is on context.config.users, rawIds and UPN properties arrive as arrays) +const unwrap = (p) => (Array.isArray(p) ? p[0] : p); +const selected = Array.isArray(context.config && context.config.users) ? context.config.users : []; +const selectedIds = new Set(selected.map((o) => unwrap(o.rawId)).filter(Boolean).map((v) => String(v).toLowerCase())); +const selectedUpns = new Set( + selected.map((o) => unwrap(o.userPrincipalName)).filter(Boolean).map((v) => String(v).toLowerCase()) +); + +result = (data && Array.isArray(data.value) ? data.value : []).map((alert) => { + const evidence = Array.isArray(alert.evidence) ? alert.evidence : []; + const ofType = (type) => evidence.filter((e) => e && e['@odata.type'] === type); + + // Users appear as userEvidence, and as mailboxEvidence on email alerts; both carry a userAccount + const accounts = ofType('#microsoft.graph.security.userEvidence') + .concat(ofType('#microsoft.graph.security.mailboxEvidence')) + .map((e) => e.userAccount || {}); + const users = distinct( + accounts.map((account) => { + const name = account.userPrincipalName || account.accountName; + return typeof name === 'string' ? name.toLowerCase() : null; + }) + ); + const userIds = distinct( + accounts.map((account) => (typeof account.azureAdUserId === 'string' ? account.azureAdUserId.toLowerCase() : null)) + ); + const files = distinct( + ofType('#microsoft.graph.security.fileEvidence').map((e) => (e.fileDetails || {}).fileName || null) + ); + + const { evidence: _evidence, ...rest } = alert; + return { + ...rest, + serviceSource: sourceNames[alert.serviceSource] || alert.serviceSource || null, + users, + userIds, + files, + evidenceCount: evidence.length + }; +}).filter( + (row) => + (selectedIds.size === 0 && selectedUpns.size === 0) || + row.userIds.some((id) => selectedIds.has(id)) || + row.users.some((u) => selectedUpns.has(u)) +); diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/cloudAppEventsQuery.js b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/cloudAppEventsQuery.js new file mode 100644 index 000000000..e09dc0529 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/cloudAppEventsQuery.js @@ -0,0 +1,11 @@ +// Graph annotates Int64 and other typed values with "@odata.type" keys. A custom query has +// no column metadata to hide them, so drop them from each row. +result = (data && Array.isArray(data.results) ? data.results : []).map((row) => { + const clean = {}; + Object.keys(row).forEach((key) => { + if (!key.endsWith('@odata.type')) { + clean[key] = row[key]; + } + }); + return clean; +}); diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/errorHandling/microsoftGraphApi.js b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/errorHandling/microsoftGraphApi.js new file mode 100644 index 000000000..d5ef8661f --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/errorHandling/microsoftGraphApi.js @@ -0,0 +1,31 @@ +// Errors from Microsoft Graph. The common failures are permission and licence gaps rather than +// faults, so name what is missing instead of passing on the raw Graph error. +const error = (data && data.error) || {}; +const apiMessage = typeof error.message === "string" ? error.message : ""; + +// Advanced hunting runs, but the tenant has no table or column of that name. That's usually a missing +// CloudAppEvents table (no Defender for Cloud Apps Microsoft 365 connector), or a typo in a custom query. +const missingTable = apiMessage.match(/Failed to resolve table or column expression named '([^']+)'/); + +if (missingTable) { + result = + "Advanced hunting couldn't find the table or column '" + + missingTable[1] + + "'. If it's in your own query, check the name. CloudAppEvents needs the Microsoft Defender for Cloud Apps " + + "Microsoft 365 app connector with its 'Microsoft 365 activities' component selected."; +} else if (response.status === 401) { + result = + "Microsoft Graph rejected the credentials (HTTP 401). Check the tenant ID, client ID and client secret, " + + "and that the secret has not expired."; +} else if (response.status === 403) { + // Graph often names the missing role in its message; always list the read-only ones, + // because Graph lists read and write roles side by side. + result = + "Microsoft Graph refused access to this data (HTTP 403). Grant the missing application permission " + + "in Microsoft Entra ID with admin consent." + + (apiMessage ? " " + apiMessage : "") + + " Read-only permissions are enough: sensitivity labels need InformationProtectionPolicy.Read.All, " + + "alerts SecurityAlert.Read.All, and AI interactions ThreatHunting.Read.All."; +} else { + result = apiMessage || "Microsoft Graph returned HTTP " + response.status; +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/fileActivity.js b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/fileActivity.js new file mode 100644 index 000000000..a25e4939a --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/fileActivity.js @@ -0,0 +1,11 @@ +// Keeps the site ID key on every row, empty when absent, so the site lookup column stays in the +// result even when no row has a site. Drops empty user IDs. +result = (data && Array.isArray(data.results) ? data.results : []).map((row) => { + if (!row.siteUrl) { + row.siteUrl = ''; + } + if (!row.userId) { + delete row.userId; + } + return row; +}); diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/labelActivity.js b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/labelActivity.js new file mode 100644 index 000000000..d4c6c7367 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/scripts/labelActivity.js @@ -0,0 +1,13 @@ +// Keeps label and site ID keys on every row, empty when absent, so their lookup columns stay in +// the result even when no row has a value. Drops empty user IDs. +result = (data && Array.isArray(data.results) ? data.results : []).map((row) => { + ['labelId', 'previousLabelId', 'siteUrl'].forEach((key) => { + if (!row[key]) { + row[key] = ''; + } + }); + if (!row.userId) { + delete row.userId; + } + return row; +}); diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/sensitivityLabels.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/sensitivityLabels.json new file mode 100644 index 000000000..44d4da791 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/sensitivityLabels.json @@ -0,0 +1,110 @@ +{ + "name": "sensitivityLabels", + "displayName": "Sensitivity Labels", + "description": "Sensitivity labels defined in the tenant, with their priority, colour and protection settings", + "tags": [ + "Information Protection" + ], + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "nextUrl", + "pageSize": { + "realm": { + "value": "none", + "label": "none" + } + }, + "in": { + "realm": { + "value": "payload", + "label": "payload" + }, + "path": "@odata.nextLink" + } + }, + "expandInnerObjects": true, + "endpointPath": "beta/security/informationProtection/sensitivityLabels", + "pathToData": "value", + "getArgs": [], + "headers": [] + }, + "matches": "none", + "metadata": [ + { + "name": "id", + "displayName": "Label ID", + "shape": "string", + "role": "id", + "visible": false + }, + { + "name": "fullName", + "displayName": "Label", + "shape": "string", + "role": "label", + "computed": true, + "valueExpression": "{{ ($['parent.name'] || ($['parent'] && $['parent'].name)) ? ($['parent.name'] || $['parent'].name) + ' / ' + $['name'] : $['name'] }}" + }, + { + "name": "name", + "displayName": "Name", + "shape": "string", + "visible": false + }, + { + "name": "parentName", + "displayName": "Parent Label", + "shape": "string", + "computed": true, + "valueExpression": "{{ $['parent.name'] || ($['parent'] && $['parent'].name) || null }}" + }, + { + "name": "sensitivity", + "displayName": "Priority", + "shape": "number" + }, + { + "name": "color", + "displayName": "Colour", + "shape": "string" + }, + { + "name": "isActive", + "displayName": "Active", + "shape": "boolean" + }, + { + "name": "isAppliable", + "displayName": "Can Be Applied", + "shape": "boolean" + }, + { + "name": "hasProtection", + "displayName": "Encryption", + "shape": "boolean" + }, + { + "name": "contentFormats", + "displayName": "Applies To", + "shape": [ + "array", + { + "itemShape": "string" + } + ] + }, + { + "name": "tooltip", + "displayName": "Description", + "shape": "string" + } + ], + "timeframes": false, + "providesPluginDiagnostics": true +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/validationAlerts.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/validationAlerts.json new file mode 100644 index 000000000..6891f651f --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/validationAlerts.json @@ -0,0 +1,35 @@ +{ + "name": "validationAlerts", + "displayName": "Validation - Alerts", + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "get", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "none" + }, + "expandInnerObjects": false, + "endpointPath": "v1.0/security/alerts_v2", + "pathToData": "value", + "getArgs": [ + { + "key": "$top", + "value": "1" + }, + { + "key": "$select", + "value": "id" + } + ], + "headers": [] + }, + "matches": "none", + "timeframes": false, + "providesPluginDiagnostics": true, + "visibility": { + "type": "hidden" + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/validationHunting.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/validationHunting.json new file mode 100644 index 000000000..97969ba7e --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/validationHunting.json @@ -0,0 +1,29 @@ +{ + "name": "validationHunting", + "displayName": "Validation - AI Interactions", + "baseDataSourceName": "httpRequestUnscoped", + "config": { + "httpMethod": "post", + "errorHandling": { + "type": "script", + "script": "errorHandling/microsoftGraphApi.js" + }, + "paging": { + "mode": "none" + }, + "expandInnerObjects": false, + "endpointPath": "v1.0/security/runHuntingQuery", + "postBody": { + "Query": "CloudAppEvents | where Timestamp > ago(30d) | where ActionType in ('CopilotInteraction', 'AIAppInteraction') | take 1 | project Timestamp" + }, + "pathToData": "results", + "getArgs": [], + "headers": [] + }, + "matches": "none", + "timeframes": false, + "providesPluginDiagnostics": true, + "visibility": { + "type": "hidden" + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiApp.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiApp.dash.json new file mode 100644 index 000000000..a5107d514 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiApp.dash.json @@ -0,0 +1,397 @@ +{ + "name": "AI App", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [ + "{{variables.[AI App]}}" + ], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "69d05760-9bc1-4eb8-ae4e-a63692ef35d9", + "x": 0, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "AI App Details", + "description": "The AI app as Microsoft Purview records it", + "activePluginConfigIds": [ + "{{configId}}" + ], + "timeframe": "none", + "dataStream": { + "id": "datastream-properties", + "name": "properties", + "pluginConfigId": "{{configId}}" + }, + "scope": { + "scope": "{{scopes.[AI Apps]}}", + "variable": "{{variables.[AI App]}}", + "workspace": "{{workspaceId}}" + }, + "variables": [ + "{{variables.[AI App]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "application", + "title": "Application", + "renderer": { + "type": "text" + } + }, + { + "field": "interactionType", + "title": "Type", + "renderer": { + "type": "text" + } + } + ] + }, + "style": { + "richTableCellPadding": 6, + "richTableTranspose": true, + "richTableWrapText": true + } + } + } + } + }, + { + "i": "17e46efa-c20d-46c5-934b-fca7c6bc4bb9", + "x": 1, + "y": 0, + "w": 3, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Activity and Detections", + "description": "Interactions with this AI app in the dashboard timeframe, and the prompt injections, jailbreak attempts and DLP policy matches in them", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "time", + "appHost" + ], + "aiApps": { + "variable": "{{variables.[AI App]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[AI Apps]}}" + } + }, + "group": { + "by": [], + "aggregate": [ + { + "type": "sum", + "names": [ + "uniqueInteractions" + ] + }, + { + "type": "sum", + "names": [ + "xpiaDetections" + ] + }, + { + "type": "sum", + "names": [ + "jailbreakAttempts" + ] + }, + { + "type": "sum", + "names": [ + "dlpPolicyMatches" + ] + } + ] + } + }, + "variables": [ + "{{variables.[AI App]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [ + { + "field": "uniqueInteractions_sum", + "type": "quantitative", + "title": "Interactions" + }, + { + "field": "xpiaDetections_sum", + "type": "quantitative", + "title": "Prompt injections" + }, + { + "field": "jailbreakAttempts_sum", + "type": "quantitative", + "title": "Jailbreak attempts" + }, + { + "field": "dlpPolicyMatches_sum", + "type": "quantitative", + "title": "DLP policy matches" + } + ] + }, + "style": { + "scalarColumns": 4 + } + } + } + } + }, + { + "i": "c4a71d11-d7bb-46f8-9fa6-a534652b6c12", + "x": 0, + "y": 2, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Interactions over Time", + "description": "Interactions with this AI app in the dashboard timeframe, by the app it was used in", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "time", + "appHost" + ], + "aiApps": { + "variable": "{{variables.[AI App]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[AI Apps]}}" + } + } + }, + "variables": [ + "{{variables.[AI App]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "line", + "encoding": { + "x": { + "field": "timestamp", + "type": "temporal", + "title": "Time" + }, + "y": { + "field": "uniqueInteractions", + "type": "quantitative", + "title": "Interactions", + "aggregate": "sum" + }, + "series": { + "field": "appHost", + "type": "nominal", + "title": "App Host" + } + }, + "style": { + "cartesianAreaGradient": true, + "legendPosition": "bottom" + } + } + } + } + }, + { + "i": "3b72c817-0c4f-48fe-a421-303d3a377700", + "x": 2, + "y": 2, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Top Users", + "description": "The 10 people who used this AI app most in the dashboard timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "user" + ], + "top": 10, + "aiApps": { + "variable": "{{variables.[AI App]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[AI Apps]}}" + } + }, + "sort": { + "by": [ + [ + "uniqueInteractions", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[AI App]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "user", + "type": "nominal", + "title": "User" + }, + "y": { + "field": "uniqueInteractions", + "type": "quantitative", + "title": "Interactions" + } + }, + "style": { + "cartesianHorizontal": true, + "cartesianBarBorderRadius": 4, + "showLabels": true, + "colors": [ + "#8b5cf6" + ] + } + } + } + } + }, + { + "i": "7d2fbe8e-56ab-4d9a-ad3d-b3309e83ba41", + "x": 0, + "y": 5, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Labelled Data Reached", + "description": "The sensitivity labels on data this AI app reached in the dashboard timeframe, least to most sensitive. An interaction counts once for each label it reached", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "label" + ], + "aiApps": { + "variable": "{{variables.[AI App]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[AI Apps]}}" + } + }, + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "sensitivityLabelId", + "operation": "notempty" + } + ] + }, + "sort": { + "by": [ + [ + "labelPriority", + "asc" + ] + ] + } + }, + "variables": [ + "{{variables.[AI App]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "sensitivityLabel", + "type": "nominal", + "title": "Sensitivity Label" + }, + "y": [ + { + "field": "interactions", + "type": "quantitative", + "title": "Interactions" + }, + { + "field": "labelledResources", + "type": "quantitative", + "title": "Labelled resources" + } + ] + }, + "style": { + "cartesianBarBorderRadius": 4, + "legendPosition": "bottom", + "colors": [ + "#8b5cf6", + "#f97316" + ] + } + } + } + } + } + ] + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiRisk.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiRisk.dash.json new file mode 100644 index 000000000..7f5f26c50 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiRisk.dash.json @@ -0,0 +1,559 @@ +{ + "name": "AI Risk", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "5bb16b60-7e4b-4229-9187-d27081aa4c1d", + "x": 0, + "y": 0, + "w": 4, + "h": 1, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/text", + "title": "", + "description": "", + "visualisation": { + "config": { + "content": "AI interaction tiles come from advanced hunting and need the Microsoft Defender for Cloud Apps Microsoft 365 app connector with its Microsoft 365 activities component selected. They cover up to the last 30 days.", + "fontSize": 14, + "align": "left", + "autoSize": true + } + } + } + }, + { + "i": "f59ceb84-fe57-499e-89f4-38acd28aeb08", + "x": 0, + "y": 1, + "w": 2, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "AI Activity and Detections", + "description": "Copilot and AI app interactions in the dashboard timeframe, prompt injection (XPIA) detections in resources they read, jailbreak attempts, and resources that matched a DLP policy", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "time", + "aiApp" + ] + }, + "group": { + "by": [], + "aggregate": [ + { + "type": "sum", + "names": [ + "uniqueInteractions" + ] + }, + { + "type": "sum", + "names": [ + "xpiaDetections" + ] + }, + { + "type": "sum", + "names": [ + "jailbreakAttempts" + ] + }, + { + "type": "sum", + "names": [ + "dlpPolicyMatches" + ] + } + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [ + { + "field": "uniqueInteractions_sum", + "type": "quantitative", + "title": "Interactions" + }, + { + "field": "xpiaDetections_sum", + "type": "quantitative", + "title": "Prompt injections" + }, + { + "field": "jailbreakAttempts_sum", + "type": "quantitative", + "title": "Jailbreak attempts" + }, + { + "field": "dlpPolicyMatches_sum", + "type": "quantitative", + "title": "DLP policy matches" + } + ] + }, + "style": { + "scalarColumns": 4 + } + } + } + } + }, + { + "i": "f82d6e3f-f15b-4d46-9c66-b0dd59d96c51", + "x": 2, + "y": 1, + "w": 2, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Open Alerts by Source", + "description": "Security for AI, insider risk and data loss prevention alerts that are new or in progress, whenever they were raised", + "activePluginConfigIds": [], + "timeframe": "none", + "dataStream": { + "id": "datastream-sql", + "dataSourceConfig": { + "version": "2.0", + "sql": "SELECT COUNT(*) FILTER (WHERE \"serviceSource\" = 'Security for AI') AS \"securityForAi\", COUNT(*) FILTER (WHERE \"serviceSource\" = 'Insider risk management') AS \"insiderRisk\", COUNT(*) FILTER (WHERE \"serviceSource\" = 'Data loss prevention') AS \"dlp\" FROM \"alerts\"", + "tables": [ + { + "tableName": "alerts", + "config": { + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[alerts]}}", + "name": "alerts", + "dataSourceConfig": { + "status": [ + "new", + "inProgress" + ] + } + }, + "timeframe": "none" + } + } + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [ + { + "field": "securityForAi", + "type": "quantitative", + "title": "Security for AI" + }, + { + "field": "insiderRisk", + "type": "quantitative", + "title": "Insider risk" + }, + { + "field": "dlp", + "type": "quantitative", + "title": "Data loss prevention" + } + ] + }, + "style": { + "scalarColumns": 3 + } + } + } + } + }, + { + "i": "52ddf95f-ce5b-4b14-ba6e-3f7d502b107c", + "x": 0, + "y": 3, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "AI Interactions over Time", + "description": "Copilot and AI app interactions in the dashboard timeframe, by AI app", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "time", + "aiApp" + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "line", + "encoding": { + "x": { + "field": "timestamp", + "type": "temporal", + "title": "Time" + }, + "y": { + "field": "uniqueInteractions", + "type": "quantitative", + "title": "Interactions", + "aggregate": "sum" + }, + "series": { + "field": "aiApp", + "type": "nominal", + "title": "AI App" + } + }, + "style": { + "cartesianAreaGradient": true, + "legendPosition": "bottom" + } + } + } + } + }, + { + "i": "ddb51b88-f4d9-4274-ab2c-634ba72d8f08", + "x": 2, + "y": 3, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Labelled Data Reached by AI", + "description": "Interactions that reached labelled data in the dashboard timeframe, and the labelled resources they read, by sensitivity label in priority order (highest on the right). An interaction counts once for each label it reached", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "label" + ] + }, + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "sensitivityLabelId", + "operation": "notempty" + } + ] + }, + "sort": { + "by": [ + [ + "labelPriority", + "asc" + ] + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "sensitivityLabel", + "type": "nominal", + "title": "Sensitivity Label" + }, + "y": [ + { + "field": "interactions", + "type": "quantitative", + "title": "Interactions" + }, + { + "field": "labelledResources", + "type": "quantitative", + "title": "Labelled resources" + } + ] + }, + "style": { + "cartesianBarBorderRadius": 4, + "legendPosition": "bottom", + "colors": [ + "#8b5cf6", + "#f97316" + ] + } + } + } + } + }, + { + "i": "3ec8dd15-6a33-40e2-b3ee-07a7468c47b4", + "x": 0, + "y": 6, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Top AI Users", + "description": "The 10 people with the most Copilot and AI app interactions in the dashboard timeframe, the labelled resources their interactions read, and the risks detected in them", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "user" + ], + "top": 10 + }, + "sort": { + "by": [ + [ + "uniqueInteractions", + "desc" + ] + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "user", + "title": "User", + "renderer": { + "type": "text" + } + }, + { + "field": "uniqueInteractions", + "title": "Interactions", + "width": 110, + "align": "right", + "renderer": { + "type": "number" + } + }, + { + "field": "labelledResources", + "title": "Labelled Resources", + "renderer": { + "type": "bar", + "color": "#f97316" + } + }, + { + "field": "dlpPolicyMatches", + "title": "DLP Policy Matches", + "width": 150, + "align": "right", + "renderer": { + "type": "number" + } + }, + { + "field": "xpiaDetections", + "title": "Prompt Injections", + "width": 140, + "align": "right", + "renderer": { + "type": "number" + } + }, + { + "field": "jailbreakAttempts", + "title": "Jailbreak Attempts", + "width": 150, + "align": "right", + "renderer": { + "type": "number" + } + } + ] + }, + "style": { + "richTableCellPadding": 6 + } + } + } + } + }, + { + "i": "68a09791-1301-4135-b6e7-e6256e9eaee2", + "x": 0, + "y": 9, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "AI and Insider Risk Alerts", + "description": "Security for AI and insider risk management alerts raised in the dashboard timeframe, highest severity first. Select a row to open the alert in the Microsoft Purview portal", + "activePluginConfigIds": [], + "dataStream": { + "id": "datastream-sql", + "dataSourceConfig": { + "version": "2.0", + "sql": "SELECT UPPER(SUBSTR(\"severity[Expanded].rawState\", 1, 1)) || SUBSTR(\"severity[Expanded].rawState\", 2) AS \"severity\", \"title\", \"serviceSource\" AS \"source\", CASE \"status\" WHEN 'new' THEN 'New' WHEN 'inProgress' THEN 'In progress' WHEN 'resolved' THEN 'Resolved' ELSE \"status\" END AS \"status\", \"users\", COALESCE(\"assignedTo\", '') AS \"assignedTo\", \"createdDateTime\" AS \"created\", \"alertWebUrl\" AS \"link\" FROM \"alerts\" ORDER BY CASE \"severity[Expanded].rawState\" WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 ELSE 4 END, \"createdDateTime\" DESC", + "tables": [ + { + "tableName": "alerts", + "config": { + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[alerts]}}", + "name": "alerts", + "dataSourceConfig": { + "source": [ + "microsoftSecurityForAI", + "microsoftInsiderRiskManagement" + ] + } + } + } + } + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "severity", + "title": "Severity", + "width": 120, + "renderer": { + "type": "badge", + "colors": { + "High": "#ef4444", + "Medium": "#f59e0b", + "Low": "#3b82f6", + "Informational": "#6b7280" + } + } + }, + { + "field": "title", + "title": "Alert", + "renderer": { + "type": "text" + } + }, + { + "field": "source", + "title": "Source", + "width": 190, + "renderer": { + "type": "badge", + "colors": { + "Data loss prevention": "#3b82f6", + "Insider risk management": "#d97706", + "Security for AI": "#8b5cf6" + } + } + }, + { + "field": "status", + "title": "Status", + "width": 110, + "renderer": { + "type": "text" + } + }, + { + "field": "users", + "title": "Users", + "renderer": { + "type": "tag-list", + "color": "#6366f1" + } + }, + { + "field": "assignedTo", + "title": "Assigned To", + "renderer": { + "type": "text" + } + }, + { + "field": "created", + "title": "Created", + "width": 130, + "renderer": { + "type": "date", + "relative": true + } + } + ] + }, + "style": { + "richTableCellPadding": 6, + "richTableRowLinkField": "link" + } + } + } + } + } + ] + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/manifest.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/manifest.json new file mode 100644 index 000000000..81a82ed39 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/manifest.json @@ -0,0 +1,28 @@ +{ + "items": [ + { + "name": "overview", + "type": "dashboard" + }, + { + "name": "aiRisk", + "type": "dashboard" + }, + { + "name": "sensitivityLabel", + "type": "dashboard" + }, + { + "name": "user", + "type": "dashboard" + }, + { + "name": "aiApp", + "type": "dashboard" + }, + { + "name": "site", + "type": "dashboard" + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/overview.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/overview.dash.json new file mode 100644 index 000000000..fa921a88c --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/overview.dash.json @@ -0,0 +1,624 @@ +{ + "name": "Overview", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "760cba51-3876-49fc-8fae-b285a70231c8", + "x": 0, + "y": 0, + "w": 4, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Open Alerts", + "description": "Data loss prevention, insider risk and Security for AI alerts that are new or in progress, whenever they were raised, by severity, and how many have no one assigned", + "activePluginConfigIds": [], + "timeframe": "none", + "dataStream": { + "id": "datastream-sql", + "dataSourceConfig": { + "version": "2.0", + "sql": "SELECT COUNT(*) FILTER (WHERE \"severity[Expanded].rawState\" = 'high') AS \"high\", COUNT(*) FILTER (WHERE \"severity[Expanded].rawState\" = 'medium') AS \"medium\", COUNT(*) FILTER (WHERE \"severity[Expanded].rawState\" = 'low') AS \"low\", COUNT(*) FILTER (WHERE \"severity[Expanded].rawState\" = 'informational') AS \"informational\", COUNT(*) FILTER (WHERE \"assignedTo\" IS NULL OR \"assignedTo\" = '') AS \"unassigned\" FROM \"alerts\"", + "tables": [ + { + "tableName": "alerts", + "config": { + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[alerts]}}", + "name": "alerts", + "dataSourceConfig": { + "status": [ + "new", + "inProgress" + ] + } + }, + "timeframe": "none" + } + } + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [ + { + "field": "high", + "type": "quantitative", + "title": "High" + }, + { + "field": "medium", + "type": "quantitative", + "title": "Medium" + }, + { + "field": "low", + "type": "quantitative", + "title": "Low" + }, + { + "field": "informational", + "type": "quantitative", + "title": "Informational" + }, + { + "field": "unassigned", + "type": "quantitative", + "title": "Unassigned" + } + ] + }, + "style": { + "scalarColumns": 5 + } + } + } + } + }, + { + "i": "9c4183f6-fc1c-4efe-9c93-123902ec0a1d", + "x": 0, + "y": 2, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Alerts by Source", + "description": "Alerts raised each day in the dashboard timeframe, by the Purview solution that raised them", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[alerts]}}", + "name": "alerts", + "pluginConfigId": "{{configId}}", + "group": { + "by": [ + [ + "createdDateTime", + "byDay" + ], + [ + "serviceSource", + "uniqueValues" + ] + ], + "aggregate": [ + { + "type": "count" + } + ] + }, + "sort": { + "by": [ + [ + "createdDateTime_byDay", + "asc" + ] + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "createdDateTime_byDay", + "type": "temporal", + "title": "Created" + }, + "y": { + "field": "count", + "type": "quantitative", + "title": "Alerts" + }, + "series": { + "field": "serviceSource_uniqueValues", + "type": "nominal", + "title": "Source" + } + }, + "style": { + "cartesianStack": "on", + "cartesianBarBorderRadius": 2, + "legendPosition": "bottom", + "mappedColors": { + "Data loss prevention": "#3b82f6", + "Insider risk management": "#d97706", + "Security for AI": "#8b5cf6" + } + } + } + } + } + }, + { + "i": "8b21718b-7540-4e03-8d3e-93bfec993012", + "x": 2, + "y": 2, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Top Users in Alerts", + "description": "The users named in the most alerts raised in the dashboard timeframe", + "activePluginConfigIds": [], + "dataStream": { + "id": "datastream-sql", + "dataSourceConfig": { + "version": "2.0", + "sql": "SELECT REPLACE(TRIM(\"part\"), '\"', '') AS \"user\", CAST(COUNT(*) AS DOUBLE) AS \"alerts\" FROM (SELECT UNNEST(STRING_SPLIT(REPLACE(REPLACE(CAST(\"users\" AS VARCHAR), '[', ''), ']', ''), ',')) AS \"part\" FROM \"alerts\" WHERE \"users\" IS NOT NULL) WHERE REPLACE(TRIM(\"part\"), '\"', '') <> '' GROUP BY 1 ORDER BY 2 DESC, 1 LIMIT 10", + "tables": [ + { + "tableName": "alerts", + "config": { + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[alerts]}}", + "name": "alerts" + } + } + } + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "user", + "type": "nominal", + "title": "User" + }, + "y": { + "field": "alerts", + "type": "quantitative", + "title": "Alerts" + } + }, + "style": { + "cartesianHorizontal": true, + "cartesianBarBorderRadius": 4, + "showLabels": true, + "colors": [ + "#6366f1" + ] + } + } + } + } + }, + { + "i": "4308052a-1595-4f11-96ee-d82d20fae084", + "x": 0, + "y": 5, + "w": 4, + "h": 4, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Open Alert List", + "description": "Alerts that are new or in progress, whenever they were raised, highest severity first. Select a row to open the alert in the Microsoft Purview portal", + "activePluginConfigIds": [], + "timeframe": "none", + "dataStream": { + "id": "datastream-sql", + "dataSourceConfig": { + "version": "2.0", + "sql": "SELECT UPPER(SUBSTR(\"severity[Expanded].rawState\", 1, 1)) || SUBSTR(\"severity[Expanded].rawState\", 2) AS \"severity\", \"title\", \"serviceSource\" AS \"source\", CASE \"status\" WHEN 'new' THEN 'New' WHEN 'inProgress' THEN 'In progress' WHEN 'resolved' THEN 'Resolved' ELSE \"status\" END AS \"status\", \"users\", COALESCE(\"assignedTo\", '') AS \"assignedTo\", \"createdDateTime\" AS \"created\", \"alertWebUrl\" AS \"link\" FROM \"alerts\" ORDER BY CASE \"severity[Expanded].rawState\" WHEN 'high' THEN 1 WHEN 'medium' THEN 2 WHEN 'low' THEN 3 ELSE 4 END, \"createdDateTime\" DESC", + "tables": [ + { + "tableName": "alerts", + "config": { + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[alerts]}}", + "name": "alerts", + "dataSourceConfig": { + "status": [ + "new", + "inProgress" + ] + } + }, + "timeframe": "none" + } + } + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "severity", + "title": "Severity", + "width": 120, + "renderer": { + "type": "badge", + "colors": { + "High": "#ef4444", + "Medium": "#f59e0b", + "Low": "#3b82f6", + "Informational": "#6b7280" + } + } + }, + { + "field": "title", + "title": "Alert", + "renderer": { + "type": "text" + } + }, + { + "field": "source", + "title": "Source", + "width": 190, + "renderer": { + "type": "badge", + "colors": { + "Data loss prevention": "#3b82f6", + "Insider risk management": "#d97706", + "Security for AI": "#8b5cf6" + } + } + }, + { + "field": "status", + "title": "Status", + "width": 110, + "renderer": { + "type": "text" + } + }, + { + "field": "users", + "title": "Users", + "renderer": { + "type": "tag-list", + "color": "#6366f1" + } + }, + { + "field": "assignedTo", + "title": "Assigned To", + "renderer": { + "type": "text" + } + }, + { + "field": "created", + "title": "Created", + "width": 130, + "renderer": { + "type": "date", + "relative": true + } + } + ] + }, + "style": { + "richTableCellPadding": 6, + "richTableRowLinkField": "link", + "richTableRowHighlight": { + "field": "severity", + "colors": { + "High": "rgba(239,68,68,0.10)" + } + } + } + } + } + } + }, + { + "i": "dde6635c-9100-4191-9104-8199d88b7106", + "x": 0, + "y": 9, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Label Activity", + "description": "Sensitivity label events in the dashboard timeframe: labels applied, changed or removed, labelled files opened, and labelled email detected", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[labelActivity]}}", + "name": "labelActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "time", + "action" + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "timestamp", + "type": "temporal", + "title": "Time" + }, + "y": { + "field": "events", + "type": "quantitative", + "title": "Events", + "aggregate": "sum" + }, + "series": { + "field": "action", + "type": "nominal", + "title": "Action" + } + }, + "style": { + "cartesianStack": "on", + "cartesianBarBorderRadius": 2, + "legendPosition": "bottom", + "mappedColors": { + "Applied": "#22c55e", + "Changed": "#3b82f6", + "Upgraded": "#8b5cf6", + "Downgraded": "#f97316", + "Removed": "#ef4444", + "Change failed": "#b91c1c", + "Opened": "#06b6d4", + "Renamed": "#94a3b8", + "Detected in email": "#6366f1" + } + } + } + } + } + }, + { + "i": "a2374c8c-9da8-46f0-97c8-4e713f6fbe0d", + "x": 2, + "y": 9, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Top Sites by Anonymous Link Use", + "description": "The SharePoint sites and OneDrive accounts whose anonymous (Anyone) links were created or used most in the dashboard timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[fileActivity]}}", + "name": "fileActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "site" + ], + "categories": [ + "Anonymous link" + ], + "top": 10 + }, + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "siteUrl", + "operation": "notempty" + } + ] + }, + "sort": { + "by": [ + [ + "events", + "desc" + ] + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "site", + "type": "nominal", + "title": "Site" + }, + "y": { + "field": "events", + "type": "quantitative", + "title": "Events" + } + }, + "style": { + "cartesianHorizontal": true, + "cartesianBarBorderRadius": 4, + "showLabels": true, + "colors": [ + "#ec4899" + ] + } + } + } + } + }, + { + "i": "2f8ce4e9-a6e0-4b3f-a89a-8eaa1a29e808", + "x": 0, + "y": 12, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Sensitivity Labels", + "description": "The sensitivity labels published in the tenant, lowest priority first, with whether each applies encryption and the content it can be applied to", + "activePluginConfigIds": [ + "{{configId}}" + ], + "timeframe": "none", + "dataStream": { + "id": "{{dataStreams.[sensitivityLabels]}}", + "name": "sensitivityLabels", + "pluginConfigId": "{{configId}}", + "sort": { + "by": [ + [ + "sensitivity", + "asc" + ] + ] + } + }, + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "fullName", + "title": "Label", + "renderer": { + "type": "text" + } + }, + { + "field": "sensitivity", + "title": "Priority", + "width": 90, + "align": "right", + "renderer": { + "type": "number" + } + }, + { + "field": "color", + "title": "Colour", + "width": 100, + "renderer": { + "type": "text" + } + }, + { + "field": "hasProtection", + "title": "Encryption", + "width": 110, + "renderer": { + "type": "boolean", + "trueLabel": "Yes", + "falseLabel": "No", + "trueColor": "#22c55e", + "falseColor": "#64748b" + } + }, + { + "field": "isActive", + "title": "Active", + "width": 90, + "renderer": { + "type": "boolean", + "trueLabel": "Yes", + "falseLabel": "No", + "trueColor": "#22c55e", + "falseColor": "#64748b" + } + }, + { + "field": "contentFormats", + "title": "Applies To", + "renderer": { + "type": "tag-list", + "color": "#3b82f6" + } + }, + { + "field": "tooltip", + "title": "Description", + "renderer": { + "type": "text" + } + } + ] + }, + "style": { + "richTableCellPadding": 6, + "richTableHideCount": true + } + } + } + } + } + ] + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/scopes.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/scopes.json new file mode 100644 index 000000000..c20fb3c8b --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/scopes.json @@ -0,0 +1,70 @@ +[ + { + "name": "Sensitivity Labels", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Sensitivity Label" + ] + } + }, + "variable": { + "name": "Sensitivity Label", + "allowMultipleSelection": false, + "default": "none", + "type": "object" + } + }, + { + "name": "Users", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "User" + ] + } + }, + "variable": { + "name": "User", + "allowMultipleSelection": false, + "default": "none", + "type": "object" + } + }, + { + "name": "AI Apps", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "AI App" + ] + } + }, + "variable": { + "name": "AI App", + "allowMultipleSelection": false, + "default": "none", + "type": "object" + } + }, + { + "name": "Sites", + "matches": { + "sourceType": { + "type": "oneOf", + "values": [ + "Site" + ] + } + }, + "variable": { + "name": "Site", + "allowMultipleSelection": false, + "default": "none", + "type": "object" + } + } +] diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/sensitivityLabel.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/sensitivityLabel.dash.json new file mode 100644 index 000000000..2d1b69bc7 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/sensitivityLabel.dash.json @@ -0,0 +1,428 @@ +{ + "name": "Sensitivity Label", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [ + "{{variables.[Sensitivity Label]}}" + ], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "4f57bb9c-5184-40fe-88a2-9cb18c7714c0", + "x": 0, + "y": 0, + "w": 1, + "h": 4, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Label Details", + "description": "The label's settings in Microsoft Purview", + "activePluginConfigIds": [ + "{{configId}}" + ], + "timeframe": "none", + "dataStream": { + "id": "datastream-properties", + "name": "properties", + "pluginConfigId": "{{configId}}" + }, + "scope": { + "scope": "{{scopes.[Sensitivity Labels]}}", + "variable": "{{variables.[Sensitivity Label]}}", + "workspace": "{{workspaceId}}" + }, + "variables": [ + "{{variables.[Sensitivity Label]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "priority", + "title": "Priority", + "renderer": { + "type": "number" + } + }, + { + "field": "parentName", + "title": "Parent label", + "renderer": { + "type": "text" + } + }, + { + "field": "color", + "title": "Colour", + "renderer": { + "type": "text" + } + }, + { + "field": "isActive", + "title": "Active", + "renderer": { + "type": "boolean", + "trueLabel": "Yes", + "falseLabel": "No", + "trueColor": "#22c55e", + "falseColor": "#64748b" + } + }, + { + "field": "isAppliable", + "title": "Can be applied", + "renderer": { + "type": "boolean", + "trueLabel": "Yes", + "falseLabel": "No", + "trueColor": "#22c55e", + "falseColor": "#64748b" + } + }, + { + "field": "hasProtection", + "title": "Encryption", + "renderer": { + "type": "boolean", + "trueLabel": "Yes", + "falseLabel": "No", + "trueColor": "#22c55e", + "falseColor": "#64748b" + } + }, + { + "field": "contentFormats", + "title": "Applies to", + "renderer": { + "type": "tag-list", + "color": "#3b82f6" + } + }, + { + "field": "description", + "title": "Description", + "renderer": { + "type": "text" + } + } + ] + }, + "style": { + "richTableCellPadding": 6, + "richTableTranspose": true, + "richTableWrapText": true + } + } + } + } + }, + { + "i": "16cc1c6d-2882-48ac-ba0c-643e5775c823", + "x": 1, + "y": 0, + "w": 3, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "AI Activity", + "description": "Copilot and AI app interactions that reached data with this label in the dashboard timeframe, the resources with this label they read, and those that matched a DLP policy", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [], + "labels": { + "variable": "{{variables.[Sensitivity Label]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Sensitivity Labels]}}" + } + } + }, + "variables": [ + "{{variables.[Sensitivity Label]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [ + { + "field": "uniqueInteractions", + "type": "quantitative", + "title": "Interactions" + }, + { + "field": "labelledResources", + "type": "quantitative", + "title": "Resources read" + }, + { + "field": "dlpPolicyMatches", + "type": "quantitative", + "title": "DLP policy matches" + } + ] + }, + "style": { + "scalarColumns": 3 + } + } + } + } + }, + { + "i": "f919f0a7-79d5-4fc8-a18b-71071adc513e", + "x": 1, + "y": 2, + "w": 3, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Label Activity over Time", + "description": "Events for this label in the dashboard timeframe: applied, changed to or from it, removed, labelled files opened, and labelled email detected", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[labelActivity]}}", + "name": "labelActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "time", + "action" + ], + "labels": { + "variable": "{{variables.[Sensitivity Label]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Sensitivity Labels]}}" + } + } + }, + "variables": [ + "{{variables.[Sensitivity Label]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "timestamp", + "type": "temporal", + "title": "Time" + }, + "y": { + "field": "events", + "type": "quantitative", + "title": "Events", + "aggregate": "sum" + }, + "series": { + "field": "action", + "type": "nominal", + "title": "Action" + } + }, + "style": { + "cartesianStack": "on", + "cartesianBarBorderRadius": 2, + "legendPosition": "bottom", + "mappedColors": { + "Applied": "#22c55e", + "Changed": "#3b82f6", + "Upgraded": "#8b5cf6", + "Downgraded": "#f97316", + "Removed": "#ef4444", + "Change failed": "#b91c1c", + "Opened": "#06b6d4", + "Renamed": "#94a3b8", + "Detected in email": "#6366f1" + } + } + } + } + } + }, + { + "i": "1f46d9bc-1a08-4ab2-b701-f5171cf93642", + "x": 0, + "y": 4, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Top AI Users", + "description": "The people whose AI interactions most often reached data with this label in the dashboard timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "user" + ], + "top": 10, + "labels": { + "variable": "{{variables.[Sensitivity Label]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Sensitivity Labels]}}" + } + }, + "sort": { + "by": [ + [ + "uniqueInteractions", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[Sensitivity Label]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "user", + "type": "nominal", + "title": "User" + }, + "y": { + "field": "uniqueInteractions", + "type": "quantitative", + "title": "Interactions" + } + }, + "style": { + "cartesianHorizontal": true, + "cartesianBarBorderRadius": 4, + "showLabels": true, + "colors": [ + "#8b5cf6" + ] + } + } + } + } + }, + { + "i": "16126b08-6720-46c5-a7fb-b124e08d39b7", + "x": 2, + "y": 4, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Who Applies or Changes It", + "description": "The people who applied, changed or removed this label most in the dashboard timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[labelActivity]}}", + "name": "labelActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "user" + ], + "actions": [ + "Applied", + "Changed", + "Upgraded", + "Downgraded", + "Removed" + ], + "top": 10, + "labels": { + "variable": "{{variables.[Sensitivity Label]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Sensitivity Labels]}}" + } + }, + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "user", + "operation": "notempty" + } + ] + }, + "sort": { + "by": [ + [ + "events", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[Sensitivity Label]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "user", + "type": "nominal", + "title": "User" + }, + "y": { + "field": "events", + "type": "quantitative", + "title": "Events" + } + }, + "style": { + "cartesianHorizontal": true, + "cartesianBarBorderRadius": 4, + "showLabels": true, + "colors": [ + "#22c55e" + ] + } + } + } + } + } + ] + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json new file mode 100644 index 000000000..e28cf3b25 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json @@ -0,0 +1,395 @@ +{ + "name": "Site", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [ + "{{variables.[Site]}}" + ], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "7277f988-fea5-4ba6-8de9-1c74e714ce89", + "x": 0, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Site Details", + "description": "The SharePoint site or OneDrive account", + "activePluginConfigIds": [ + "{{configId}}" + ], + "timeframe": "none", + "dataStream": { + "id": "datastream-properties", + "name": "properties", + "pluginConfigId": "{{configId}}" + }, + "scope": { + "scope": "{{scopes.[Sites]}}", + "variable": "{{variables.[Site]}}", + "workspace": "{{workspaceId}}" + }, + "variables": [ + "{{variables.[Site]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "siteUrl", + "title": "URL", + "renderer": { + "type": "link" + } + }, + { + "field": "workload", + "title": "Workload", + "renderer": { + "type": "text" + } + } + ] + }, + "style": { + "richTableCellPadding": 6, + "richTableTranspose": true, + "richTableWrapText": true + } + } + } + } + }, + { + "i": "ddf140cf-e125-48a0-943c-dc5dd851109d", + "x": 1, + "y": 0, + "w": 3, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Site Activity", + "description": "File events on this site in the dashboard timeframe, and the distinct files they touched", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[fileActivity]}}", + "name": "fileActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [], + "sites": { + "variable": "{{variables.[Site]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Sites]}}" + } + } + }, + "variables": [ + "{{variables.[Site]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [ + { + "field": "events", + "type": "quantitative", + "title": "Events" + }, + { + "field": "files", + "type": "quantitative", + "title": "Files" + } + ] + }, + "style": { + "scalarColumns": 2 + } + } + } + } + }, + { + "i": "73b7c174-77e5-4486-ac47-45a622902307", + "x": 0, + "y": 2, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "File Activity over Time", + "description": "File activity on this site in the dashboard timeframe, by kind of activity", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[fileActivity]}}", + "name": "fileActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "time", + "category" + ], + "sites": { + "variable": "{{variables.[Site]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Sites]}}" + } + } + }, + "variables": [ + "{{variables.[Site]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "timestamp", + "type": "temporal", + "title": "Time" + }, + "y": { + "field": "events", + "type": "quantitative", + "title": "Events", + "aggregate": "sum" + }, + "series": { + "field": "category", + "type": "nominal", + "title": "Category" + } + }, + "style": { + "cartesianStack": "on", + "cartesianBarBorderRadius": 2, + "legendPosition": "bottom", + "mappedColors": { + "Access": "#3b82f6", + "Modify": "#8b5cf6", + "Create/Upload": "#22c55e", + "Download/Sync": "#06b6d4", + "Delete": "#ef4444", + "Share": "#f59e0b", + "Anonymous link": "#ec4899", + "Other": "#94a3b8" + } + } + } + } + } + }, + { + "i": "2c8d494a-13ba-49a2-8f80-bc3b5bf72bb1", + "x": 0, + "y": 5, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Sharing and Anonymous Links", + "description": "Who shared from this site and used its anonymous links most in the dashboard timeframe", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[fileActivity]}}", + "name": "fileActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "user", + "category" + ], + "categories": [ + "Share", + "Anonymous link" + ], + "top": 10, + "sites": { + "variable": "{{variables.[Site]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Sites]}}" + } + }, + "sort": { + "by": [ + [ + "events", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[Site]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "user", + "type": "nominal", + "title": "User" + }, + "y": { + "field": "events", + "type": "quantitative", + "title": "Events", + "aggregate": "sum" + }, + "series": { + "field": "category", + "type": "nominal", + "title": "Category" + } + }, + "style": { + "cartesianHorizontal": true, + "cartesianStack": "on", + "cartesianBarBorderRadius": 2, + "legendPosition": "bottom", + "mappedColors": { + "Share": "#f59e0b", + "Anonymous link": "#ec4899" + } + } + } + } + } + }, + { + "i": "c381f11f-72db-46e9-83b6-4441e0e38108", + "x": 2, + "y": 5, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Label Activity", + "description": "The most frequent sensitivity label events on this site's files in the dashboard timeframe, by person, action and label", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[labelActivity]}}", + "name": "labelActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "user", + "action", + "label" + ], + "top": 25, + "sites": { + "variable": "{{variables.[Site]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Sites]}}" + } + }, + "sort": { + "by": [ + [ + "events", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[Site]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "user", + "title": "User", + "renderer": { + "type": "text" + } + }, + { + "field": "action", + "title": "Action", + "width": 130, + "renderer": { + "type": "badge", + "colors": { + "Applied": "#22c55e", + "Changed": "#3b82f6", + "Upgraded": "#8b5cf6", + "Downgraded": "#f97316", + "Removed": "#ef4444", + "Change failed": "#b91c1c", + "Opened": "#06b6d4", + "Renamed": "#94a3b8", + "Detected in email": "#6366f1" + } + } + }, + { + "field": "sensitivityLabel", + "title": "Label", + "renderer": { + "type": "text" + } + }, + { + "field": "events", + "title": "Events", + "width": 80, + "align": "right", + "renderer": { + "type": "number" + } + } + ] + }, + "style": { + "richTableCellPadding": 6 + } + } + } + } + } + ] + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json new file mode 100644 index 000000000..fb915ffdb --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json @@ -0,0 +1,527 @@ +{ + "name": "User", + "schemaVersion": "1.5", + "timeframe": "last7days", + "variables": [ + "{{variables.[User]}}" + ], + "dashboard": { + "_type": "layout/grid", + "columns": 4, + "version": 1, + "contents": [ + { + "i": "6f17b3ee-30c8-466e-b08e-6cc47638138b", + "x": 0, + "y": 0, + "w": 1, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "User Details", + "description": "The user's identity in Microsoft Entra ID", + "activePluginConfigIds": [ + "{{configId}}" + ], + "timeframe": "none", + "dataStream": { + "id": "datastream-properties", + "name": "properties", + "pluginConfigId": "{{configId}}" + }, + "scope": { + "scope": "{{scopes.[Users]}}", + "variable": "{{variables.[User]}}", + "workspace": "{{workspaceId}}" + }, + "variables": [ + "{{variables.[User]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "userPrincipalName", + "title": "User principal name", + "renderer": { + "type": "text" + } + }, + { + "field": "entraObjectId", + "title": "Entra object ID", + "renderer": { + "type": "text" + } + } + ] + }, + "style": { + "richTableCellPadding": 6, + "richTableTranspose": true, + "richTableWrapText": true + } + } + } + } + }, + { + "i": "5bac23be-d6b1-411b-8a74-5faa67d4a9dd", + "x": 1, + "y": 0, + "w": 3, + "h": 2, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "AI Activity", + "description": "This user's Copilot and AI app interactions in the dashboard timeframe, the labelled resources they reached, and the risks detected in them", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "label" + ], + "users": { + "variable": "{{variables.[User]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Users]}}" + } + }, + "group": { + "by": [], + "aggregate": [ + { + "type": "sum", + "names": [ + "uniqueInteractions" + ] + }, + { + "type": "sum", + "names": [ + "labelledResources" + ] + }, + { + "type": "sum", + "names": [ + "dlpPolicyMatches" + ] + }, + { + "type": "sum", + "names": [ + "xpiaDetections" + ] + }, + { + "type": "sum", + "names": [ + "jailbreakAttempts" + ] + } + ] + } + }, + "variables": [ + "{{variables.[User]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "scalar", + "encoding": { + "values": [ + { + "field": "uniqueInteractions_sum", + "type": "quantitative", + "title": "Interactions" + }, + { + "field": "labelledResources_sum", + "type": "quantitative", + "title": "Labelled resources" + }, + { + "field": "dlpPolicyMatches_sum", + "type": "quantitative", + "title": "DLP policy matches" + }, + { + "field": "xpiaDetections_sum", + "type": "quantitative", + "title": "Prompt injections" + }, + { + "field": "jailbreakAttempts_sum", + "type": "quantitative", + "title": "Jailbreak attempts" + } + ] + }, + "style": { + "scalarColumns": 5 + } + } + } + } + }, + { + "i": "65958dd9-fb61-4344-b84f-f3461c425d71", + "x": 0, + "y": 2, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Labelled Data Reached by AI", + "description": "The sensitivity labels on data this user's AI interactions reached in the dashboard timeframe, least to most sensitive. An interaction counts once for each label it reached", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[aiInteractions]}}", + "name": "aiInteractions", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "label" + ], + "users": { + "variable": "{{variables.[User]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Users]}}" + } + }, + "filter": { + "multiOperation": "and", + "filters": [ + { + "column": "sensitivityLabelId", + "operation": "notempty" + } + ] + }, + "sort": { + "by": [ + [ + "labelPriority", + "asc" + ] + ] + } + }, + "variables": [ + "{{variables.[User]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "sensitivityLabel", + "type": "nominal", + "title": "Sensitivity Label" + }, + "y": [ + { + "field": "interactions", + "type": "quantitative", + "title": "Interactions" + }, + { + "field": "labelledResources", + "type": "quantitative", + "title": "Labelled resources" + } + ] + }, + "style": { + "cartesianBarBorderRadius": 4, + "legendPosition": "bottom", + "colors": [ + "#8b5cf6", + "#f97316" + ] + } + } + } + } + }, + { + "i": "5bb72324-1c8d-42fe-b20f-6b08230c14a3", + "x": 2, + "y": 2, + "w": 2, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "File Activity by Category", + "description": "This user's SharePoint and OneDrive activity in the dashboard timeframe, by kind of activity", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[fileActivity]}}", + "name": "fileActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "category" + ], + "users": { + "variable": "{{variables.[User]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Users]}}" + } + }, + "sort": { + "by": [ + [ + "events", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[User]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "category", + "type": "nominal", + "title": "Category" + }, + "y": { + "field": "events", + "type": "quantitative", + "title": "Events" + } + }, + "style": { + "cartesianHorizontal": true, + "cartesianBarBorderRadius": 4, + "showLabels": true, + "colors": [ + "#3b82f6" + ] + } + } + } + } + }, + { + "i": "c9ad69f7-edc4-47ee-9b36-33f42fc01d09", + "x": 0, + "y": 5, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Label Activity", + "description": "Sensitivity label events by this user in the dashboard timeframe: labels applied, changed or removed, labelled files opened, and labelled email detected", + "activePluginConfigIds": [ + "{{configId}}" + ], + "dataStream": { + "id": "{{dataStreams.[labelActivity]}}", + "name": "labelActivity", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "groupBy": [ + "time", + "action" + ], + "users": { + "variable": "{{variables.[User]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Users]}}" + } + } + }, + "variables": [ + "{{variables.[User]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "bar", + "encoding": { + "x": { + "field": "timestamp", + "type": "temporal", + "title": "Time" + }, + "y": { + "field": "events", + "type": "quantitative", + "title": "Events", + "aggregate": "sum" + }, + "series": { + "field": "action", + "type": "nominal", + "title": "Action" + } + }, + "style": { + "cartesianStack": "on", + "cartesianBarBorderRadius": 2, + "legendPosition": "bottom", + "mappedColors": { + "Applied": "#22c55e", + "Changed": "#3b82f6", + "Upgraded": "#8b5cf6", + "Downgraded": "#f97316", + "Removed": "#ef4444", + "Change failed": "#b91c1c", + "Opened": "#06b6d4", + "Renamed": "#94a3b8", + "Detected in email": "#6366f1" + } + } + } + } + } + }, + { + "i": "1258a8e1-e856-4463-9031-5ef36c982e2a", + "x": 0, + "y": 8, + "w": 4, + "h": 3, + "moved": false, + "static": false, + "z": 0, + "config": { + "_type": "tile/data-stream", + "title": "Alerts Naming This User", + "description": "Data loss prevention, insider risk and Security for AI alerts with this user in their evidence, created in the last 30 days", + "activePluginConfigIds": [ + "{{configId}}" + ], + "timeframe": "last30days", + "dataStream": { + "id": "{{dataStreams.[alerts]}}", + "name": "alerts", + "pluginConfigId": "{{configId}}", + "dataSourceConfig": { + "users": { + "variable": "{{variables.[User]}}", + "workspace": "{{workspaceId}}", + "scope": "{{scopes.[Users]}}" + } + }, + "sort": { + "by": [ + [ + "createdDateTime", + "desc" + ] + ] + } + }, + "variables": [ + "{{variables.[User]}}" + ], + "vizSpec": { + "version": "1.0", + "visualization": { + "chartType": "richTable", + "encoding": { + "columns": [ + { + "field": "severity", + "title": "Severity", + "width": 80, + "renderer": { + "type": "status", + "showLabel": false + } + }, + { + "field": "title", + "title": "Alert", + "renderer": { + "type": "text" + } + }, + { + "field": "serviceSource", + "title": "Source", + "width": 190, + "renderer": { + "type": "badge", + "colors": { + "Data loss prevention": "#3b82f6", + "Insider risk management": "#d97706", + "Security for AI": "#8b5cf6" + } + } + }, + { + "field": "status", + "title": "Status", + "width": 110, + "renderer": { + "type": "text" + } + }, + { + "field": "assignedTo", + "title": "Assigned To", + "renderer": { + "type": "text" + } + }, + { + "field": "createdDateTime", + "title": "Created", + "width": 130, + "renderer": { + "type": "date", + "relative": true + } + } + ] + }, + "style": { + "richTableCellPadding": 6, + "richTableRowLinkField": "alertWebUrl" + } + } + } + } + } + ] + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/docs/README.md b/plugins/MicrosoftPurviewDataSecurity/v1/docs/README.md new file mode 100644 index 000000000..b5d1c009d --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/docs/README.md @@ -0,0 +1,74 @@ +Monitor [Microsoft Purview](https://learn.microsoft.com/en-us/purview/purview) data security in SquaredUp: data loss prevention, insider risk and AI security alerts, the sensitivity labels defined in your tenant, and the sensitive data that Microsoft 365 Copilot and other AI apps reach. Data comes from [Microsoft Graph](https://learn.microsoft.com/en-us/graph/api/resources/security-api-overview). + +> ⚠️ This plugin covers Purview data security. For the Purview Data Map and Unified Catalog, use the **Microsoft Purview Data Governance** plugin. + +## Setup + +You need an app registration in Microsoft Entra ID with a client secret, and a Global Administrator or Privileged Role Administrator to grant admin consent. + +1. In the [Microsoft Entra admin center](https://entra.microsoft.com), go to **Identity** > **Applications** > **App registrations** and select **New registration**. Give it a name, leave the defaults, and select **Register**. +2. On the app's **Overview** page, copy the **Directory (tenant) ID** and **Application (client) ID**. +3. Go to **API permissions** > **Add a permission** > **Microsoft Graph** > **Application permissions**, and add: + + | Permission | Needed for | + | --- | --- | + | `InformationProtectionPolicy.Read.All` | Sensitivity labels | + | `SecurityAlert.Read.All` | Data loss prevention, insider risk and AI security alerts | + | `ThreatHunting.Read.All` | AI interactions (advanced hunting) | + +4. Select **Grant admin consent for** your organization. See [Grant tenant-wide admin consent](https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/grant-admin-consent). +5. Go to **Certificates & secrets** > **Client secrets** > **New client secret**, and copy the secret's **Value**. It's shown only once. +6. Enter the three values in SquaredUp. + +## Configuration fields + +| Field | What it is | Where to find it | Required | +| --- | --- | --- | --- | +| **Directory (tenant) ID** | Your Microsoft Entra tenant. | App registration > **Overview**. | Yes | +| **Application (client) ID** | The app registration the plugin signs in as. | App registration > **Overview**. | Yes | +| **Client secret** | The app's secret. | App registration > **Certificates & secrets**. | Yes | + +On save, the plugin reads your sensitivity labels to check the credentials, then checks that it can read alerts and find AI interactions. A failed check is a warning, not a blocker: it tells you which tiles will be empty. + +## What this plugin monitors + +- **Purview alerts**: alerts from [data loss prevention](https://learn.microsoft.com/en-us/purview/dlp-learn-about-dlp), [insider risk management](https://learn.microsoft.com/en-us/purview/insider-risk-management) and Security for AI policies, with severity, status, assignee, and the users and files involved. +- **Sensitivity labels**: the labels defined in your tenant, with their priority, colour, encryption and where they apply. +- **AI interactions**: how people use Microsoft 365 Copilot and other AI apps, and the labelled data those interactions reach, including resources that matched a DLP policy, cross-prompt injection (XPIA) detections and jailbreak attempts. +- **Label activity**: labels applied, changed, upgraded, downgraded or removed, labelled files opened, and labels detected in email, by user, label, app and site. +- **File and sharing activity**: SharePoint and OneDrive file access, changes, downloads, sharing and anonymous link use, by user and site. + +The out-of-the-box dashboards are an **Overview** of alerts, labels and sharing, an **AI Risk** dashboard, and perspectives for each **Sensitivity Label**, **User**, **AI App** and **Site**. + +## Data streams + +- **Alerts**: Purview alerts, filtered by source, severity, status and user, with a choice of which date the timeframe applies to. Account-wide. +- **Sensitivity Labels**: the label catalogue. Account-wide. +- **AI Interactions**: Copilot and AI app interactions summarised by time, user, AI app, the app it was used in, and sensitivity label, with counts of resources read, labelled resources, DLP policy matches, XPIA detections and jailbreak attempts. Account-wide, or filtered to chosen sensitivity labels, users or AI apps. +- **Label Activity**: sensitivity label events summarised by time, user, label, previous label, action, app and site, with event and item counts. Account-wide, or filtered to chosen sensitivity labels, users or sites. +- **File Activity**: SharePoint and OneDrive activity summarised by time, user, site, activity and category (access, modify, create or upload, download or sync, delete, share, anonymous link), with event and file counts. Account-wide, or filtered to chosen sites or users. +- **Cloud App Events Query**: your own KQL, continuing from the advanced hunting `CloudAppEvents` table already filtered to the tile's timeframe. Start the query with a pipe, for example `| where ActionType == 'FileDownloaded' | summarize Downloads = count() by Application`. + +**AI Interactions**, **Label Activity** and **File Activity** have a **Group by** option that sets which dimensions each row represents, such as time, user, label, site or action. They return one row per group, already counted, so keep it to the dimensions a tile needs. **Top** keeps only the largest groups, and **Label Activity** and **File Activity** can also be filtered by action or category. + +## What gets indexed + +| Object type | API source | Represents | +| --- | --- | --- | +| **Sensitivity Label** | `GET beta/security/informationProtection/sensitivityLabels` | A sensitivity label defined in the tenant. Sublabels are named `Parent / Sublabel`. | +| **User** | Advanced hunting `IdentityInfo` | A Microsoft Entra user, including guests, with department, job title and account state. Keyed by Microsoft Entra object ID, with `userPrincipalName` and `entraObjectId` properties for matching users from other Microsoft plugins. | +| **AI App** | Advanced hunting `CloudAppEvents` | A Copilot experience or AI app used in the last 30 days, such as `Copilot.M365Copilot.WebChat`. | +| **Site** | Advanced hunting `CloudAppEvents` | A SharePoint site or OneDrive with activity in the last 30 days, named by its path. | + +## Known limitations + +- **AI interactions, label activity, file activity, AI apps and sites need Microsoft Defender for Cloud Apps.** They come from the advanced hunting `CloudAppEvents` table, which is only populated when the Defender for Cloud Apps **Microsoft 365** app connector has its **Microsoft 365 activities** component selected. A connector can show as connected with that component off: check it in the [Microsoft Defender portal](https://security.microsoft.com) under **Settings** > **SaaS security** > **App Connectors** > **Microsoft 365** > **Edit settings**. Without it, those tiles are empty, only labels and users are imported, and the **AI interactions** check warns on save. +- **AI interactions, label activity and file activity cover up to 30 days**, the advanced hunting retention period. Timeframes longer than the last 30 days aren't offered. +- **AI apps and sites come from recent activity.** They're imported from the last 30 days of `CloudAppEvents`, so an app or site with no recent activity drops out at the next import. These import steps need Defender for Cloud Apps; users come from the advanced hunting `IdentityInfo` table instead. +- **Advanced hunting queries are slow.** Every query on `CloudAppEvents` takes several seconds, however simple, and Microsoft Graph rate-limits requests per tenant (we saw 20 calls a minute while testing). Keep dashboards to a few AI, label and file activity tiles, use **Group by** to return only the rows a tile needs, and prefer shorter timeframes. +- **An interaction counts under every sensitivity label it reached.** The **Interactions** column is per label, so adding it up across labels counts an interaction that reached several labels more than once. Use **Unique Interactions** for totals: it counts each interaction once. +- **Alerts only appear for policies you have configured.** Data loss prevention, insider risk and Security for AI alerts are raised by your own Purview policies, and are read from the same Microsoft Graph alerts API as the Microsoft Defender portal. +- **Sensitivity labels come from a Microsoft Graph beta endpoint**, because the v1.0 equivalent returned an error with application permissions. Microsoft may change beta endpoints without notice. +- **Policies, cases and reports aren't included.** Microsoft Graph has no API for DLP or insider risk policies, insider risk cases, or Data Security Posture Management reports. +- **Audit search isn't used.** Purview audit search is asynchronous and can take hours to return, which is too slow for dashboards. +- **Custom queries can read any advanced hunting table.** The **Cloud App Events Query** stream starts from `CloudAppEvents`, but KQL can join or union other tables the `ThreatHunting.Read.All` permission allows, such as email or device events. Anyone who can edit tiles on the data source can run them. diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/icon.svg b/plugins/MicrosoftPurviewDataSecurity/v1/icon.svg new file mode 100644 index 000000000..ff2c0b0ec --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/icon.svg @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/indexDefinitions/default.json b/plugins/MicrosoftPurviewDataSecurity/v1/indexDefinitions/default.json new file mode 100644 index 000000000..508b8dc93 --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/indexDefinitions/default.json @@ -0,0 +1,199 @@ +{ + "steps": [ + { + "name": "Sensitivity labels", + "dataStream": { + "name": "sensitivityLabels" + }, + "timeframe": "none", + "objectMapping": { + "id": "id", + "name": "fullName", + "type": { + "value": "Sensitivity Label" + }, + "properties": [ + { + "priority": "sensitivity" + }, + "color", + "parentName", + "isActive", + "isAppliable", + "hasProtection", + "contentFormats", + { + "description": "tooltip" + } + ] + } + }, + { + "name": "Users (1)", + "dataStream": { + "name": "importUsers", + "config": { + "shardIndex": "0" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "entraObjectId", + "name": "displayName", + "type": { + "value": "User" + }, + "properties": [ + "userPrincipalName", + "entraObjectId", + "department", + "jobTitle", + "accountEnabled", + "userType" + ] + } + }, + { + "name": "Users (2)", + "dataStream": { + "name": "importUsers", + "config": { + "shardIndex": "1" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "entraObjectId", + "name": "displayName", + "type": { + "value": "User" + }, + "properties": [ + "userPrincipalName", + "entraObjectId", + "department", + "jobTitle", + "accountEnabled", + "userType" + ] + } + }, + { + "name": "Users (3)", + "dataStream": { + "name": "importUsers", + "config": { + "shardIndex": "2" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "entraObjectId", + "name": "displayName", + "type": { + "value": "User" + }, + "properties": [ + "userPrincipalName", + "entraObjectId", + "department", + "jobTitle", + "accountEnabled", + "userType" + ] + } + }, + { + "name": "Users (4)", + "dataStream": { + "name": "importUsers", + "config": { + "shardIndex": "3" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "entraObjectId", + "name": "displayName", + "type": { + "value": "User" + }, + "properties": [ + "userPrincipalName", + "entraObjectId", + "department", + "jobTitle", + "accountEnabled", + "userType" + ] + } + }, + { + "name": "AI apps", + "dataStream": { + "name": "importAiApps" + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "appId", + "name": "appId", + "type": { + "value": "AI App" + }, + "properties": [ + "application", + "interactionType" + ] + } + }, + { + "name": "Sites (1)", + "dataStream": { + "name": "importSites", + "config": { + "shardIndex": "0" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "siteUrl", + "name": "name", + "type": { + "value": "Site" + }, + "properties": [ + "siteUrl", + "workload" + ] + } + }, + { + "name": "Sites (2)", + "dataStream": { + "name": "importSites", + "config": { + "shardIndex": "1" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "siteUrl", + "name": "name", + "type": { + "value": "Site" + }, + "properties": [ + "siteUrl", + "workload" + ] + } + } + ] +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/metadata.json b/plugins/MicrosoftPurviewDataSecurity/v1/metadata.json new file mode 100644 index 000000000..150504f9a --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/metadata.json @@ -0,0 +1,81 @@ +{ + "name": "purview-data-security", + "displayName": "Microsoft Purview Data Security", + "version": "1.0.0", + "author": { + "name": "SquaredUp Labs", + "type": "labs" + }, + "description": "Track Microsoft Purview data loss prevention, insider risk and AI security alerts, sensitivity label use, file sharing, and the sensitive data Copilot and AI apps reach.", + "category": "Security", + "type": "hybrid", + "schemaVersion": "2.1", + "importNotSupported": false, + "restrictedToPlatforms": [], + "keywords": [ + "purview", + "microsoft", + "data security", + "dlp", + "data loss prevention", + "insider risk", + "information protection", + "sensitivity labels", + "copilot", + "ai", + "dspm", + "sharepoint", + "onedrive", + "oversharing" + ], + "objectTypes": [ + "Sensitivity Label", + "User", + "AI App", + "Site" + ], + "links": [ + { + "category": "documentation", + "url": "https://github.com/squaredup/plugins/blob/main/plugins/MicrosoftPurviewDataSecurity/v1/docs/README.md", + "label": "Help adding this plugin" + }, + { + "category": "source", + "url": "https://github.com/squaredup/plugins/tree/main/plugins/MicrosoftPurviewDataSecurity/v1", + "label": "Repository" + } + ], + "base": { + "plugin": "WebAPI", + "majorVersion": "1", + "config": { + "baseUrl": "https://graph.microsoft.com/", + "authMode": "oauth2", + "oauth2GrantType": "clientCredentials", + "oauth2TokenUrl": "https://login.microsoftonline.com/{{tenantId}}/oauth2/v2.0/token", + "oauth2ClientId": "{{clientId}}", + "oauth2ClientSecret": "{{clientSecret}}", + "oauth2ClientSecretLocationDuringAuth": "body", + "oauth2Scope": "https://graph.microsoft.com/.default", + "oauth2TokenExtraArgs": [ + { + "key": "grant_type", + "value": "client_credentials" + }, + { + "key": "scope", + "value": "https://graph.microsoft.com/.default" + } + ], + "oauth2TokenExtraHeaders": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "headers": [], + "queryArgs": [] + } + } +} diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/ui.json b/plugins/MicrosoftPurviewDataSecurity/v1/ui.json new file mode 100644 index 000000000..f7a3986fe --- /dev/null +++ b/plugins/MicrosoftPurviewDataSecurity/v1/ui.json @@ -0,0 +1,29 @@ +[ + { + "type": "text", + "name": "tenantId", + "label": "Directory (tenant) ID", + "placeholder": "Enter a directory (tenant) ID", + "validation": { + "required": true + } + }, + { + "type": "text", + "name": "clientId", + "label": "Application (client) ID", + "placeholder": "Enter an application (client) ID", + "validation": { + "required": true + } + }, + { + "type": "password", + "name": "clientSecret", + "label": "Client secret", + "placeholder": "Enter a client secret", + "validation": { + "required": true + } + } +] From e35fd9965b3c54433481bbb48221c1ac6c63fa0f Mon Sep 17 00:00:00 2001 From: Adam Kinniburgh Date: Thu, 26 Nov 2026 10:44:26 +0000 Subject: [PATCH 2/5] fix(review): address CodeRabbit round 1 --- .../v1/dataStreams/importSites.json | 2 +- .../v1/dataStreams/importUsers.json | 2 +- .../v1/dataStreams/sensitivityLabels.json | 10 +- .../v1/defaultContent/site.dash.json | 1 - .../v1/defaultContent/user.dash.json | 3 +- .../v1/docs/README.md | 1 + .../v1/indexDefinitions/default.json | 148 ++++++++++++++++++ 7 files changed, 160 insertions(+), 7 deletions(-) diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importSites.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importSites.json index f8e3b30a0..8f784a384 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importSites.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importSites.json @@ -14,7 +14,7 @@ "expandInnerObjects": false, "endpointPath": "v1.0/security/runHuntingQuery", "postBody": { - "Query": "CloudAppEvents | where Timestamp > ago(30d) | where Application in ('Microsoft SharePoint Online', 'Microsoft OneDrive for Business') | extend rawSite = trim_end('/', tostring(RawEventData.SiteUrl)) | where isnotempty(rawSite) | extend siteUrl = tolower(rawSite) | where hash(siteUrl, 2) == {{shardIndex}} | summarize arg_max(Timestamp, rawSite, Application) by siteUrl | extend path = trim('/', tostring(parse_url(rawSite).Path)) | project siteUrl, name = iff(isempty(path), tostring(parse_url(rawSite).Host), path), workload = iff(Application has 'OneDrive', 'OneDrive', 'SharePoint')" + "Query": "CloudAppEvents | where Timestamp > ago(30d) | where Application in ('Microsoft SharePoint Online', 'Microsoft OneDrive for Business') | extend rawSite = trim_end('/', tostring(RawEventData.SiteUrl)) | where isnotempty(rawSite) | extend siteUrl = tolower(rawSite) | where hash(siteUrl, 4) == {{shardIndex}} | summarize arg_max(Timestamp, rawSite, Application) by siteUrl | extend path = trim('/', tostring(parse_url(rawSite).Path)) | project siteUrl, name = iff(isempty(path), tostring(parse_url(rawSite).Host), path), workload = iff(Application has 'OneDrive', 'OneDrive', 'SharePoint')" }, "pathToData": "results", "getArgs": [], diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importUsers.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importUsers.json index fe128424b..93af078ec 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importUsers.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/importUsers.json @@ -14,7 +14,7 @@ "expandInnerObjects": false, "endpointPath": "v1.0/security/runHuntingQuery", "postBody": { - "Query": "IdentityInfo | where Timestamp > ago(14d) | where isnotempty(AccountObjectId) and isnotempty(AccountUpn) and Type == 'User' | extend entraObjectId = tolower(AccountObjectId) | where hash(entraObjectId, 4) == {{shardIndex}} | summarize arg_max(Timestamp, AccountUpn, AccountDisplayName, Department, JobTitle, IsAccountEnabled) by entraObjectId | project entraObjectId, displayName = iff(isempty(AccountDisplayName), tolower(AccountUpn), AccountDisplayName), userPrincipalName = tolower(AccountUpn), department = Department, jobTitle = JobTitle, accountEnabled = IsAccountEnabled, userType = iff(AccountUpn contains '#ext#', 'Guest', 'Member')" + "Query": "IdentityInfo | where Timestamp > ago(14d) | where isnotempty(AccountObjectId) and isnotempty(AccountUpn) and Type == 'User' | extend entraObjectId = tolower(AccountObjectId), membership = column_ifexists('TenantMembershipType', '') | where hash(entraObjectId, 8) == {{shardIndex}} | summarize arg_max(Timestamp, AccountUpn, AccountDisplayName, Department, JobTitle, IsAccountEnabled, membership) by entraObjectId | project entraObjectId, displayName = iff(isempty(AccountDisplayName), tolower(AccountUpn), AccountDisplayName), userPrincipalName = tolower(AccountUpn), department = Department, jobTitle = JobTitle, accountEnabled = IsAccountEnabled, userType = iff(isnotempty(membership), membership, iff(AccountUpn contains '#ext#', 'Guest', 'Member'))" }, "pathToData": "results", "getArgs": [], diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/sensitivityLabels.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/sensitivityLabels.json index 44d4da791..f4bf70a94 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/sensitivityLabels.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/sensitivityLabels.json @@ -49,7 +49,7 @@ "shape": "string", "role": "label", "computed": true, - "valueExpression": "{{ ($['parent.name'] || ($['parent'] && $['parent'].name)) ? ($['parent.name'] || $['parent'].name) + ' / ' + $['name'] : $['name'] }}" + "valueExpression": "{{ typeof $['parent.name'] === 'string' && $['parent.name'] ? $['parent.name'] + ' / ' + $['name'] : $['name'] }}" }, { "name": "name", @@ -57,12 +57,18 @@ "shape": "string", "visible": false }, + { + "name": "parent.name", + "displayName": "Parent Label Name", + "shape": "string", + "visible": false + }, { "name": "parentName", "displayName": "Parent Label", "shape": "string", "computed": true, - "valueExpression": "{{ $['parent.name'] || ($['parent'] && $['parent'].name) || null }}" + "valueExpression": "{{ typeof $['parent.name'] === 'string' && $['parent.name'] ? $['parent.name'] : null }}" }, { "name": "sensitivity", diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json index e28cf3b25..e41d44693 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json @@ -233,7 +233,6 @@ "Share", "Anonymous link" ], - "top": 10, "sites": { "variable": "{{variables.[Site]}}", "workspace": "{{workspaceId}}", diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json index fb915ffdb..150a79e02 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json @@ -425,11 +425,10 @@ "config": { "_type": "tile/data-stream", "title": "Alerts Naming This User", - "description": "Data loss prevention, insider risk and Security for AI alerts with this user in their evidence, created in the last 30 days", + "description": "Data loss prevention, insider risk and Security for AI alerts with this user in their evidence, created in the dashboard timeframe", "activePluginConfigIds": [ "{{configId}}" ], - "timeframe": "last30days", "dataStream": { "id": "{{dataStreams.[alerts]}}", "name": "alerts", diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/docs/README.md b/plugins/MicrosoftPurviewDataSecurity/v1/docs/README.md index b5d1c009d..7cb769c58 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/docs/README.md +++ b/plugins/MicrosoftPurviewDataSecurity/v1/docs/README.md @@ -65,6 +65,7 @@ The out-of-the-box dashboards are an **Overview** of alerts, labels and sharing, - **AI interactions, label activity, file activity, AI apps and sites need Microsoft Defender for Cloud Apps.** They come from the advanced hunting `CloudAppEvents` table, which is only populated when the Defender for Cloud Apps **Microsoft 365** app connector has its **Microsoft 365 activities** component selected. A connector can show as connected with that component off: check it in the [Microsoft Defender portal](https://security.microsoft.com) under **Settings** > **SaaS security** > **App Connectors** > **Microsoft 365** > **Edit settings**. Without it, those tiles are empty, only labels and users are imported, and the **AI interactions** check warns on save. - **AI interactions, label activity and file activity cover up to 30 days**, the advanced hunting retention period. Timeframes longer than the last 30 days aren't offered. - **AI apps and sites come from recent activity.** They're imported from the last 30 days of `CloudAppEvents`, so an app or site with no recent activity drops out at the next import. These import steps need Defender for Cloud Apps; users come from the advanced hunting `IdentityInfo` table instead. +- **Imports are sized for about 60,000 users and 60,000 active sites.** Users are imported in eight batches and sites in four. Each batch is one advanced hunting query, and its result must stay within SquaredUp's response size limit. In a larger tenant a batch can fail, and the users or sites in that batch aren't imported. Every OneDrive with activity in the last 30 days counts as a site. - **Advanced hunting queries are slow.** Every query on `CloudAppEvents` takes several seconds, however simple, and Microsoft Graph rate-limits requests per tenant (we saw 20 calls a minute while testing). Keep dashboards to a few AI, label and file activity tiles, use **Group by** to return only the rows a tile needs, and prefer shorter timeframes. - **An interaction counts under every sensitivity label it reached.** The **Interactions** column is per label, so adding it up across labels counts an interaction that reached several labels more than once. Use **Unique Interactions** for totals: it counts each interaction once. - **Alerts only appear for policies you have configured.** Data loss prevention, insider risk and Security for AI alerts are raised by your own Purview policies, and are read from the same Microsoft Graph alerts API as the Microsoft Defender portal. diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/indexDefinitions/default.json b/plugins/MicrosoftPurviewDataSecurity/v1/indexDefinitions/default.json index 508b8dc93..caf437a6f 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/indexDefinitions/default.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/indexDefinitions/default.json @@ -132,6 +132,110 @@ ] } }, + { + "name": "Users (5)", + "dataStream": { + "name": "importUsers", + "config": { + "shardIndex": "4" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "entraObjectId", + "name": "displayName", + "type": { + "value": "User" + }, + "properties": [ + "userPrincipalName", + "entraObjectId", + "department", + "jobTitle", + "accountEnabled", + "userType" + ] + } + }, + { + "name": "Users (6)", + "dataStream": { + "name": "importUsers", + "config": { + "shardIndex": "5" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "entraObjectId", + "name": "displayName", + "type": { + "value": "User" + }, + "properties": [ + "userPrincipalName", + "entraObjectId", + "department", + "jobTitle", + "accountEnabled", + "userType" + ] + } + }, + { + "name": "Users (7)", + "dataStream": { + "name": "importUsers", + "config": { + "shardIndex": "6" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "entraObjectId", + "name": "displayName", + "type": { + "value": "User" + }, + "properties": [ + "userPrincipalName", + "entraObjectId", + "department", + "jobTitle", + "accountEnabled", + "userType" + ] + } + }, + { + "name": "Users (8)", + "dataStream": { + "name": "importUsers", + "config": { + "shardIndex": "7" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "entraObjectId", + "name": "displayName", + "type": { + "value": "User" + }, + "properties": [ + "userPrincipalName", + "entraObjectId", + "department", + "jobTitle", + "accountEnabled", + "userType" + ] + } + }, { "name": "AI apps", "dataStream": { @@ -194,6 +298,50 @@ "workload" ] } + }, + { + "name": "Sites (3)", + "dataStream": { + "name": "importSites", + "config": { + "shardIndex": "2" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "siteUrl", + "name": "name", + "type": { + "value": "Site" + }, + "properties": [ + "siteUrl", + "workload" + ] + } + }, + { + "name": "Sites (4)", + "dataStream": { + "name": "importSites", + "config": { + "shardIndex": "3" + } + }, + "timeframe": "none", + "optional": true, + "objectMapping": { + "id": "siteUrl", + "name": "name", + "type": { + "value": "Site" + }, + "properties": [ + "siteUrl", + "workload" + ] + } } ] } From e924b79f1f1b354610150bf3e4a7d8730ce6a306 Mon Sep 17 00:00:00 2001 From: Adam Kinniburgh Date: Thu, 26 Nov 2026 11:29:06 +0000 Subject: [PATCH 3/5] fix: transparent icon --- plugins/MicrosoftPurview/v1/icon.svg | 1 - plugins/MicrosoftPurviewDataSecurity/v1/icon.svg | 1 - 2 files changed, 2 deletions(-) diff --git a/plugins/MicrosoftPurview/v1/icon.svg b/plugins/MicrosoftPurview/v1/icon.svg index ff2c0b0ec..0507bd2ed 100644 --- a/plugins/MicrosoftPurview/v1/icon.svg +++ b/plugins/MicrosoftPurview/v1/icon.svg @@ -1,5 +1,4 @@ - diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/icon.svg b/plugins/MicrosoftPurviewDataSecurity/v1/icon.svg index ff2c0b0ec..0507bd2ed 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/icon.svg +++ b/plugins/MicrosoftPurviewDataSecurity/v1/icon.svg @@ -1,5 +1,4 @@ - From edb384f8ce8ab819a54b8ca922eb34772506b865 Mon Sep 17 00:00:00 2001 From: Adam Kinniburgh Date: Thu, 26 Nov 2026 13:30:57 +0000 Subject: [PATCH 4/5] fix: tidy Purview Data Security dashboard formatting --- .../v1/dataStreams/aiInteractions.json | 49 ++++++++-- .../v1/dataStreams/alerts.json | 7 +- .../v1/dataStreams/fileActivity.json | 14 ++- .../v1/dataStreams/labelActivity.json | 14 ++- .../v1/defaultContent/aiApp.dash.json | 12 ++- .../v1/defaultContent/aiRisk.dash.json | 96 ++++++++++++++----- .../v1/defaultContent/overview.dash.json | 18 ++-- .../defaultContent/sensitivityLabel.dash.json | 35 ++++++- .../v1/defaultContent/site.dash.json | 35 +++++-- .../v1/defaultContent/user.dash.json | 16 ++-- 10 files changed, 229 insertions(+), 67 deletions(-) diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/aiInteractions.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/aiInteractions.json index 1e85e5b6e..8d7f3b51e 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/aiInteractions.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/aiInteractions.json @@ -90,37 +90,72 @@ { "name": "interactions", "displayName": "Interactions", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "name": "uniqueInteractions", "displayName": "Unique Interactions", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "name": "resourcesAccessed", "displayName": "Resources Accessed", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "name": "labelledResources", "displayName": "Labelled Resources", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "name": "dlpPolicyMatches", "displayName": "DLP Policy Matches", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "name": "xpiaDetections", "displayName": "XPIA Detections", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "name": "jailbreakAttempts", "displayName": "Jailbreak Attempts", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "sourceId": "userId", diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/alerts.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/alerts.json index 61163edf4..0e2b210d7 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/alerts.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/alerts.json @@ -201,7 +201,12 @@ { "name": "evidenceCount", "displayName": "Evidence Count", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] } ], "timeframes": true, diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/fileActivity.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/fileActivity.json index f5d5980e9..b50f6abbf 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/fileActivity.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/fileActivity.json @@ -85,12 +85,22 @@ { "name": "events", "displayName": "Events", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "name": "files", "displayName": "Files", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "sourceId": "userId", diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/labelActivity.json b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/labelActivity.json index 456e34079..8ef66cf6a 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/labelActivity.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/dataStreams/labelActivity.json @@ -122,12 +122,22 @@ { "name": "events", "displayName": "Events", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "name": "items", "displayName": "Items", - "shape": "number" + "shape": [ + "number", + { + "decimalPlaces": 0 + } + ] }, { "sourceId": "userId", diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiApp.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiApp.dash.json index a5107d514..2d2c44ebf 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiApp.dash.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiApp.dash.json @@ -291,7 +291,8 @@ "y": { "field": "uniqueInteractions", "type": "quantitative", - "title": "Interactions" + "title": "Interactions", + "aggregate": "sum" } }, "style": { @@ -371,12 +372,14 @@ { "field": "interactions", "type": "quantitative", - "title": "Interactions" + "title": "Interactions", + "aggregate": "sum" }, { "field": "labelledResources", "type": "quantitative", - "title": "Labelled resources" + "title": "Labelled resources", + "aggregate": "sum" } ] }, @@ -386,7 +389,8 @@ "colors": [ "#8b5cf6", "#f97316" - ] + ], + "cartesianHorizontal": true } } } diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiRisk.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiRisk.dash.json index 7f5f26c50..b6001170d 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiRisk.dash.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/aiRisk.dash.json @@ -26,7 +26,7 @@ "content": "AI interaction tiles come from advanced hunting and need the Microsoft Defender for Cloud Apps Microsoft 365 app connector with its Microsoft 365 activities component selected. They cover up to the last 30 days.", "fontSize": 14, "align": "left", - "autoSize": true + "autoSize": false } } } @@ -184,7 +184,7 @@ { "field": "dlp", "type": "quantitative", - "title": "Data loss prevention" + "title": "DLP" } ] }, @@ -309,12 +309,14 @@ { "field": "interactions", "type": "quantitative", - "title": "Interactions" + "title": "Interactions", + "aggregate": "sum" }, { "field": "labelledResources", "type": "quantitative", - "title": "Labelled resources" + "title": "Labelled resources", + "aggregate": "sum" } ] }, @@ -324,7 +326,8 @@ "colors": [ "#8b5cf6", "#f97316" - ] + ], + "cartesianHorizontal": true } } } @@ -359,10 +362,50 @@ "sort": { "by": [ [ - "uniqueInteractions", + "uniqueInteractions_sum", "desc" ] ] + }, + "group": { + "by": [ + [ + "user", + "uniqueValues" + ] + ], + "aggregate": [ + { + "type": "sum", + "names": [ + "uniqueInteractions" + ] + }, + { + "type": "sum", + "names": [ + "labelledResources" + ] + }, + { + "type": "sum", + "names": [ + "dlpPolicyMatches" + ] + }, + { + "type": "sum", + "names": [ + "xpiaDetections" + ] + }, + { + "type": "sum", + "names": [ + "jailbreakAttempts" + ] + } + ] } }, "vizSpec": { @@ -372,23 +415,23 @@ "encoding": { "columns": [ { - "field": "user", + "field": "user_uniqueValues", "title": "User", "renderer": { "type": "text" } }, { - "field": "uniqueInteractions", + "field": "uniqueInteractions_sum", "title": "Interactions", - "width": 110, + "width": 130, "align": "right", "renderer": { "type": "number" } }, { - "field": "labelledResources", + "field": "labelledResources_sum", "title": "Labelled Resources", "renderer": { "type": "bar", @@ -396,27 +439,27 @@ } }, { - "field": "dlpPolicyMatches", - "title": "DLP Policy Matches", - "width": 150, + "field": "dlpPolicyMatches_sum", + "title": "DLP Matches", + "width": 130, "align": "right", "renderer": { "type": "number" } }, { - "field": "xpiaDetections", - "title": "Prompt Injections", - "width": 140, + "field": "xpiaDetections_sum", + "title": "Injections", + "width": 120, "align": "right", "renderer": { "type": "number" } }, { - "field": "jailbreakAttempts", - "title": "Jailbreak Attempts", - "width": 150, + "field": "jailbreakAttempts_sum", + "title": "Jailbreaks", + "width": 120, "align": "right", "renderer": { "type": "number" @@ -481,7 +524,7 @@ { "field": "severity", "title": "Severity", - "width": 120, + "width": 110, "renderer": { "type": "badge", "colors": { @@ -497,12 +540,13 @@ "title": "Alert", "renderer": { "type": "text" - } + }, + "width": 280 }, { "field": "source", "title": "Source", - "width": 190, + "width": 180, "renderer": { "type": "badge", "colors": { @@ -515,7 +559,7 @@ { "field": "status", "title": "Status", - "width": 110, + "width": 115, "renderer": { "type": "text" } @@ -526,14 +570,16 @@ "renderer": { "type": "tag-list", "color": "#6366f1" - } + }, + "width": 200 }, { "field": "assignedTo", "title": "Assigned To", "renderer": { "type": "text" - } + }, + "width": 150 }, { "field": "created", diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/overview.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/overview.dash.json index fa921a88c..d79865203 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/overview.dash.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/overview.dash.json @@ -287,7 +287,7 @@ { "field": "severity", "title": "Severity", - "width": 120, + "width": 110, "renderer": { "type": "badge", "colors": { @@ -303,12 +303,13 @@ "title": "Alert", "renderer": { "type": "text" - } + }, + "width": 280 }, { "field": "source", "title": "Source", - "width": 190, + "width": 180, "renderer": { "type": "badge", "colors": { @@ -321,7 +322,7 @@ { "field": "status", "title": "Status", - "width": 110, + "width": 115, "renderer": { "type": "text" } @@ -332,14 +333,16 @@ "renderer": { "type": "tag-list", "color": "#6366f1" - } + }, + "width": 200 }, { "field": "assignedTo", "title": "Assigned To", "renderer": { "type": "text" - } + }, + "width": 150 }, { "field": "created", @@ -495,7 +498,8 @@ "y": { "field": "events", "type": "quantitative", - "title": "Events" + "title": "Events", + "aggregate": "sum" } }, "style": { diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/sensitivityLabel.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/sensitivityLabel.dash.json index 2d1b69bc7..e2963654f 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/sensitivityLabel.dash.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/sensitivityLabel.dash.json @@ -153,6 +153,29 @@ "workspace": "{{workspaceId}}", "scope": "{{scopes.[Sensitivity Labels]}}" } + }, + "group": { + "by": [], + "aggregate": [ + { + "type": "sum", + "names": [ + "uniqueInteractions" + ] + }, + { + "type": "sum", + "names": [ + "labelledResources" + ] + }, + { + "type": "sum", + "names": [ + "dlpPolicyMatches" + ] + } + ] } }, "variables": [ @@ -165,17 +188,17 @@ "encoding": { "values": [ { - "field": "uniqueInteractions", + "field": "uniqueInteractions_sum", "type": "quantitative", "title": "Interactions" }, { - "field": "labelledResources", + "field": "labelledResources_sum", "type": "quantitative", "title": "Resources read" }, { - "field": "dlpPolicyMatches", + "field": "dlpPolicyMatches_sum", "type": "quantitative", "title": "DLP policy matches" } @@ -321,7 +344,8 @@ "y": { "field": "uniqueInteractions", "type": "quantitative", - "title": "Interactions" + "title": "Interactions", + "aggregate": "sum" } }, "style": { @@ -408,7 +432,8 @@ "y": { "field": "events", "type": "quantitative", - "title": "Events" + "title": "Events", + "aggregate": "sum" } }, "style": { diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json index e41d44693..e61208d96 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/site.dash.json @@ -14,7 +14,7 @@ "i": "7277f988-fea5-4ba6-8de9-1c74e714ce89", "x": 0, "y": 0, - "w": 1, + "w": 2, "h": 2, "moved": false, "static": false, @@ -73,9 +73,9 @@ }, { "i": "ddf140cf-e125-48a0-943c-dc5dd851109d", - "x": 1, + "x": 2, "y": 0, - "w": 3, + "w": 2, "h": 2, "moved": false, "static": false, @@ -98,6 +98,23 @@ "workspace": "{{workspaceId}}", "scope": "{{scopes.[Sites]}}" } + }, + "group": { + "by": [], + "aggregate": [ + { + "type": "sum", + "names": [ + "events" + ] + }, + { + "type": "sum", + "names": [ + "files" + ] + } + ] } }, "variables": [ @@ -110,12 +127,12 @@ "encoding": { "values": [ { - "field": "events", + "field": "events_sum", "type": "quantitative", "title": "Events" }, { - "field": "files", + "field": "files_sum", "type": "quantitative", "title": "Files" } @@ -343,12 +360,13 @@ "title": "User", "renderer": { "type": "text" - } + }, + "width": 170 }, { "field": "action", "title": "Action", - "width": 130, + "width": 120, "renderer": { "type": "badge", "colors": { @@ -369,7 +387,8 @@ "title": "Label", "renderer": { "type": "text" - } + }, + "width": 170 }, { "field": "events", diff --git a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json index 150a79e02..c9c0a58ef 100644 --- a/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json +++ b/plugins/MicrosoftPurviewDataSecurity/v1/defaultContent/user.dash.json @@ -245,12 +245,14 @@ { "field": "interactions", "type": "quantitative", - "title": "Interactions" + "title": "Interactions", + "aggregate": "sum" }, { "field": "labelledResources", "type": "quantitative", - "title": "Labelled resources" + "title": "Labelled resources", + "aggregate": "sum" } ] }, @@ -260,7 +262,8 @@ "colors": [ "#8b5cf6", "#f97316" - ] + ], + "cartesianHorizontal": true } } } @@ -321,7 +324,8 @@ "y": { "field": "events", "type": "quantitative", - "title": "Events" + "title": "Events", + "aggregate": "sum" } }, "style": { @@ -461,7 +465,7 @@ { "field": "severity", "title": "Severity", - "width": 80, + "width": 100, "renderer": { "type": "status", "showLabel": false @@ -505,7 +509,7 @@ { "field": "createdDateTime", "title": "Created", - "width": 130, + "width": 160, "renderer": { "type": "date", "relative": true From 8153f5489cc1df1570e1b949347ebbfdc5e280f6 Mon Sep 17 00:00:00 2001 From: Adam Kinniburgh Date: Thu, 26 Nov 2026 13:45:11 +0000 Subject: [PATCH 5/5] fix: scope Purview Data Governance scans import and fix object types --- .../v1/indexDefinitions/default.json | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/MicrosoftPurview/v1/indexDefinitions/default.json b/plugins/MicrosoftPurview/v1/indexDefinitions/default.json index 1488fd612..6e218908f 100644 --- a/plugins/MicrosoftPurview/v1/indexDefinitions/default.json +++ b/plugins/MicrosoftPurview/v1/indexDefinitions/default.json @@ -7,7 +7,7 @@ "objectMapping": { "id": "name", "name": "displayName", - "type": "sourceType", + "type": { "value": "Purview Collection" }, "properties": [ "collectionName", { "parentCollection": "parentCollectionName" }, @@ -22,7 +22,7 @@ "objectMapping": { "id": "name", "name": "name", - "type": "sourceType", + "type": { "value": "Purview Data Source" }, "properties": [ "kind", "collection", @@ -39,7 +39,7 @@ "objectMapping": { "id": "id", "name": "name", - "type": "sourceType", + "type": { "value": "Purview Governance Domain" }, "properties": [ "description", "type", @@ -50,11 +50,16 @@ { "name": "scans", "dataStream": { "name": "dataSourceScans" }, + "scope": { + "query": "g.V().has(\"sourceType\", \"Purview Data Source\")" + }, + "dependsOn": ["dataSources"], + "optional": true, "timeframe": "none", "objectMapping": { "id": "id", "name": "name", - "type": "sourceType", + "type": { "value": "Purview Scan" }, "properties": [ "kind", "collection",