Power Apps - App activity from unauthorized geo
Id | 7ec1e61d-f3b7-4f40-bb1a-357a63913c23 |
Rulename | Power Apps - App activity from unauthorized geo |
Description | Identifies Power Apps activity from countries in a predefined list of unauthorized countries. |
Severity | Low |
Tactics | InitialAccess |
Techniques | T1078 |
Required data connectors | AzureActiveDirectory PowerPlatformAdmin |
Kind | Scheduled |
Query frequency | 1h |
Query period | 14d |
Trigger threshold | 0 |
Trigger operator | gt |
Source Uri | https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Business Applications/Analytic Rules/Power Apps - App activity from unauthorized geo.yaml |
Version | 3.2.0 |
Arm template | 7ec1e61d-f3b7-4f40-bb1a-357a63913c23.json |
let unauthorized_country_codes = dynamic([
// Specify the disallowed two letter country codes
// example: disallowed_country_codes = dynamic(["RU", "KP", "IR"])
]);
let query_frequency = 1h;
let query_lookback = 14d;
let powerapps_events = dynamic(["LaunchPowerApp", "AppDlpEvaluationResultChange", "UpdatePowerApp", "PublishPowerApp", "RecordScopesConsent", "CreatePowerApp", "PowerAppPermissionEdited", "PowerAppPermissionDeleted", "ImportExistingCanvasApp", "DeletePowerApp", "ImportNewCanvasApp", "PromotePowerAppVersion", "RemoveHeroApp", "DeletePowerAppVersion", "PublishSolutionCanvasAppVersion", "AdminModifyAppPermissions", "AdminModifyAppOwner", "AdminQuarantineApp", "AdminDeleteApp", "AdminSetAppBypassConsent", "PatchPowerApp"]);
PowerPlatformAdminActivity
| where TimeGenerated >= ago(query_frequency)
| where EventOriginalType in (powerapps_events)
| extend Properties = tostring(PropertyCollection)
| extend SrcIpAddr = extract(@'"enduser.ip_address","Value":"([^"]+)"', 1, Properties)
| extend SrcIpAddr = iif(SrcIpAddr startswith '::ffff:', replace_string(SrcIpAddr, '::ffff:', ''), SrcIpAddr)
| extend AppId = extract(@'"powerplatform.analytics.resource.power_app.id","Value":"([^"]+)"', 1, Properties)
| extend AppId = tolower(replace_string(AppId, '/providers/Microsoft.PowerApps/apps/', ''))
| extend
AppName = extract(@'"powerplatform.analytics.resource.power_app.display_name","Value":"([^"]+)"', 1, Properties),
EnvironmentId = extract(@'"powerplatform.analytics.resource.environment.id","Value":"([^"]+)"', 1, Properties),
EnvironmentName = extract(@'"powerplatform.analytics.resource.environment.name","Value":"([^"]+)"', 1, Properties)
| summarize FirstEvent = min(TimeGenerated) by ActorName, SrcIpAddr, AppName, AppId, EnvironmentId, EnvironmentName
| join kind=inner (
SigninLogs
| where TimeGenerated >= ago(query_lookback)
| where Location in (unauthorized_country_codes)
| summarize by IPAddress, Location)
on $left.SrcIpAddr == $right.IPAddress
| extend
PowerAppsEntityId = 27593,
DataverseId = 32780,
AccountName = tostring(split(ActorName, '@')[0]),
UPNSuffix = tostring(split(ActorName, '@')[1])
| project
FirstEvent,
ActorName,
SrcIpAddr,
Location,
AppName,
AppId,
EnvironmentId,
EnvironmentName,
PowerAppsEntityId,
AccountName,
UPNSuffix
entityMappings:
- entityType: Account
fieldMappings:
- identifier: Name
columnName: AccountName
- identifier: UPNSuffix
columnName: UPNSuffix
- entityType: IP
fieldMappings:
- identifier: Address
columnName: SrcIpAddr
- entityType: CloudApplication
fieldMappings:
- identifier: AppId
columnName: PowerAppsEntityId
- identifier: Name
columnName: AppName
queryFrequency: 1h
name: Power Apps - App activity from unauthorized geo
alertDetailsOverride:
alertDisplayNameFormat: Power Apps activity from an unauthorized location
alertDescriptionFormat: 'User {{ActorName}} activity associated with app {{AppName}} from an unauthorized geolocation: {{Location}}'
kind: Scheduled
tactics:
- InitialAccess
triggerThreshold: 0
query: |
let unauthorized_country_codes = dynamic([
// Specify the disallowed two letter country codes
// example: disallowed_country_codes = dynamic(["RU", "KP", "IR"])
]);
let query_frequency = 1h;
let query_lookback = 14d;
let powerapps_events = dynamic(["LaunchPowerApp", "AppDlpEvaluationResultChange", "UpdatePowerApp", "PublishPowerApp", "RecordScopesConsent", "CreatePowerApp", "PowerAppPermissionEdited", "PowerAppPermissionDeleted", "ImportExistingCanvasApp", "DeletePowerApp", "ImportNewCanvasApp", "PromotePowerAppVersion", "RemoveHeroApp", "DeletePowerAppVersion", "PublishSolutionCanvasAppVersion", "AdminModifyAppPermissions", "AdminModifyAppOwner", "AdminQuarantineApp", "AdminDeleteApp", "AdminSetAppBypassConsent", "PatchPowerApp"]);
PowerPlatformAdminActivity
| where TimeGenerated >= ago(query_frequency)
| where EventOriginalType in (powerapps_events)
| extend Properties = tostring(PropertyCollection)
| extend SrcIpAddr = extract(@'"enduser.ip_address","Value":"([^"]+)"', 1, Properties)
| extend SrcIpAddr = iif(SrcIpAddr startswith '::ffff:', replace_string(SrcIpAddr, '::ffff:', ''), SrcIpAddr)
| extend AppId = extract(@'"powerplatform.analytics.resource.power_app.id","Value":"([^"]+)"', 1, Properties)
| extend AppId = tolower(replace_string(AppId, '/providers/Microsoft.PowerApps/apps/', ''))
| extend
AppName = extract(@'"powerplatform.analytics.resource.power_app.display_name","Value":"([^"]+)"', 1, Properties),
EnvironmentId = extract(@'"powerplatform.analytics.resource.environment.id","Value":"([^"]+)"', 1, Properties),
EnvironmentName = extract(@'"powerplatform.analytics.resource.environment.name","Value":"([^"]+)"', 1, Properties)
| summarize FirstEvent = min(TimeGenerated) by ActorName, SrcIpAddr, AppName, AppId, EnvironmentId, EnvironmentName
| join kind=inner (
SigninLogs
| where TimeGenerated >= ago(query_lookback)
| where Location in (unauthorized_country_codes)
| summarize by IPAddress, Location)
on $left.SrcIpAddr == $right.IPAddress
| extend
PowerAppsEntityId = 27593,
DataverseId = 32780,
AccountName = tostring(split(ActorName, '@')[0]),
UPNSuffix = tostring(split(ActorName, '@')[1])
| project
FirstEvent,
ActorName,
SrcIpAddr,
Location,
AppName,
AppId,
EnvironmentId,
EnvironmentName,
PowerAppsEntityId,
AccountName,
UPNSuffix
relevantTechniques:
- T1078
triggerOperator: gt
customDetails:
EnvironmentName: EnvironmentName
Environment: EnvironmentId
App: AppId
queryPeriod: 14d
eventGroupingSettings:
aggregationKind: SingleAlert
OriginalUri: https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Business Applications/Analytic Rules/Power Apps - App activity from unauthorized geo.yaml
severity: Low
status: Available
id: 7ec1e61d-f3b7-4f40-bb1a-357a63913c23
requiredDataConnectors:
- connectorId: PowerPlatformAdmin
dataTypes:
- PowerPlatformAdminActivity
- connectorId: AzureActiveDirectory
dataTypes:
- SigninLogs
version: 3.2.0
description: Identifies Power Apps activity from countries in a predefined list of unauthorized countries.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"workspace": {
"type": "String"
}
},
"resources": [
{
"apiVersion": "2024-01-01-preview",
"id": "[concat(resourceId('Microsoft.OperationalInsights/workspaces/providers', parameters('workspace'), 'Microsoft.SecurityInsights'),'/alertRules/7ec1e61d-f3b7-4f40-bb1a-357a63913c23')]",
"kind": "Scheduled",
"name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/7ec1e61d-f3b7-4f40-bb1a-357a63913c23')]",
"properties": {
"alertDetailsOverride": {
"alertDescriptionFormat": "User {{ActorName}} activity associated with app {{AppName}} from an unauthorized geolocation: {{Location}}",
"alertDisplayNameFormat": "Power Apps activity from an unauthorized location"
},
"alertRuleTemplateName": "7ec1e61d-f3b7-4f40-bb1a-357a63913c23",
"customDetails": {
"App": "AppId",
"Environment": "EnvironmentId",
"EnvironmentName": "EnvironmentName"
},
"description": "Identifies Power Apps activity from countries in a predefined list of unauthorized countries.",
"displayName": "Power Apps - App activity from unauthorized geo",
"enabled": true,
"entityMappings": [
{
"entityType": "Account",
"fieldMappings": [
{
"columnName": "AccountName",
"identifier": "Name"
},
{
"columnName": "UPNSuffix",
"identifier": "UPNSuffix"
}
]
},
{
"entityType": "IP",
"fieldMappings": [
{
"columnName": "SrcIpAddr",
"identifier": "Address"
}
]
},
{
"entityType": "CloudApplication",
"fieldMappings": [
{
"columnName": "PowerAppsEntityId",
"identifier": "AppId"
},
{
"columnName": "AppName",
"identifier": "Name"
}
]
}
],
"eventGroupingSettings": {
"aggregationKind": "SingleAlert"
},
"OriginalUri": "https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Microsoft Business Applications/Analytic Rules/Power Apps - App activity from unauthorized geo.yaml",
"query": "let unauthorized_country_codes = dynamic([\n // Specify the disallowed two letter country codes\n // example: disallowed_country_codes = dynamic([\"RU\", \"KP\", \"IR\"])\n ]);\nlet query_frequency = 1h;\nlet query_lookback = 14d;\nlet powerapps_events = dynamic([\"LaunchPowerApp\", \"AppDlpEvaluationResultChange\", \"UpdatePowerApp\", \"PublishPowerApp\", \"RecordScopesConsent\", \"CreatePowerApp\", \"PowerAppPermissionEdited\", \"PowerAppPermissionDeleted\", \"ImportExistingCanvasApp\", \"DeletePowerApp\", \"ImportNewCanvasApp\", \"PromotePowerAppVersion\", \"RemoveHeroApp\", \"DeletePowerAppVersion\", \"PublishSolutionCanvasAppVersion\", \"AdminModifyAppPermissions\", \"AdminModifyAppOwner\", \"AdminQuarantineApp\", \"AdminDeleteApp\", \"AdminSetAppBypassConsent\", \"PatchPowerApp\"]);\nPowerPlatformAdminActivity\n| where TimeGenerated >= ago(query_frequency)\n| where EventOriginalType in (powerapps_events)\n| extend Properties = tostring(PropertyCollection)\n| extend SrcIpAddr = extract(@'\"enduser.ip_address\",\"Value\":\"([^\"]+)\"', 1, Properties)\n| extend SrcIpAddr = iif(SrcIpAddr startswith '::ffff:', replace_string(SrcIpAddr, '::ffff:', ''), SrcIpAddr)\n| extend AppId = extract(@'\"powerplatform.analytics.resource.power_app.id\",\"Value\":\"([^\"]+)\"', 1, Properties)\n| extend AppId = tolower(replace_string(AppId, '/providers/Microsoft.PowerApps/apps/', ''))\n| extend\n AppName = extract(@'\"powerplatform.analytics.resource.power_app.display_name\",\"Value\":\"([^\"]+)\"', 1, Properties),\n EnvironmentId = extract(@'\"powerplatform.analytics.resource.environment.id\",\"Value\":\"([^\"]+)\"', 1, Properties),\n EnvironmentName = extract(@'\"powerplatform.analytics.resource.environment.name\",\"Value\":\"([^\"]+)\"', 1, Properties)\n| summarize FirstEvent = min(TimeGenerated) by ActorName, SrcIpAddr, AppName, AppId, EnvironmentId, EnvironmentName\n| join kind=inner (\n SigninLogs\n | where TimeGenerated >= ago(query_lookback)\n | where Location in (unauthorized_country_codes)\n | summarize by IPAddress, Location)\n on $left.SrcIpAddr == $right.IPAddress\n| extend\n PowerAppsEntityId = 27593,\n DataverseId = 32780,\n AccountName = tostring(split(ActorName, '@')[0]),\n UPNSuffix = tostring(split(ActorName, '@')[1])\n| project\n FirstEvent,\n ActorName,\n SrcIpAddr,\n Location,\n AppName,\n AppId,\n EnvironmentId,\n EnvironmentName,\n PowerAppsEntityId,\n AccountName,\n UPNSuffix\n",
"queryFrequency": "PT1H",
"queryPeriod": "P14D",
"severity": "Low",
"status": "Available",
"subTechniques": [],
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"tactics": [
"InitialAccess"
],
"techniques": [
"T1078"
],
"templateVersion": "3.2.0",
"triggerOperator": "GreaterThan",
"triggerThreshold": 0
},
"type": "Microsoft.OperationalInsights/workspaces/providers/alertRules"
}
]
}