diff --git a/.script/tests/KqlvalidationsTests/SkipValidationsTemplates.json b/.script/tests/KqlvalidationsTests/SkipValidationsTemplates.json
index ef7196154a0..59734b77952 100644
--- a/.script/tests/KqlvalidationsTests/SkipValidationsTemplates.json
+++ b/.script/tests/KqlvalidationsTests/SkipValidationsTemplates.json
@@ -79,11 +79,6 @@
"templateName": "vimNetworkSessionMicrosoftMD4IoT.yaml",
"validationFailReason": "The name 'LocalPort' does not refer to any known column, table, variable or function."
},
- {
- "id": "29e99017-e28d-47be-8b9a-c8c711f8a903",
- "templateName": "NRT_AuthenticationMethodsChangedforVIPUsers.yaml",
- "validationFailReason": "The name 'User Principal Name' does not refer to any known column, table, variable or function"
- },
{
"id": "078a6526-e94e-4cf1-a08e-83bc0186479f",
"templateName": "Anomalous AAD Account Manipulation.yaml",
diff --git a/Solutions/Azure Active Directory/Analytic Rules/NRT_AuthenticationMethodsChangedforVIPUsers.yaml b/Solutions/Azure Active Directory/Analytic Rules/NRT_AuthenticationMethodsChangedforVIPUsers.yaml
index d6fb35b5517..1dc8dc1eb4c 100644
--- a/Solutions/Azure Active Directory/Analytic Rules/NRT_AuthenticationMethodsChangedforVIPUsers.yaml
+++ b/Solutions/Azure Active Directory/Analytic Rules/NRT_AuthenticationMethodsChangedforVIPUsers.yaml
@@ -15,7 +15,7 @@ tags:
- AADSecOpsGuide
query: |
let security_info_actions = dynamic(["User registered security info", "User changed default security info", "User deleted security info", "Admin updated security info", "User reviewed security info", "Admin deleted security info", "Admin registered security info"]);
- let VIPUsers = (_GetWatchlist('VIPUsers') | distinct ["User Principal Name"]);
+ let VIPUsers = (_GetWatchlist('VIPUsers') | distinct "User Principal Name");
AuditLogs
| where Category =~ "UserManagement"
| where ActivityDisplayName in (security_info_actions)
@@ -40,5 +40,5 @@ entityMappings:
fieldMappings:
- identifier: Address
columnName: IP
-version: 1.0.1
+version: 1.0.2
kind: NRT
diff --git a/Solutions/Azure Active Directory/Package/3.0.3.zip b/Solutions/Azure Active Directory/Package/3.0.3.zip
index bc481bdff9e..7a61443d3de 100644
Binary files a/Solutions/Azure Active Directory/Package/3.0.3.zip and b/Solutions/Azure Active Directory/Package/3.0.3.zip differ
diff --git a/Solutions/Azure Active Directory/Package/createUiDefinition.json b/Solutions/Azure Active Directory/Package/createUiDefinition.json
index a69424a5497..2530be72fb7 100644
--- a/Solutions/Azure Active Directory/Package/createUiDefinition.json
+++ b/Solutions/Azure Active Directory/Package/createUiDefinition.json
@@ -51,6 +51,30 @@
}
],
"steps": [
+ {
+ "name": "dataconnectors",
+ "label": "Data Connectors",
+ "bladeTitle": "Data Connectors",
+ "elements": [
+ {
+ "name": "dataconnectors1-text",
+ "type": "Microsoft.Common.TextBlock",
+ "options": {
+ "text": "This Solution installs the data connector for Azure Active Directory. You can get Azure Active Directory custom log data in your Microsoft Sentinel workspace. After installing the solution, configure and enable this data connector by following guidance in Manage solution view."
+ }
+ },
+ {
+ "name": "dataconnectors-link2",
+ "type": "Microsoft.Common.TextBlock",
+ "options": {
+ "link": {
+ "label": "Learn more about connecting data sources",
+ "uri": "https://docs.microsoft.com/azure/sentinel/connect-data-sources"
+ }
+ }
+ }
+ ]
+ },
{
"name": "workbooks",
"label": "Workbooks",
diff --git a/Solutions/Azure Active Directory/Package/mainTemplate.json b/Solutions/Azure Active Directory/Package/mainTemplate.json
index 5c380daa6fb..67f37493196 100644
--- a/Solutions/Azure Active Directory/Package/mainTemplate.json
+++ b/Solutions/Azure Active Directory/Package/mainTemplate.json
@@ -46,107 +46,27 @@
}
},
"variables": {
- "solutionId": "azuresentinel.azure-sentinel-solution-azureactivedirectory",
- "_solutionId": "[variables('solutionId')]",
"email": "support@microsoft.com",
"_email": "[variables('email')]",
"_solutionName": "Azure Active Directory",
"_solutionVersion": "3.0.3",
- "Block-AADUser-alert-trigger": "Block-AADUser-alert-trigger",
- "_Block-AADUser-alert-trigger": "[variables('Block-AADUser-alert-trigger')]",
- "playbookVersion1": "1.1",
- "playbookContentId1": "Block-AADUser-alert-trigger",
- "_playbookContentId1": "[variables('playbookContentId1')]",
- "playbookId1": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId1'))]",
- "playbookTemplateSpecName1": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId1'))))]",
- "workspaceResourceId": "[resourceId('microsoft.OperationalInsights/Workspaces', parameters('workspace'))]",
- "_playbookcontentProductId1": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId1'),'-', variables('playbookVersion1'))))]",
- "Block-AADUser-entity-trigger": "Block-AADUser-entity-trigger",
- "_Block-AADUser-entity-trigger": "[variables('Block-AADUser-entity-trigger')]",
- "playbookVersion2": "1.1",
- "playbookContentId2": "Block-AADUser-entity-trigger",
- "_playbookContentId2": "[variables('playbookContentId2')]",
- "playbookId2": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId2'))]",
- "playbookTemplateSpecName2": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId2'))))]",
- "_playbookcontentProductId2": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId2'),'-', variables('playbookVersion2'))))]",
- "Block-AADUser-incident-trigger": "Block-AADUser-incident-trigger",
- "_Block-AADUser-incident-trigger": "[variables('Block-AADUser-incident-trigger')]",
- "playbookVersion3": "1.1",
- "playbookContentId3": "Block-AADUser-incident-trigger",
- "_playbookContentId3": "[variables('playbookContentId3')]",
- "playbookId3": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId3'))]",
- "playbookTemplateSpecName3": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId3'))))]",
- "_playbookcontentProductId3": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId3'),'-', variables('playbookVersion3'))))]",
- "Prompt-User-alert-trigger": "Prompt-User-alert-trigger",
- "_Prompt-User-alert-trigger": "[variables('Prompt-User-alert-trigger')]",
- "playbookVersion4": "1.1",
- "playbookContentId4": "Prompt-User-alert-trigger",
- "_playbookContentId4": "[variables('playbookContentId4')]",
- "playbookId4": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId4'))]",
- "playbookTemplateSpecName4": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId4'))))]",
- "_playbookcontentProductId4": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId4'),'-', variables('playbookVersion4'))))]",
- "Prompt-User-incident-trigger": "Prompt-User-incident-trigger",
- "_Prompt-User-incident-trigger": "[variables('Prompt-User-incident-trigger')]",
- "playbookVersion5": "1.1",
- "playbookContentId5": "Prompt-User-incident-trigger",
- "_playbookContentId5": "[variables('playbookContentId5')]",
- "playbookId5": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId5'))]",
- "playbookTemplateSpecName5": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId5'))))]",
- "_playbookcontentProductId5": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId5'),'-', variables('playbookVersion5'))))]",
- "Reset-AADUserPassword-alert-trigger": "Reset-AADUserPassword-alert-trigger",
- "_Reset-AADUserPassword-alert-trigger": "[variables('Reset-AADUserPassword-alert-trigger')]",
- "playbookVersion6": "1.1",
- "playbookContentId6": "Reset-AADUserPassword-alert-trigger",
- "_playbookContentId6": "[variables('playbookContentId6')]",
- "playbookId6": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId6'))]",
- "playbookTemplateSpecName6": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId6'))))]",
- "_playbookcontentProductId6": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId6'),'-', variables('playbookVersion6'))))]",
- "Reset-AADUserPassword-entity-trigger": "Reset-AADUserPassword-entity-trigger",
- "_Reset-AADUserPassword-entity-trigger": "[variables('Reset-AADUserPassword-entity-trigger')]",
- "playbookVersion7": "1.1",
- "playbookContentId7": "Reset-AADUserPassword-entity-trigger",
- "_playbookContentId7": "[variables('playbookContentId7')]",
- "playbookId7": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId7'))]",
- "playbookTemplateSpecName7": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId7'))))]",
- "_playbookcontentProductId7": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId7'),'-', variables('playbookVersion7'))))]",
- "blanks": "[replace('b', 'b', '')]",
- "Reset-AADUserPassword-incident-trigger": "Reset-AADUserPassword-incident-trigger",
- "_Reset-AADUserPassword-incident-trigger": "[variables('Reset-AADUserPassword-incident-trigger')]",
- "playbookVersion8": "1.1",
- "playbookContentId8": "Reset-AADUserPassword-incident-trigger",
- "_playbookContentId8": "[variables('playbookContentId8')]",
- "playbookId8": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId8'))]",
- "playbookTemplateSpecName8": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId8'))))]",
- "_playbookcontentProductId8": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId8'),'-', variables('playbookVersion8'))))]",
- "Revoke-AADSignInSessions-alert-trigger": "Revoke-AADSignInSessions-alert-trigger",
- "_Revoke-AADSignInSessions-alert-trigger": "[variables('Revoke-AADSignInSessions-alert-trigger')]",
- "playbookVersion9": "1.0",
- "playbookContentId9": "Revoke-AADSignInSessions-alert-trigger",
- "_playbookContentId9": "[variables('playbookContentId9')]",
- "playbookId9": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId9'))]",
- "playbookTemplateSpecName9": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId9'))))]",
- "_playbookcontentProductId9": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId9'),'-', variables('playbookVersion9'))))]",
- "Revoke-AADSignInSessions-entity-trigger": "Revoke-AADSignInSessions-entity-trigger",
- "_Revoke-AADSignInSessions-entity-trigger": "[variables('Revoke-AADSignInSessions-entity-trigger')]",
- "playbookVersion10": "1.0",
- "playbookContentId10": "Revoke-AADSignInSessions-entity-trigger",
- "_playbookContentId10": "[variables('playbookContentId10')]",
- "playbookId10": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId10'))]",
- "playbookTemplateSpecName10": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId10'))))]",
- "_playbookcontentProductId10": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId10'),'-', variables('playbookVersion10'))))]",
- "Revoke-AADSignInSessions-incident-trigger": "Revoke-AADSignInSessions-incident-trigger",
- "_Revoke-AADSignInSessions-incident-trigger": "[variables('Revoke-AADSignInSessions-incident-trigger')]",
- "playbookVersion11": "1.0",
- "playbookContentId11": "Revoke-AADSignInSessions-incident-trigger",
- "_playbookContentId11": "[variables('playbookContentId11')]",
- "playbookId11": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId11'))]",
- "playbookTemplateSpecName11": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId11'))))]",
- "_playbookcontentProductId11": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId11'),'-', variables('playbookVersion11'))))]",
+ "solutionId": "azuresentinel.azure-sentinel-solution-azureactivedirectory",
+ "_solutionId": "[variables('solutionId')]",
+ "uiConfigId1": "AzureActiveDirectory",
+ "_uiConfigId1": "[variables('uiConfigId1')]",
+ "dataConnectorContentId1": "AzureActiveDirectory",
+ "_dataConnectorContentId1": "[variables('dataConnectorContentId1')]",
+ "dataConnectorId1": "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/dataConnectors', variables('_dataConnectorContentId1'))]",
+ "_dataConnectorId1": "[variables('dataConnectorId1')]",
+ "dataConnectorTemplateSpecName1": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-dc-',uniquestring(variables('_dataConnectorContentId1'))))]",
+ "dataConnectorVersion1": "1.0.0",
+ "_dataConnectorcontentProductId1": "[concat(take(variables('_solutionId'),50),'-','dc','-', uniqueString(concat(variables('_solutionId'),'-','DataConnector','-',variables('_dataConnectorContentId1'),'-', variables('dataConnectorVersion1'))))]",
"workbookVersion1": "1.2.0",
"workbookContentId1": "AzureActiveDirectoryAuditLogsWorkbook",
"workbookId1": "[resourceId('Microsoft.Insights/workbooks', variables('workbookContentId1'))]",
"workbookTemplateSpecName1": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-wb-',uniquestring(variables('_workbookContentId1'))))]",
"_workbookContentId1": "[variables('workbookContentId1')]",
+ "workspaceResourceId": "[resourceId('microsoft.OperationalInsights/Workspaces', parameters('workspace'))]",
"_workbookcontentProductId1": "[concat(take(variables('_solutionId'),50),'-','wb','-', uniqueString(concat(variables('_solutionId'),'-','Workbook','-',variables('_workbookContentId1'),'-', variables('workbookVersion1'))))]",
"workbookVersion2": "2.4.0",
"workbookContentId2": "AzureActiveDirectorySigninLogsWorkbook",
@@ -364,7 +284,7 @@
"analyticRuleId35": "[resourceId('Microsoft.SecurityInsights/AlertRuleTemplates', variables('analyticRulecontentId35'))]",
"analyticRuleTemplateSpecName35": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-ar-',uniquestring(variables('_analyticRulecontentId35'))))]",
"_analyticRulecontentProductId35": "[concat(take(variables('_solutionId'),50),'-','ar','-', uniqueString(concat(variables('_solutionId'),'-','AnalyticsRule','-',variables('_analyticRulecontentId35'),'-', variables('analyticRuleVersion35'))))]",
- "analyticRuleVersion36": "1.0.1",
+ "analyticRuleVersion36": "1.0.2",
"analyticRulecontentId36": "29e99017-e28d-47be-8b9a-c8c711f8a903",
"_analyticRulecontentId36": "[variables('analyticRulecontentId36')]",
"analyticRuleId36": "[resourceId('Microsoft.SecurityInsights/AlertRuleTemplates', variables('analyticRulecontentId36'))]",
@@ -508,2534 +428,855 @@
"analyticRuleId59": "[resourceId('Microsoft.SecurityInsights/AlertRuleTemplates', variables('analyticRulecontentId59'))]",
"analyticRuleTemplateSpecName59": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-ar-',uniquestring(variables('_analyticRulecontentId59'))))]",
"_analyticRulecontentProductId59": "[concat(take(variables('_solutionId'),50),'-','ar','-', uniqueString(concat(variables('_solutionId'),'-','AnalyticsRule','-',variables('_analyticRulecontentId59'),'-', variables('analyticRuleVersion59'))))]",
+ "Block-AADUser-alert-trigger": "Block-AADUser-alert-trigger",
+ "_Block-AADUser-alert-trigger": "[variables('Block-AADUser-alert-trigger')]",
+ "playbookVersion1": "1.1",
+ "playbookContentId1": "Block-AADUser-alert-trigger",
+ "_playbookContentId1": "[variables('playbookContentId1')]",
+ "playbookId1": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId1'))]",
+ "playbookTemplateSpecName1": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId1'))))]",
+ "_playbookcontentProductId1": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId1'),'-', variables('playbookVersion1'))))]",
+ "Block-AADUser-incident-trigger": "Block-AADUser-incident-trigger",
+ "_Block-AADUser-incident-trigger": "[variables('Block-AADUser-incident-trigger')]",
+ "playbookVersion2": "1.1",
+ "playbookContentId2": "Block-AADUser-incident-trigger",
+ "_playbookContentId2": "[variables('playbookContentId2')]",
+ "playbookId2": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId2'))]",
+ "playbookTemplateSpecName2": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId2'))))]",
+ "_playbookcontentProductId2": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId2'),'-', variables('playbookVersion2'))))]",
+ "Prompt-User-alert-trigger": "Prompt-User-alert-trigger",
+ "_Prompt-User-alert-trigger": "[variables('Prompt-User-alert-trigger')]",
+ "playbookVersion3": "1.1",
+ "playbookContentId3": "Prompt-User-alert-trigger",
+ "_playbookContentId3": "[variables('playbookContentId3')]",
+ "playbookId3": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId3'))]",
+ "playbookTemplateSpecName3": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId3'))))]",
+ "_playbookcontentProductId3": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId3'),'-', variables('playbookVersion3'))))]",
+ "Prompt-User-incident-trigger": "Prompt-User-incident-trigger",
+ "_Prompt-User-incident-trigger": "[variables('Prompt-User-incident-trigger')]",
+ "playbookVersion4": "1.1",
+ "playbookContentId4": "Prompt-User-incident-trigger",
+ "_playbookContentId4": "[variables('playbookContentId4')]",
+ "playbookId4": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId4'))]",
+ "playbookTemplateSpecName4": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId4'))))]",
+ "_playbookcontentProductId4": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId4'),'-', variables('playbookVersion4'))))]",
+ "Reset-AADUserPassword-alert-trigger": "Reset-AADUserPassword-alert-trigger",
+ "_Reset-AADUserPassword-alert-trigger": "[variables('Reset-AADUserPassword-alert-trigger')]",
+ "playbookVersion5": "1.1",
+ "playbookContentId5": "Reset-AADUserPassword-alert-trigger",
+ "_playbookContentId5": "[variables('playbookContentId5')]",
+ "playbookId5": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId5'))]",
+ "playbookTemplateSpecName5": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId5'))))]",
+ "_playbookcontentProductId5": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId5'),'-', variables('playbookVersion5'))))]",
+ "Reset-AADUserPassword-incident-trigger": "Reset-AADUserPassword-incident-trigger",
+ "_Reset-AADUserPassword-incident-trigger": "[variables('Reset-AADUserPassword-incident-trigger')]",
+ "playbookVersion6": "1.1",
+ "playbookContentId6": "Reset-AADUserPassword-incident-trigger",
+ "_playbookContentId6": "[variables('playbookContentId6')]",
+ "playbookId6": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId6'))]",
+ "playbookTemplateSpecName6": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId6'))))]",
+ "_playbookcontentProductId6": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId6'),'-', variables('playbookVersion6'))))]",
+ "Block-AADUser-entity-trigger": "Block-AADUser-entity-trigger",
+ "_Block-AADUser-entity-trigger": "[variables('Block-AADUser-entity-trigger')]",
+ "playbookVersion7": "1.1",
+ "playbookContentId7": "Block-AADUser-entity-trigger",
+ "_playbookContentId7": "[variables('playbookContentId7')]",
+ "playbookId7": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId7'))]",
+ "playbookTemplateSpecName7": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId7'))))]",
+ "_playbookcontentProductId7": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId7'),'-', variables('playbookVersion7'))))]",
+ "Reset-AADUserPassword-entity-trigger": "Reset-AADUserPassword-entity-trigger",
+ "_Reset-AADUserPassword-entity-trigger": "[variables('Reset-AADUserPassword-entity-trigger')]",
+ "playbookVersion8": "1.1",
+ "playbookContentId8": "Reset-AADUserPassword-entity-trigger",
+ "_playbookContentId8": "[variables('playbookContentId8')]",
+ "playbookId8": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId8'))]",
+ "playbookTemplateSpecName8": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId8'))))]",
+ "_playbookcontentProductId8": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId8'),'-', variables('playbookVersion8'))))]",
+ "blanks": "[replace('b', 'b', '')]",
+ "Revoke-AADSignInSessions-alert-trigger": "Revoke-AADSignInSessions-alert-trigger",
+ "_Revoke-AADSignInSessions-alert-trigger": "[variables('Revoke-AADSignInSessions-alert-trigger')]",
+ "playbookVersion9": "1.0",
+ "playbookContentId9": "Revoke-AADSignInSessions-alert-trigger",
+ "_playbookContentId9": "[variables('playbookContentId9')]",
+ "playbookId9": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId9'))]",
+ "playbookTemplateSpecName9": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId9'))))]",
+ "_playbookcontentProductId9": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId9'),'-', variables('playbookVersion9'))))]",
+ "Revoke-AADSignInSessions-incident-trigger": "Revoke-AADSignInSessions-incident-trigger",
+ "_Revoke-AADSignInSessions-incident-trigger": "[variables('Revoke-AADSignInSessions-incident-trigger')]",
+ "playbookVersion10": "1.0",
+ "playbookContentId10": "Revoke-AADSignInSessions-incident-trigger",
+ "_playbookContentId10": "[variables('playbookContentId10')]",
+ "playbookId10": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId10'))]",
+ "playbookTemplateSpecName10": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId10'))))]",
+ "_playbookcontentProductId10": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId10'),'-', variables('playbookVersion10'))))]",
+ "Revoke-AADSignInSessions-entity-trigger": "Revoke-AADSignInSessions-entity-trigger",
+ "_Revoke-AADSignInSessions-entity-trigger": "[variables('Revoke-AADSignInSessions-entity-trigger')]",
+ "playbookVersion11": "1.0",
+ "playbookContentId11": "Revoke-AADSignInSessions-entity-trigger",
+ "_playbookContentId11": "[variables('playbookContentId11')]",
+ "playbookId11": "[resourceId('Microsoft.Logic/workflows', variables('playbookContentId11'))]",
+ "playbookTemplateSpecName11": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat(parameters('workspace'),'-pl-',uniquestring(variables('_playbookContentId11'))))]",
+ "_playbookcontentProductId11": "[concat(take(variables('_solutionId'),50),'-','pl','-', uniqueString(concat(variables('_solutionId'),'-','Playbook','-',variables('_playbookContentId11'),'-', variables('playbookVersion11'))))]",
"_solutioncontentProductId": "[concat(take(variables('_solutionId'),50),'-','sl','-', uniqueString(concat(variables('_solutionId'),'-','Solution','-',variables('_solutionId'),'-', variables('_solutionVersion'))))]"
},
"resources": [
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName1')]",
+ "name": "[variables('dataConnectorTemplateSpecName1')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Block-AADUser-Alert Playbook with template version 3.0.3",
+ "description": "Azure Active Directory data connector with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion1')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Block-AADUser-Alert",
- "type": "string"
- }
- },
- "variables": {
- "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
- "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
- "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
- "_connection-1": "[[variables('connection-1')]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-3": "[[variables('connection-3')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
+ "contentVersion": "[variables('dataConnectorVersion1')]",
+ "parameters": {},
+ "variables": {},
"resources": [
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('AzureADConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[variables('AzureADConnectionName')]",
- "api": {
- "id": "[[variables('_connection-1')]"
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',variables('_dataConnectorContentId1'))]",
+ "apiVersion": "2021-03-01-preview",
+ "type": "Microsoft.OperationalInsights/workspaces/providers/dataConnectors",
+ "location": "[parameters('workspace-location')]",
+ "kind": "StaticUI",
+ "properties": {
+ "connectorUiConfig": {
+ "id": "[variables('_uiConfigId1')]",
+ "title": "Azure Active Directory",
+ "publisher": "Microsoft",
+ "descriptionMarkdown": "Gain insights into Azure Active Directory by connecting Audit and Sign-in logs to Microsoft Sentinel to gather insights around Azure Active Directory scenarios. You can learn about app usage, conditional access policies, legacy auth relate details using our Sign-in logs. You can get information on your Self Service Password Reset (SSPR) usage, Azure Active Directory Management activities like user, group, role, app management using our Audit logs table. For more information, see the [Microsoft Sentinel documentation](https://go.microsoft.com/fwlink/?linkid=2219715&wt.mc_id=sentinel_dataconnectordocs_content_cnl_csasci).",
+ "graphQueries": [
+ {
+ "metricName": "Total data received",
+ "legend": "SigninLogs",
+ "baseQuery": "SigninLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AuditLogs",
+ "baseQuery": "AuditLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADNonInteractiveUserSignInLogs",
+ "baseQuery": "AADNonInteractiveUserSignInLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADServicePrincipalSignInLogs",
+ "baseQuery": "AADServicePrincipalSignInLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADManagedIdentitySignInLogs",
+ "baseQuery": "AADManagedIdentitySignInLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADProvisioningLogs",
+ "baseQuery": "AADProvisioningLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "ADFSSignInLogs",
+ "baseQuery": "ADFSSignInLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADUserRiskEvents",
+ "baseQuery": "AADUserRiskEvents"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADRiskyUsers",
+ "baseQuery": "AADRiskyUsers"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "NetworkAccessTraffic",
+ "baseQuery": "NetworkAccessTraffic"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADRiskyServicePrincipals",
+ "baseQuery": "AADRiskyServicePrincipals"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADServicePrincipalRiskEvents",
+ "baseQuery": "AADServicePrincipalRiskEvents"
+ }
+ ],
+ "connectivityCriterias": [
+ {
+ "type": "IsConnectedQuery",
+ "value": [
+ "SigninLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AuditLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADNonInteractiveUserSignInLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADServicePrincipalSignInLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADManagedIdentitySignInLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADProvisioningLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "ADFSSignInLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADUserRiskEvents\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADRiskyUsers\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "NetworkAccessTraffic\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADRiskyServicePrincipals\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADServicePrincipalRiskEvents\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)"
+ ]
+ }
+ ],
+ "dataTypes": [
+ {
+ "name": "SigninLogs",
+ "lastDataReceivedQuery": "SigninLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AuditLogs",
+ "lastDataReceivedQuery": "AuditLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADNonInteractiveUserSignInLogs",
+ "lastDataReceivedQuery": "AADNonInteractiveUserSignInLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADServicePrincipalSignInLogs",
+ "lastDataReceivedQuery": "AADServicePrincipalSignInLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADManagedIdentitySignInLogs",
+ "lastDataReceivedQuery": "AADManagedIdentitySignInLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADProvisioningLogs",
+ "lastDataReceivedQuery": "AADProvisioningLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "ADFSSignInLogs",
+ "lastDataReceivedQuery": "ADFSSignInLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADUserRiskEvents",
+ "lastDataReceivedQuery": "AADUserRiskEvents\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADRiskyUsers",
+ "lastDataReceivedQuery": "AADRiskyUsers\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "NetworkAccessTraffic",
+ "lastDataReceivedQuery": "NetworkAccessTraffic\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADRiskyServicePrincipals",
+ "lastDataReceivedQuery": "AADRiskyServicePrincipals\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADServicePrincipalRiskEvents",
+ "lastDataReceivedQuery": "AADServicePrincipalRiskEvents\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ }
+ ]
}
}
},
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('MicrosoftSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('DataConnector-', last(split(variables('_dataConnectorId1'),'/'))))]",
"properties": {
- "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-2')]"
+ "parentId": "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/dataConnectors', variables('_dataConnectorContentId1'))]",
+ "contentId": "[variables('_dataConnectorContentId1')]",
+ "kind": "DataConnector",
+ "version": "[variables('dataConnectorVersion1')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
}
}
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_dataConnectorContentId1')]",
+ "contentKind": "DataConnector",
+ "displayName": "Azure Active Directory",
+ "contentProductId": "[variables('_dataConnectorcontentProductId1')]",
+ "id": "[variables('_dataConnectorcontentProductId1')]",
+ "version": "[variables('dataConnectorVersion1')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('DataConnector-', last(split(variables('_dataConnectorId1'),'/'))))]",
+ "dependsOn": [
+ "[variables('_dataConnectorId1')]"
+ ],
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "parentId": "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/dataConnectors', variables('_dataConnectorContentId1'))]",
+ "contentId": "[variables('_dataConnectorContentId1')]",
+ "kind": "DataConnector",
+ "version": "[variables('dataConnectorVersion1')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ }
+ }
+ },
+ {
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',variables('_dataConnectorContentId1'))]",
+ "apiVersion": "2021-03-01-preview",
+ "type": "Microsoft.OperationalInsights/workspaces/providers/dataConnectors",
+ "location": "[parameters('workspace-location')]",
+ "kind": "StaticUI",
+ "properties": {
+ "connectorUiConfig": {
+ "title": "Azure Active Directory",
+ "publisher": "Microsoft",
+ "descriptionMarkdown": "Gain insights into Azure Active Directory by connecting Audit and Sign-in logs to Microsoft Sentinel to gather insights around Azure Active Directory scenarios. You can learn about app usage, conditional access policies, legacy auth relate details using our Sign-in logs. You can get information on your Self Service Password Reset (SSPR) usage, Azure Active Directory Management activities like user, group, role, app management using our Audit logs table. For more information, see the [Microsoft Sentinel documentation](https://go.microsoft.com/fwlink/?linkid=2219715&wt.mc_id=sentinel_dataconnectordocs_content_cnl_csasci).",
+ "graphQueries": [
+ {
+ "metricName": "Total data received",
+ "legend": "SigninLogs",
+ "baseQuery": "SigninLogs"
},
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('Office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
+ "metricName": "Total data received",
+ "legend": "AuditLogs",
+ "baseQuery": "AuditLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADNonInteractiveUserSignInLogs",
+ "baseQuery": "AADNonInteractiveUserSignInLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADServicePrincipalSignInLogs",
+ "baseQuery": "AADServicePrincipalSignInLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADManagedIdentitySignInLogs",
+ "baseQuery": "AADManagedIdentitySignInLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADProvisioningLogs",
+ "baseQuery": "AADProvisioningLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "ADFSSignInLogs",
+ "baseQuery": "ADFSSignInLogs"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADUserRiskEvents",
+ "baseQuery": "AADUserRiskEvents"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADRiskyUsers",
+ "baseQuery": "AADRiskyUsers"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "NetworkAccessTraffic",
+ "baseQuery": "NetworkAccessTraffic"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADRiskyServicePrincipals",
+ "baseQuery": "AADRiskyServicePrincipals"
+ },
+ {
+ "metricName": "Total data received",
+ "legend": "AADServicePrincipalRiskEvents",
+ "baseQuery": "AADServicePrincipalRiskEvents"
+ }
+ ],
+ "dataTypes": [
+ {
+ "name": "SigninLogs",
+ "lastDataReceivedQuery": "SigninLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AuditLogs",
+ "lastDataReceivedQuery": "AuditLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADNonInteractiveUserSignInLogs",
+ "lastDataReceivedQuery": "AADNonInteractiveUserSignInLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADServicePrincipalSignInLogs",
+ "lastDataReceivedQuery": "AADServicePrincipalSignInLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADManagedIdentitySignInLogs",
+ "lastDataReceivedQuery": "AADManagedIdentitySignInLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADProvisioningLogs",
+ "lastDataReceivedQuery": "AADProvisioningLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "ADFSSignInLogs",
+ "lastDataReceivedQuery": "ADFSSignInLogs\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADUserRiskEvents",
+ "lastDataReceivedQuery": "AADUserRiskEvents\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADRiskyUsers",
+ "lastDataReceivedQuery": "AADRiskyUsers\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "NetworkAccessTraffic",
+ "lastDataReceivedQuery": "NetworkAccessTraffic\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADRiskyServicePrincipals",
+ "lastDataReceivedQuery": "AADRiskyServicePrincipals\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ },
+ {
+ "name": "AADServicePrincipalRiskEvents",
+ "lastDataReceivedQuery": "AADServicePrincipalRiskEvents\n | summarize Time = max(TimeGenerated)\n | where isnotempty(Time)"
+ }
+ ],
+ "connectivityCriterias": [
+ {
+ "type": "IsConnectedQuery",
+ "value": [
+ "SigninLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AuditLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADNonInteractiveUserSignInLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADServicePrincipalSignInLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADManagedIdentitySignInLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADProvisioningLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "ADFSSignInLogs\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADUserRiskEvents\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADRiskyUsers\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "NetworkAccessTraffic\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADRiskyServicePrincipals\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)",
+ "AADServicePrincipalRiskEvents\n | summarize LastLogReceived = max(TimeGenerated)\n | project IsConnected = LastLogReceived > ago(7d)"
+ ]
+ }
+ ],
+ "id": "[variables('_uiConfigId1')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('workbookTemplateSpecName1')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "AzureActiveDirectoryAuditLogsWorkbook Workbook with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('workbookVersion1')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.Insights/workbooks",
+ "name": "[variables('workbookContentId1')]",
+ "location": "[parameters('workspace-location')]",
+ "kind": "shared",
+ "apiVersion": "2021-08-01",
+ "metadata": {
+ "description": "Gain insights into Azure Active Directory by connecting Microsoft Sentinel and using the audit logs to gather insights around Azure AD scenarios. \nYou can learn about user operations, including password and group management, device activities, and top active users and apps."
+ },
"properties": {
- "displayName": "[[variables('Office365ConnectionName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
- }
+ "displayName": "[parameters('workbook1-name')]",
+ "serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"## Azure AD audit logs\"},\"name\":\"text - 1\"},{\"type\":9,\"content\":{\"version\":\"KqlParameterItem/1.0\",\"parameters\":[{\"id\":\"bc372bf5-2dcd-4efa-aa85-94b6e6fafe14\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"TimeRange\",\"type\":4,\"isRequired\":true,\"value\":{\"durationMs\":7776000000},\"typeSettings\":{\"selectableValues\":[{\"durationMs\":300000},{\"durationMs\":900000},{\"durationMs\":1800000},{\"durationMs\":3600000},{\"durationMs\":14400000},{\"durationMs\":43200000},{\"durationMs\":86400000},{\"durationMs\":172800000},{\"durationMs\":259200000},{\"durationMs\":604800000},{\"durationMs\":1209600000},{\"durationMs\":2419200000},{\"durationMs\":2592000000},{\"durationMs\":5184000000},{\"durationMs\":7776000000}],\"allowCustom\":true}},{\"id\":\"e032b9f7-5449-4180-9c20-75760afa96f6\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"User\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"AuditLogs\\r\\n| where SourceSystem == \\\"Azure AD\\\"\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n//| where initiator!= \\\"\\\"\\r\\n| summarize Count = count() by initiator\\r\\n| order by Count desc, initiator asc\\r\\n| project Value = initiator, Label = strcat(initiator, ' - ', Count), Selected = false\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"All\"},\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"0a59a0b3-6d93-4fee-bdbe-147383c510c6\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Category\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"AuditLogs\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiator in ({User})\\r\\n| summarize Count = count() by Category\\r\\n| order by Count desc, Category asc\\r\\n| project Value = Category, Label = strcat(Category, ' - ', Count)\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"All\"},\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"4d2b245b-5e59-4eb6-9f51-ba926581ab47\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Result\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"AuditLogs\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiator in ({User})\\r\\n| summarize Count = count() by Result\\r\\n| order by Count desc, Result asc\\r\\n| project Value = Result, Label = strcat(Result, ' - ', Count, ' sign-ins')\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"All\"},\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"}],\"style\":\"pills\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},\"name\":\"parameters - 1\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let data = AuditLogs\\r\\n| where \\\"{Category:lable}\\\" == \\\"All\\\" or Category in ({Category})\\r\\n| where \\\"{Result:lable}\\\" == \\\"All\\\" or Result in ({Result})\\r\\n| extend initiatingUserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)\\r\\n| where initiatingUserPrincipalName != \\\"\\\" \\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiatingUserPrincipalName in ({User});\\r\\ndata\\r\\n| summarize Count = count() by Category\\r\\n| join kind = fullouter (datatable(Category:string)['Medium', 'high', 'low']) on Category\\r\\n| project Category = iff(Category == '', Category1, Category), Count = iff(Category == '', 0, Count)\\r\\n| join kind = inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by Category)\\r\\n on Category\\r\\n| project-away Category1, TimeGenerated\\r\\n| extend Category = Category\\r\\n| union (\\r\\n data \\r\\n | summarize Count = count() \\r\\n | extend jkey = 1\\r\\n | join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain}\\r\\n | extend jkey = 1) on jkey\\r\\n | extend Category = 'All', Categorys = '*' \\r\\n)\\r\\n| order by Count desc\\r\\n| take 10\",\"size\":4,\"title\":\"Categories volume\",\"timeContext\":{\"durationMs\":7776000000},\"timeContextFromParameter\":\"TimeRange\",\"exportFieldName\":\"Category\",\"exportParameterName\":\"CategoryFIlter\",\"exportDefaultValue\":\"All\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"tiles\",\"tileSettings\":{\"titleContent\":{\"columnMatch\":\"Category\",\"formatter\":1,\"formatOptions\":{\"showIcon\":true}},\"leftContent\":{\"columnMatch\":\"Count\",\"formatter\":12,\"formatOptions\":{\"palette\":\"auto\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\",\"maximumFractionDigits\":2,\"maximumSignificantDigits\":3}}},\"secondaryContent\":{\"columnMatch\":\"Trend\",\"formatter\":21,\"formatOptions\":{\"palette\":\"purple\",\"showIcon\":true}},\"showBorder\":false}},\"name\":\"query - 4\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let data = AuditLogs\\r\\n| where \\\"{Result:lable}\\\" == \\\"All\\\" or Result in ({Result})\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiator in ({User})\\r\\n| where \\\"{Category:lable}\\\" == \\\"All\\\" or Category in ({Category})\\r\\n| where Category == '{CategoryFIlter}' or '{CategoryFIlter}' == \\\"All\\\";\\r\\nlet appData = data\\r\\n| summarize TotalCount = count() by OperationName, Category\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by OperationName\\r\\n | project-away TimeGenerated) on OperationName\\r\\n| order by TotalCount desc, OperationName asc\\r\\n| project OperationName, TotalCount, Trend, Category\\r\\n| serialize Id = row_number();\\r\\ndata\\r\\n| summarize TotalCount = count() by initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\"), Category, OperationName\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by OperationName, initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n | project-away TimeGenerated) on OperationName, initiator\\r\\n| order by TotalCount desc, OperationName asc\\r\\n| project OperationName, initiator, TotalCount, Category, Trend\\r\\n| serialize Id = row_number(1000000)\\r\\n| join kind=inner (appData) on OperationName\\r\\n| project Id, Name = initiator, Type = 'initiator', ['Operations Count'] = TotalCount, Trend, Category, ParentId = Id1\\r\\n| union (appData \\r\\n | project Id, Name = OperationName, Type = 'Operation', ['Operations Count'] = TotalCount, Category, Trend)\\r\\n| order by ['Operations Count'] desc, Name asc\",\"size\":0,\"showAnalytics\":true,\"title\":\"User activities\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"exportParameterName\":\"UserInfo\",\"exportDefaultValue\":\"{ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"}\",\"showExportToExcel\":true,\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Operations Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"turquoise\",\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"ParentId\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"rowLimit\":1000,\"filter\":true,\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"ParentId\",\"treeType\":0,\"expanderColumn\":\"Name\"}}},\"customWidth\":\"70\",\"showPin\":true,\"name\":\"query - 2\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let details = dynamic({UserInfo});\\r\\nAuditLogs\\r\\n| where \\\"{Category:lable}\\\" == \\\"All\\\" or Category in ({Category})\\r\\n| where \\\"{Result:lable}\\\" == \\\"All\\\" or Result in ({Result})\\r\\n| extend initiatingUserPrincipalName = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n//| where initiatingUserPrincipalName != \\\"\\\" \\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiatingUserPrincipalName in ({User})\\r\\n| where details.Type == '*' or (details.Type == 'initiator' and initiatingUserPrincipalName == details.Name) or (details.Type == 'Operation' and OperationName == details.Name)\\r\\n| summarize Activities = count() by initiatingUserPrincipalName\\r\\n| sort by Activities desc nulls last \",\"size\":0,\"title\":\"Top active users\",\"timeContext\":{\"durationMs\":7776000000},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"piechart\"},\"customWidth\":\"30\",\"name\":\"query - 3\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let details = dynamic({UserInfo});\\r\\nlet data = AuditLogs\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n| where details.Type == '*' or (details.Type == 'initiator' and initiator == details.Name) or (details.Type == 'Operation' and OperationName == details.Name)\\r\\n| where \\\"{Category:lable}\\\" == \\\"All\\\" or Category in ({Category})\\r\\n| where \\\"{Result:lable}\\\" == \\\"All\\\" or Result in ({Result})\\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiator in ({User});\\r\\nlet appData = data\\r\\n| summarize TotalCount = count() by Result\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Result\\r\\n | project-away TimeGenerated) on Result\\r\\n| order by TotalCount desc, Result asc\\r\\n| project Result, TotalCount, Trend\\r\\n| serialize Id = row_number();\\r\\ndata\\r\\n| summarize TotalCount = count() by OperationName, Result\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Result, OperationName\\r\\n | project-away TimeGenerated) on Result, OperationName\\r\\n| order by TotalCount desc, Result asc\\r\\n| project Result, OperationName, TotalCount, Trend\\r\\n| serialize Id = row_number(1000000)\\r\\n| join kind=inner (appData) on Result\\r\\n| project Id, Name = OperationName, Type = 'Operation', ['Results Count'] = TotalCount, Trend, ParentId = Id1\\r\\n| union (appData \\r\\n | project Id, Name = Result, Type = 'Result', ['Results Count'] = TotalCount, Trend)\\r\\n| order by ['Results Count'] desc, Name asc\",\"size\":0,\"title\":\"Result status\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"exportParameterName\":\"ResultInfo\",\"exportDefaultValue\":\"{ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"}\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5},{\"columnMatch\":\"Type\",\"formatter\":5},{\"columnMatch\":\"Results Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"grayBlue\"}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"palette\":\"greenDark\"}},{\"columnMatch\":\"ParentId\",\"formatter\":5}],\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"ParentId\",\"treeType\":0,\"expanderColumn\":\"Name\"}}},\"customWidth\":\"70\",\"name\":\"query - 5\"}],\"fallbackResourceIds\":[\"\"],\"fromTemplateId\":\"sentinel-AzureActiveDirectoryAuditLogs\",\"$schema\":\"https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json\"}\r\n",
+ "version": "1.0",
+ "sourceId": "[variables('workspaceResourceId')]",
+ "category": "sentinel"
}
},
{
- "type": "Microsoft.Logic/workflows",
- "apiVersion": "2017-07-01",
- "name": "[[parameters('PlaybookName')]",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Block-AADUser_alert",
- "hidden-SentinelTemplateVersion": "1.1",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]"
- ],
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Workbook-', last(split(variables('workbookId1'),'/'))))]",
"properties": {
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_alert": {
- "type": "ApiConnectionWebhook",
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "path": "/subscribe"
- }
- }
- },
- "actions": {
- "Alert_-_Get_incident": {
- "type": "ApiConnection",
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "get",
- "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
- }
- },
- "Entities_-_Get_Accounts": {
- "runAfter": {
- "Alert_-_Get_incident": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": "@triggerBody()?['Entities']",
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/entities/account"
- }
+ "description": "@{workbookKey=AzureActiveDirectoryAuditLogsWorkbook; logoFileName=azureactivedirectory_logo.svg; description=Gain insights into Azure Active Directory by connecting Microsoft Sentinel and using the audit logs to gather insights around Azure AD scenarios. \nYou can learn about user operations, including password and group management, device activities, and top active users and apps.; dataTypesDependencies=System.Object[]; dataConnectorsDependencies=System.Object[]; previewImagesFileNames=System.Object[]; version=1.2.0; title=Azure AD Audit logs; templateRelativePath=AzureActiveDirectoryAuditLogs.json; subtitle=; provider=Microsoft}.description",
+ "parentId": "[variables('workbookId1')]",
+ "contentId": "[variables('_workbookContentId1')]",
+ "kind": "Workbook",
+ "version": "[variables('workbookVersion1')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ },
+ "dependencies": {
+ "operator": "AND",
+ "criteria": [
+ {
+ "contentId": "AuditLogs",
+ "kind": "DataType"
},
- "For_each": {
- "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
- "actions": {
- "Condition": {
- "actions": {
- "Condition_-_if_user_have_manager": {
- "actions": {
- "Add_comment_to_incident_-_with_manager_-_no_admin": {
- "runAfter": {
- "Get_user_-_details": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "message": "
User @{items('For_each')?['Name']} (UPN - @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}) was disabled in AAD via playbook Block-AADUser. Manager (@{body('Parse_JSON_-_get_user_manager')?['userPrincipalName']}) is notified.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- },
- "Get_user_-_details": {
- "type": "ApiConnection",
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuread']['connectionId']"
- }
- },
- "method": "get",
- "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}"
- }
- },
- "Send_an_email_-_to_manager_-_no_admin": {
- "runAfter": {
- "Add_comment_to_incident_-_with_manager_-_no_admin": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "Body": "Security notification! This is automated email sent by Microsoft Sentinel Automation!
\n
\nYour direct report @{items('For_each')?['Name']} has been disabled in Azure AD due to the security incident. Can you please notify the user and work with him to reach our support.
\n
\nDirect report details:
\nFirst name: @{body('Get_user_-_details')?['displayName']}
\nSurname: @{body('Get_user_-_details')?['surname']}
\nJob title: @{body('Get_user_-_details')?['jobTitle']}
\nOffice location: @{body('Get_user_-_details')?['officeLocation']}
\nBusiness phone: @{body('Get_user_-_details')?['businessPhones']}
\nMobile phone: @{body('Get_user_-_details')?['mobilePhone']}
\nMail: @{body('Get_user_-_details')?['mail']}
\n
\nThank you!
",
- "Importance": "High",
- "Subject": "@{items('For_each')?['Name']} has been disabled in Azure AD due to the security risk!",
- "To": "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "method": "post",
- "path": "/v2/Mail"
- }
- }
- },
- "runAfter": {
- "Parse_JSON_-_get_user_manager": [
- "Succeeded"
- ]
- },
- "else": {
- "actions": {
- "Add_comment_to_incident_-_no_manager_-_no_admin": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "message": "User @{items('For_each')?['Name']} (UPN - @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}) was disabled in AAD via playbook Block-AADUser. Manager has not been notified, since it is not found for this user!
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- }
- },
- "expression": {
- "and": [
- {
- "not": {
- "equals": [
- "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']",
- "@null"
- ]
- }
- }
- ]
- },
- "type": "If"
- },
- "HTTP_-_get_user_manager": {
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com/",
- "type": "ManagedServiceIdentity"
- },
- "method": "GET",
- "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/manager"
- }
- },
- "Parse_JSON_-_get_user_manager": {
- "runAfter": {
- "HTTP_-_get_user_manager": [
- "Succeeded",
- "Failed"
- ]
- },
- "type": "ParseJson",
- "inputs": {
- "content": "@body('HTTP_-_get_user_manager')",
- "schema": {
- "properties": {
- "userPrincipalName": {
- "type": "string"
- }
- },
- "type": "object"
- }
- }
- }
- },
- "runAfter": {
- "Update_user_-_disable_user": [
- "Succeeded",
- "Failed"
- ]
- },
- "else": {
- "actions": {
- "Add_comment_to_incident_-_error_details": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "message": "Block-AADUser playbook could not disable user @{items('For_each')?['Name']}.
\nError message: @{body('Update_user_-_disable_user')['error']['message']}
\nNote: If user is admin, this playbook don't have privilages to block admin users!
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- }
- },
- "expression": {
- "and": [
- {
- "equals": [
- "@body('Update_user_-_disable_user')",
- "@null"
- ]
- }
- ]
- },
- "type": "If"
- },
- "Update_user_-_disable_user": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "accountEnabled": false
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuread']['connectionId']"
- }
- },
- "method": "patch",
- "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}"
- }
- }
- },
- "runAfter": {
- "Entities_-_Get_Accounts": [
- "Succeeded"
- ]
- },
- "type": "Foreach"
- }
- }
- },
- "parameters": {
- "$connections": {
- "value": {
- "azuread": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "connectionName": "[[variables('AzureADConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
- },
- "microsoftsentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
- },
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "connectionName": "[[variables('Office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
- }
+ {
+ "contentId": "AzureActiveDirectory",
+ "kind": "DataConnector"
}
- }
- }
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId1'),'/'))))]",
- "properties": {
- "parentId": "[variables('playbookId1')]",
- "contentId": "[variables('_playbookContentId1')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion1')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
+ ]
}
}
}
- ],
- "metadata": {
- "title": "Block AAD user - Alert",
- "description": "For each account entity included in the alert, this playbook will disable the user in Azure Active Directoy, add a comment to the incident that contains this alert and notify manager if available. Note: This playbook will not disable admin user!",
- "prerequisites": [
- "None"
- ],
- "postDeployment": [
- "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
- "2. Grant User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All permissions to the managed identity.",
- "3. Authorize Azure AD and Office 365 Outlook Logic App connections."
- ],
- "lastUpdateTime": "2022-07-11T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": [
- {
- "version": "1.0.0",
- "title": "Added manager notification action",
- "notes": [
- "Initial version"
- ]
- }
- ]
- }
+ ]
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId1')]",
- "contentKind": "Playbook",
- "displayName": "Block-AADUser-Alert",
- "contentProductId": "[variables('_playbookcontentProductId1')]",
- "id": "[variables('_playbookcontentProductId1')]",
- "version": "[variables('playbookVersion1')]"
+ "contentId": "[variables('_workbookContentId1')]",
+ "contentKind": "Workbook",
+ "displayName": "[parameters('workbook1-name')]",
+ "contentProductId": "[variables('_workbookcontentProductId1')]",
+ "id": "[variables('_workbookcontentProductId1')]",
+ "version": "[variables('workbookVersion1')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName2')]",
+ "name": "[variables('workbookTemplateSpecName2')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Block-AADUser-EntityTrigger Playbook with template version 3.0.3",
+ "description": "AzureActiveDirectorySigninsWorkbook Workbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion2')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Block-AADUser-EntityTrigger",
- "type": "string"
- }
- },
- "variables": {
- "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
- "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
- "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
- "_connection-1": "[[variables('connection-1')]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-3": "[[variables('connection-3')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
+ "contentVersion": "[variables('workbookVersion2')]",
+ "parameters": {},
+ "variables": {},
"resources": [
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('AzureADConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
+ "type": "Microsoft.Insights/workbooks",
+ "name": "[variables('workbookContentId2')]",
+ "location": "[parameters('workspace-location')]",
+ "kind": "shared",
+ "apiVersion": "2021-08-01",
+ "metadata": {
+ "description": "Gain insights into Azure Active Directory by connecting Microsoft Sentinel and using the sign-in logs to gather insights around Azure AD scenarios. \nYou can learn about sign-in operations, such as user sign-ins and locations, email addresses, and IP addresses of your users, as well as failed activities and the errors that triggered the failures."
+ },
"properties": {
- "displayName": "[[variables('AzureADConnectionName')]",
- "api": {
- "id": "[[variables('_connection-1')]"
- }
+ "displayName": "[parameters('workbook2-name')]",
+ "serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"## Sign-in Analysis\"},\"name\":\"text - 0\"},{\"type\":9,\"content\":{\"version\":\"KqlParameterItem/1.0\",\"parameters\":[{\"id\":\"13f56671-7604-4427-a4d8-663f3da0cbc5\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"TimeRange\",\"type\":4,\"isRequired\":true,\"value\":{\"durationMs\":1209600000},\"typeSettings\":{\"selectableValues\":[{\"durationMs\":300000,\"createdTime\":\"2018-11-13T19:33:10.162Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":900000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":1800000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":3600000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":14400000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":43200000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":86400000,\"createdTime\":\"2018-11-13T19:33:10.165Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":172800000,\"createdTime\":\"2018-11-13T19:33:10.166Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":259200000,\"createdTime\":\"2018-11-13T19:33:10.166Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":604800000,\"createdTime\":\"2018-11-13T19:33:10.166Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":1209600000,\"createdTime\":\"2018-11-13T19:33:10.166Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":2592000000,\"createdTime\":\"2018-11-13T19:33:10.167Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false}],\"allowCustom\":true}},{\"id\":\"3b5cc420-8ad8-4523-ba28-a54910756794\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Apps\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"SigninLogs\\r\\n| summarize Count = count() by AppDisplayName\\r\\n| order by Count desc, AppDisplayName asc\\r\\n| project Value = AppDisplayName, Label = strcat(AppDisplayName, ' - ', Count, ' sign-ins'), Selected = false\\r\\n\",\"value\":[\"value::all\"],\"typeSettings\":{\"limitSelectTo\":10,\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"*\"},\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"0611ecce-d6a0-4a6f-a1bc-6be314ae36a7\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"UserNamePrefix\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"SigninLogs\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n| summarize Count = count() by UserDisplayName\\r\\n| order by Count desc, UserDisplayName asc\\r\\n| project Value = UserDisplayName, Label = strcat(UserDisplayName, ' - ', Count, ' sign-ins'), Selected = false\\r\\n| extend prefix = substring(Value, 0, 1)\\r\\n| distinct prefix\\r\\n| sort by prefix asc\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"*\",\"showDefault\":false},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"f7f7970b-58c1-474f-9043-62243d2d4edd\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Users\",\"label\":\"UserName\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"SigninLogs\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n| summarize Count = count() by UserDisplayName\\r\\n| order by Count desc, UserDisplayName asc\\r\\n| project Value = UserDisplayName, Label = strcat(UserDisplayName, ' - ', Count, ' sign-ins'), Selected = false\\r\\n| where (substring(Value, 0, 1) in ({UserNamePrefix})) or ('*' in ({UserNamePrefix}))\\r\\n| sort by Value asc\\r\\n\",\"value\":[\"value::all\"],\"typeSettings\":{\"limitSelectTo\":10000000,\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"\",\"showDefault\":false},\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"85568f4e-9ad4-46c5-91d4-0ee1b2c8f3aa\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Category\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"\"},\"jsonData\":\"[\\\"SignInLogs\\\", \\\"NonInteractiveUserSignInLogs\\\"]\"}],\"style\":\"pills\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},\"name\":\"parameters - 1\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let data = \\r\\nunion SigninLogs,AADNonInteractiveUserSignInLogs\\r\\n| where Category in ({Category})\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users});\\r\\ndata\\r\\n| summarize count() by UserPrincipalName, bin (TimeGenerated,5m)\\r\\n\",\"size\":0,\"title\":\"Sign-in Trend over Time\",\"timeContext\":{\"durationMs\":86400000},\"timeContextFromParameter\":\"TimeRange\",\"timeBrushParameterName\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"timechart\"},\"name\":\"query - 19\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n| where Category in ({Category})\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend errorCode = Status.errorCode\\r\\n|extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\",errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\",errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012 ,\\\"Pending user action\\\", \\\"Failure\\\");\\r\\ndata\\r\\n| summarize Count = count() by SigninStatus\\r\\n| join kind = fullouter (datatable(SigninStatus:string)['Success', 'Pending action (Interrupts)', 'Failure']) on SigninStatus\\r\\n| project SigninStatus = iff(SigninStatus == '', SigninStatus1, SigninStatus), Count = iff(SigninStatus == '', 0, Count)\\r\\n| join kind = inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by SigninStatus)\\r\\n on SigninStatus\\r\\n| project-away SigninStatus1, TimeGenerated\\r\\n| extend Status = SigninStatus\\r\\n| union (\\r\\n data \\r\\n | summarize Count = count()\\r\\n | extend jkey = 1\\r\\n | join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain}\\r\\n | extend jkey = 1) on jkey\\r\\n | extend SigninStatus = 'All Sign-ins', Status = '*' \\r\\n)\\r\\n| order by Count desc\\r\\n\\r\\n\\r\\n\\r\\n\",\"size\":3,\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"exportFieldName\":\"Status\",\"exportParameterName\":\"SigninStatus\",\"exportDefaultValue\":\"*\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"tiles\",\"tileSettings\":{\"titleContent\":{\"columnMatch\":\"SigninStatus\",\"formatter\":1,\"formatOptions\":{\"showIcon\":true}},\"leftContent\":{\"columnMatch\":\"Count\",\"formatter\":12,\"formatOptions\":{\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\",\"maximumFractionDigits\":2,\"maximumSignificantDigits\":3}}},\"secondaryContent\":{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true}},\"showBorder\":false}},\"name\":\"query - 5\"},{\"type\":1,\"content\":{\"json\":\"
\\r\\n💡 _Click on a tile or a row in the grid to drill-in further_\"},\"name\":\"text - 6 - Copy\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n| extend AppDisplayName = iff(AppDisplayName == '', 'Unknown', AppDisplayName)\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend Country = iff(LocationDetails.countryOrRegion == '', 'Unknown country', tostring(LocationDetails.countryOrRegion))\\r\\n| extend City = iff(LocationDetails.city == '', 'Unknown city', tostring(LocationDetails.city))\\r\\n| extend errorCode = Status.errorCode\\r\\n| extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\",errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\",errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012 ,\\\"Pending user action\\\", \\\"Failure\\\")\\r\\n| where SigninStatus == '{SigninStatus}' or '{SigninStatus}' == '*' or '{SigninStatus}' == 'All Sign-ins';\\r\\nlet countryData = data\\r\\n| summarize TotalCount = count(), SuccessCount = countif(SigninStatus == \\\"Success\\\"), FailureCount = countif(SigninStatus == \\\"Failure\\\"), InterruptCount = countif(SigninStatus == \\\"Pending user action\\\") by Country,Category\\r\\n| join kind=inner\\r\\n(\\r\\n data\\r\\n| make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Country\\r\\n| project-away TimeGenerated\\r\\n)\\r\\non Country\\r\\n| project Country, TotalCount, SuccessCount,FailureCount,InterruptCount,Trend,Category\\r\\n| order by TotalCount desc, Country asc;\\r\\ndata\\r\\n| summarize TotalCount = count(), SuccessCount = countif(SigninStatus == \\\"Success\\\"), FailureCount = countif(SigninStatus == \\\"Failure\\\"), InterruptCount = countif(SigninStatus == \\\"Pending user action\\\") by Country, City,Category\\r\\n| join kind=inner\\r\\n(\\r\\n data \\r\\n| make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Country, City\\r\\n| project-away TimeGenerated\\r\\n)\\r\\non Country, City\\r\\n| order by TotalCount desc, Country asc\\r\\n| project Country, City,TotalCount, SuccessCount,FailureCount,InterruptCount, Trend,Category\\r\\n| join kind=inner\\r\\n(\\r\\n countryData\\r\\n)\\r\\non Country\\r\\n| project Id = City, Name = City, Type = 'City', ['Sign-in Count'] = TotalCount, Trend, ['Failure Count'] = FailureCount, ['Interrupt Count'] = InterruptCount, ['Success Rate'] = 1.0 * SuccessCount / TotalCount, ParentId = Country,Category\\r\\n| union (countryData\\r\\n| project Id = Country, Name = Country, Type = 'Country', ['Sign-in Count'] = TotalCount, Trend, ['Failure Count'] = FailureCount, ['Interrupt Count'] = InterruptCount, ['Success Rate'] = 1.0 * SuccessCount / TotalCount, ParentId = 'root',Category)\\r\\n| where Category in ({Category})\\r\\n| order by ['Sign-in Count'] desc, Name asc\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Sign-ins by Location\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeBrush\",\"showRefreshButton\":true,\"exportMultipleValues\":true,\"exportedParameters\":[{\"fieldName\":\"Name\",\"parameterName\":\"LocationDetail\",\"parameterType\":1}],\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Sign-in Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true}},{\"columnMatch\":\"Failure Count|Interrupt Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"orange\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Success Rate\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"percent\"}}},{\"columnMatch\":\"ParentId\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true,\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"ParentId\",\"treeType\":0,\"expanderColumn\":\"Name\",\"expandTopLevel\":false}}},\"customWidth\":\"67\",\"showPin\":true,\"name\":\"query - 8\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let selectedCountry = dynamic([{LocationDetail}]);\\r\\nlet nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails),Status = parse_json(Status),ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies),DeviceDetail =parse_json(DeviceDetail);\\r\\nlet details = dynamic({ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"});\\r\\nlet data = union SigninLogs,nonInteractive\\r\\n| extend AppDisplayName = iff(AppDisplayName == '', 'Unknown', AppDisplayName)\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend Country = tostring(LocationDetails.countryOrRegion)\\r\\n| extend City = tostring(LocationDetails.city) \\r\\n| where array_length(selectedCountry) == 0 or \\\"*\\\" in (selectedCountry) or Country in (selectedCountry) or City in (selectedCountry) \\r\\n| extend errorCode = Status.errorCode\\r\\n| extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\",errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\",errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012 ,\\\"Pending user action\\\", \\\"Failure\\\")\\r\\n| where SigninStatus == '{SigninStatus}' or '{SigninStatus}' == '*' or '{SigninStatus}' == 'All Sign-ins'\\r\\n| where details.Type == '*' or (details.Type == 'Country' and Country == details.Name) or (details.Type == 'City' and City == details.Name);\\r\\ndata\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project User = UserDisplayName, ['Sign-in Status'] = strcat(iff(SigninStatus == 'Success', '✔️', '❌'), ' ', SigninStatus), ['Sign-in Time'] = TimeAgo, App = AppDisplayName, ['Error code'] = errorCode, ['Result type'] = ResultType, ['Result signature'] = ResultSignature, ['Result description'] = ResultDescription, ['Conditional access policies'] = ConditionalAccessPolicies, ['Conditional access status'] = ConditionalAccessStatus, ['Operating system'] = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser, ['Country or region'] = LocationDetails.countryOrRegion, ['State'] = LocationDetails.state, ['City'] = LocationDetails.city, ['Time generated'] = TimeGenerated, Status, ['User principal name'] = UserPrincipalName, Category\\r\\n| where Category in ({Category})\\r\\n\\r\\n\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Location Sign-in details\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Sign-in Status\",\"formatter\":7,\"formatOptions\":{\"linkTarget\":\"CellDetails\",\"showIcon\":true}},{\"columnMatch\":\"App\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Error code\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result signature\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result description\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access policies\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Operating system\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Browser\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Time generated\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"User principal name\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"TimeGenerated\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true}},\"customWidth\":\"33\",\"name\":\"query - 8\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs | extend LocationDetails = parse_json(LocationDetails), Status = parse_json(Status), DeviceDetail = parse_json(DeviceDetail);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n | extend errorCode = Status.errorCode\\r\\n | extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\", errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\", errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012, \\\"Pending user action\\\", \\\"Failure\\\")\\r\\n| where SigninStatus == '{SigninStatus}' or '{SigninStatus}' == '*' or '{SigninStatus}' == 'All Sign-ins';\\r\\nlet appData = data\\r\\n | summarize TotalCount = count(), SuccessCount = countif(SigninStatus == \\\"Success\\\"), FailureCount = countif(SigninStatus == \\\"Failure\\\"), InterruptCount = countif(SigninStatus == \\\"Pending user action\\\") by Os = tostring(DeviceDetail.operatingSystem) ,Category\\r\\n | where Os != ''\\r\\n | join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Os = tostring(DeviceDetail.operatingSystem)\\r\\n | project-away TimeGenerated)\\r\\n on Os\\r\\n | order by TotalCount desc, Os asc\\r\\n | project Os, TotalCount, SuccessCount, FailureCount, InterruptCount, Trend,Category\\r\\n | serialize Id = row_number();\\r\\ndata\\r\\n| summarize TotalCount = count(), SuccessCount = countif(SigninStatus == \\\"Success\\\"), FailureCount = countif(SigninStatus == \\\"Failure\\\"), InterruptCount = countif(SigninStatus == \\\"Pending user action\\\") by Os = tostring(DeviceDetail.operatingSystem), Browser = tostring(DeviceDetail.browser),Category\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain})by Os = tostring(DeviceDetail.operatingSystem), Browser = tostring(DeviceDetail.browser)\\r\\n | project-away TimeGenerated)\\r\\n on Os, Browser\\r\\n| order by TotalCount desc, Os asc\\r\\n| project Os, Browser, TotalCount, SuccessCount, FailureCount, InterruptCount, Trend,Category\\r\\n| serialize Id = row_number(1000000)\\r\\n| join kind=inner (appData) on Os\\r\\n| project Id, Name = Browser, Type = 'Browser', ['Sign-in Count'] = TotalCount, Trend, ['Failure Count'] = FailureCount, ['Interrupt Count'] = InterruptCount, ['Success Rate'] = 1.0 * SuccessCount / TotalCount, ParentId = Id1,Category\\r\\n| union (appData \\r\\n | project Id, Name = Os, Type = 'Operating System', ['Sign-in Count'] = TotalCount, Trend, ['Failure Count'] = FailureCount, ['Interrupt Count'] = InterruptCount, ['Success Rate'] = 1.0 * SuccessCount / TotalCount, ParentId = -1,Category)\\r\\n| where Category in ({Category})\\r\\n| order by ['Sign-in Count'] desc, Name asc\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Sign-ins by Device\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeBrush\",\"exportedParameters\":[{\"parameterName\":\"DeviceDetail\",\"defaultValue\":\"{ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"}\"},{\"fieldName\":\"Category\",\"parameterName\":\"exportCategory\",\"parameterType\":1,\"defaultValue\":\"*\"},{\"fieldName\":\"Name\",\"parameterName\":\"exportName\",\"parameterType\":1,\"defaultValue\":\"*\"}],\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Sign-in Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Failure Count|Interrupt Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"orange\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Success Rate\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"percent\"}}},{\"columnMatch\":\"ParentId\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true,\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"ParentId\",\"treeType\":0,\"expanderColumn\":\"Name\",\"expandTopLevel\":false}}},\"customWidth\":\"67\",\"showPin\":true,\"name\":\"query - 9\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails),Status = parse_json(Status),ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies),DeviceDetail =parse_json(DeviceDetail);\\r\\nlet details = dynamic({ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"});\\r\\nlet data = union SigninLogs,nonInteractive\\r\\n| extend AppDisplayName = iff(AppDisplayName == '', 'Unknown', AppDisplayName)\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend Country = tostring(LocationDetails.countryOrRegion)\\r\\n| extend City = tostring(LocationDetails.city)\\r\\n| extend errorCode = Status.errorCode\\r\\n| extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\",errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\",errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012 ,\\\"Pending user action\\\", \\\"Failure\\\")\\r\\n| where SigninStatus == '{SigninStatus}' or '{SigninStatus}' == '*' or '{SigninStatus}' == 'All Sign-ins'\\r\\n| where details.Type == '*' or (details.Type == 'Country' and Country == details.Name) or (details.Type == 'City' and City == details.Name);\\r\\ndata\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project User = UserDisplayName, ['Sign-in Status'] = strcat(iff(SigninStatus == 'Success', '✔️', '❌'), ' ', SigninStatus), ['Sign-in Time'] = TimeAgo, App = AppDisplayName, ['Error code'] = errorCode, ['Result type'] = ResultType, ['Result signature'] = ResultSignature, ['Result description'] = ResultDescription, ['Conditional access policies'] = ConditionalAccessPolicies, ['Conditional access status'] = ConditionalAccessStatus, ['Operating system'] = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser, ['Country or region'] = LocationDetails.countryOrRegion, ['State'] = LocationDetails.state, ['City'] = LocationDetails.city, ['Time generated'] = TimeGenerated, Status, ['User principal name'] = UserPrincipalName, Category, Name = tostring(DeviceDetail.operatingSystem)\\r\\n| where Category in ('{exportCategory}') or \\\"*\\\" in ('{exportCategory}')\\r\\n| where Name in ('{exportName}') or \\\"*\\\" in ('{exportName}')\",\"size\":1,\"showAnalytics\":true,\"title\":\"Device Sign-in details\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Sign-in Status\",\"formatter\":7,\"formatOptions\":{\"linkTarget\":\"CellDetails\"}},{\"columnMatch\":\"App\",\"formatter\":5},{\"columnMatch\":\"Error code\",\"formatter\":5},{\"columnMatch\":\"Result type\",\"formatter\":5},{\"columnMatch\":\"Result signature\",\"formatter\":5},{\"columnMatch\":\"Result description\",\"formatter\":5},{\"columnMatch\":\"Conditional access policies\",\"formatter\":5},{\"columnMatch\":\"Conditional access status\",\"formatter\":5},{\"columnMatch\":\"Operating system\",\"formatter\":5},{\"columnMatch\":\"Browser\",\"formatter\":5},{\"columnMatch\":\"Country or region\",\"formatter\":5},{\"columnMatch\":\"State\",\"formatter\":5},{\"columnMatch\":\"City\",\"formatter\":5},{\"columnMatch\":\"Time generated\",\"formatter\":5},{\"columnMatch\":\"Status\",\"formatter\":5},{\"columnMatch\":\"User principal name\",\"formatter\":5},{\"columnMatch\":\"Category\",\"formatter\":5},{\"columnMatch\":\"Name\",\"formatter\":5}],\"filter\":true}},\"customWidth\":\"33\",\"name\":\"query - 8 - Copy\"},{\"type\":1,\"content\":{\"json\":\"## Sign-ins using Conditional Access\"},\"name\":\"text - 12\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend CAStatus = case(ConditionalAccessStatus ==\\\"success\\\",\\\"Successful\\\",\\r\\n ConditionalAccessStatus == \\\"failure\\\", \\\"Failed\\\", \\r\\n ConditionalAccessStatus == \\\"notApplied\\\", \\\"Not applied\\\", \\r\\n isempty(ConditionalAccessStatus), \\\"Not applied\\\", \\r\\n \\\"Disabled\\\")\\r\\n|mvexpand ConditionalAccessPolicies\\r\\n|extend CAGrantControlName = tostring(ConditionalAccessPolicies.enforcedGrantControls[0])\\r\\n|extend CAGrantControl = case(CAGrantControlName contains \\\"MFA\\\", \\\"Require MFA\\\", \\r\\n CAGrantControlName contains \\\"Terms of Use\\\", \\\"Require Terms of Use\\\", \\r\\n CAGrantControlName contains \\\"Privacy\\\", \\\"Require Privacy Statement\\\", \\r\\n CAGrantControlName contains \\\"Device\\\", \\\"Require Device Compliant\\\", \\r\\n CAGrantControlName contains \\\"Azure AD Joined\\\", \\\"Require Hybird Azure AD Joined Device\\\", \\r\\n CAGrantControlName contains \\\"Apps\\\", \\\"Require Approved Apps\\\",\\r\\n \\\"Other\\\");\\r\\ndata\\r\\n| where Category in ({Category})\\r\\n| summarize Count = dcount(Id) by CAStatus\\r\\n| join kind = inner (data\\r\\n | make-series Trend = dcount(Id) default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by CAStatus\\r\\n ) on CAStatus\\r\\n| project-away CAStatus1, TimeGenerated\\r\\n| order by Count desc\",\"size\":4,\"title\":\"Conditional access status\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"tiles\",\"tileSettings\":{\"titleContent\":{\"columnMatch\":\"CAStatus\",\"formatter\":1},\"subtitleContent\":{\"columnMatch\":\"Category\"},\"leftContent\":{\"columnMatch\":\"Count\",\"formatter\":12,\"formatOptions\":{\"palette\":\"auto\"},\"numberFormat\":{\"unit\":17,\"options\":{\"maximumSignificantDigits\":3,\"maximumFractionDigits\":2}}},\"showBorder\":false}},\"name\":\"query - 9\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend errorCode = toint(Status.errorCode)\\r\\n|extend Reason = tostring(Status.failureReason)\\r\\n|extend CAStatus = case(ConditionalAccessStatus ==0,\\\"✔️ Success\\\", \\r\\n ConditionalAccessStatus == 1, \\\"❌ Failure\\\", \\r\\n ConditionalAccessStatus == 2, \\\"⚠️ Not Applied\\\", \\r\\n ConditionalAccessStatus == \\\"\\\", \\\"⚠️ Not Applied\\\", \\r\\n \\\"🚫 Disabled\\\")\\r\\n|mvexpand ConditionalAccessPolicies\\r\\n|extend CAGrantControlName = tostring(ConditionalAccessPolicies.enforcedGrantControls[0])\\r\\n|extend CAGrantControl = case(CAGrantControlName contains \\\"MFA\\\", \\\"Require MFA\\\", \\r\\n CAGrantControlName contains \\\"Terms of Use\\\", \\\"Require Terms of Use\\\", \\r\\n CAGrantControlName contains \\\"Privacy\\\", \\\"Require Privacy Statement\\\", \\r\\n CAGrantControlName contains \\\"Device\\\", \\\"Require Device Compliant\\\", \\r\\n CAGrantControlName contains \\\"Azure AD Joined\\\", \\\"Require Hybird Azure AD Joined Device\\\", \\r\\n CAGrantControlName contains \\\"Apps\\\", \\\"Require Approved Apps\\\",\\\"Other\\\");\\r\\ndata\\r\\n| summarize Count = dcount(Id) by CAStatus, CAGrantControl\\r\\n| project Id = strcat(CAStatus, '/', CAGrantControl), Name = CAGrantControl, Parent = CAStatus, Count, Type = 'CAGrantControl'\\r\\n| join kind = inner (data\\r\\n | make-series Trend = dcount(Id) default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by CAStatus, CAGrantControl\\r\\n | project Id = strcat(CAStatus, '/', CAGrantControl), Trend\\r\\n ) on Id\\r\\n| project-away Id1\\r\\n| union (data\\r\\n | where Category in ({Category})\\r\\n | summarize Count = dcount(Id) by CAStatus\\r\\n | project Id = CAStatus, Name = CAStatus, Parent = '', Count, Type = 'CAStatus'\\r\\n | join kind = inner (data\\r\\n | make-series Trend = dcount(Id) default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by CAStatus\\r\\n | project Id = CAStatus, Trend\\r\\n ) on Id\\r\\n | project-away Id1)\\r\\n| order by Count desc\",\"size\":0,\"title\":\"Conditional access status\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"exportParameterName\":\"Detail\",\"exportDefaultValue\":\"{ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\", \\\"Parent\\\":\\\"*\\\"}\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Parent\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true}}],\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"Parent\",\"treeType\":0,\"expanderColumn\":\"Name\",\"expandTopLevel\":true}}},\"customWidth\":\"50\",\"name\":\"query - 10\",\"styleSettings\":{\"margin\":\"50\"}},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let details = dynamic({Detail});\\r\\nlet nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend errorCode = toint(Status.errorCode)\\r\\n|extend Reason = tostring(Status.failureReason)\\r\\n|extend CAStatus = case(ConditionalAccessStatus ==\\\"success\\\",\\\"✔️ Success\\\", \\r\\n ConditionalAccessStatus == \\\"failure\\\", \\\"❌ Failure\\\", \\r\\n ConditionalAccessStatus == \\\"notApplied\\\", \\\"⚠️ Not Applied\\\", \\r\\n ConditionalAccessStatus == \\\"\\\", \\\"⚠️ Not Applied\\\", \\r\\n \\\"🚫 Disabled\\\")\\r\\n|mvexpand ConditionalAccessPolicies\\r\\n|extend CAGrantControlName = tostring(ConditionalAccessPolicies.enforcedGrantControls[0])\\r\\n|extend CAGrantControl = case(CAGrantControlName contains \\\"MFA\\\", \\\"Require MFA\\\", \\r\\n CAGrantControlName contains \\\"Terms of Use\\\", \\\"Require Terms of Use\\\", \\r\\n CAGrantControlName contains \\\"Privacy\\\", \\\"Require Privacy Statement\\\", \\r\\n CAGrantControlName contains \\\"Device\\\", \\\"Require Device Compliant\\\", \\r\\n CAGrantControlName contains \\\"Azure AD Joined\\\", \\\"Require Hybird Azure AD Joined Device\\\", \\r\\n CAGrantControlName contains \\\"Apps\\\", \\\"Require Approved Apps\\\",\\r\\n \\\"Other\\\")\\r\\n|extend CAGrantControlRank = case(CAGrantControlName contains \\\"MFA\\\", 1, \\r\\n CAGrantControlName contains \\\"Terms of Use\\\", 2, \\r\\n CAGrantControlName contains \\\"Privacy\\\", 3, \\r\\n CAGrantControlName contains \\\"Device\\\", 4, \\r\\n CAGrantControlName contains \\\"Azure AD Joined\\\", 5, \\r\\n CAGrantControlName contains \\\"Apps\\\", 6,\\r\\n 7)\\r\\n| where details.Type == '*' or (details.Type == 'CAStatus' and CAStatus == details.Name) or (details.Type == 'CAGrantControl' and CAGrantControl == details.Name and CAStatus == details.Parent);\\r\\ndata\\r\\n| order by CAGrantControlRank desc\\r\\n| summarize CAGrantControls = make_set(CAGrantControl) by AppDisplayName, CAStatus, TimeGenerated, UserDisplayName, Category\\r\\n| extend CAGrantControlText = replace(@\\\",\\\", \\\", \\\", replace(@'\\\"', @'', replace(@\\\"\\\\]\\\", @\\\"\\\", replace(@\\\"\\\\[\\\", @\\\"\\\", tostring(CAGrantControls)))))\\r\\n| extend CAGrantControlSummary = case(array_length(CAGrantControls) > 1, strcat(CAGrantControls[0], ' + ', array_length(CAGrantControls) - 1, ' more'), array_length(CAGrantControls) == 1, tostring(CAGrantControls[0]), 'None')\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project Application = AppDisplayName, ['CA Status'] = CAStatus, ['CA Grant Controls'] = CAGrantControlSummary, ['All CA Grant Controls'] = CAGrantControlText, ['Sign-in Time'] = TimeAgo, ['User'] = UserDisplayName, Category\\r\\n| where Category in ({Category})\",\"size\":0,\"showAnalytics\":true,\"title\":\"Recent sign-ins\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"CA Grant Controls\",\"formatter\":1,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"All CA Grant Controls\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"User\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}]}},\"customWidth\":\"50\",\"showPin\":true,\"name\":\"query - 7 - Copy\"},{\"type\":1,\"content\":{\"json\":\"## Troubleshooting Sign-ins\"},\"name\":\"text - 13\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend errorCode = Status.errorCode\\r\\n|extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending action (Interrupts)\\\",errorCode == 50140, \\\"Pending action (Interrupts)\\\", errorCode == 51006, \\\"Pending action (Interrupts)\\\", errorCode == 50059, \\\"Pending action (Interrupts)\\\",errorCode == 65001, \\\"Pending action (Interrupts)\\\", errorCode == 52004, \\\"Pending action (Interrupts)\\\", errorCode == 50055, \\\"Pending action (Interrupts)\\\", errorCode == 50144, \\\"Pending action (Interrupts)\\\", errorCode == 50072, \\\"Pending action (Interrupts)\\\", errorCode == 50074, \\\"Pending action (Interrupts)\\\", errorCode == 16000, \\\"Pending action (Interrupts)\\\", errorCode == 16001, \\\"Pending action (Interrupts)\\\", errorCode == 16003, \\\"Pending action (Interrupts)\\\", errorCode == 50127, \\\"Pending action (Interrupts)\\\", errorCode == 50125, \\\"Pending action (Interrupts)\\\", errorCode == 50129, \\\"Pending action (Interrupts)\\\", errorCode == 50143, \\\"Pending action (Interrupts)\\\", errorCode == 81010, \\\"Pending action (Interrupts)\\\", errorCode == 81014, \\\"Pending action (Interrupts)\\\", errorCode == 81012 ,\\\"Pending action (Interrupts)\\\", \\\"Failure\\\");\\r\\ndata\\r\\n| summarize Count = count() by SigninStatus, Category\\r\\n| join kind = fullouter (datatable(SigninStatus:string)['Success', 'Pending action (Interrupts)', 'Failure']) on SigninStatus\\r\\n| project SigninStatus = iff(SigninStatus == '', SigninStatus1, SigninStatus), Count = iff(SigninStatus == '', 0, Count), Category\\r\\n| join kind = inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by SigninStatus)\\r\\n on SigninStatus\\r\\n| project-away SigninStatus1, TimeGenerated\\r\\n| extend Status = SigninStatus\\r\\n| union (\\r\\n data \\r\\n | summarize Count = count() \\r\\n | extend jkey = 1\\r\\n | join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain}\\r\\n | extend jkey = 1) on jkey\\r\\n | extend SigninStatus = 'All Sign-ins', Status = '*' \\r\\n)\\r\\n| where Category in ({Category})\\r\\n| order by Count desc\\r\\n\\r\\n\\r\\n\\r\\n\",\"size\":3,\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"tiles\",\"tileSettings\":{\"titleContent\":{\"columnMatch\":\"SigninStatus\",\"formatter\":1,\"formatOptions\":{\"showIcon\":true}},\"leftContent\":{\"columnMatch\":\"Count\",\"formatter\":12,\"formatOptions\":{\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\",\"maximumFractionDigits\":2,\"maximumSignificantDigits\":3}}},\"secondaryContent\":{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true}},\"showBorder\":false}},\"name\":\"query - 5\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend ErrorCode = tostring(Status.errorCode) \\r\\n| extend FailureReason = tostring(Status.failureReason) \\r\\n| where ErrorCode !in (\\\"0\\\",\\\"50058\\\",\\\"50148\\\",\\\"50140\\\", \\\"51006\\\", \\\"50059\\\", \\\"65001\\\", \\\"52004\\\", \\\"50055\\\", \\\"50144\\\",\\\"50072\\\", \\\"50074\\\", \\\"16000\\\",\\\"16001\\\", \\\"16003\\\", \\\"50127\\\", \\\"50125\\\", \\\"50129\\\",\\\"50143\\\", \\\"81010\\\", \\\"81014\\\", \\\"81012\\\") \\r\\n|summarize errCount = count() by ErrorCode, tostring(FailureReason), Category| sort by errCount, Category\\r\\n|project ['❌ Error Code'] = ErrorCode, ['Reason']= FailureReason, ['Error Count'] = toint(errCount), Category\\r\\n|where Category in ({Category});\\r\\ndata\",\"size\":1,\"showAnalytics\":true,\"title\":\"Summary of top errors\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"exportFieldName\":\"❌ Error Code\",\"exportParameterName\":\"ErrorCode\",\"exportDefaultValue\":\"*\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Error Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"orange\",\"showIcon\":true}}],\"filter\":true}},\"customWidth\":\"67\",\"showPin\":true,\"name\":\"query - 5\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status)\\r\\n| extend DeviceDetail = parse_json(DeviceDetail)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies);\\r\\nlet data=\\r\\nunion SigninLogs,nonInteractive\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend ErrorCode = tostring(Status.errorCode) \\r\\n| extend FailureReason = tostring(Status.failureReason) \\r\\n| where ErrorCode !in (\\\"0\\\",\\\"50058\\\",\\\"50148\\\",\\\"50140\\\", \\\"51006\\\", \\\"50059\\\", \\\"65001\\\", \\\"52004\\\", \\\"50055\\\", \\\"50144\\\",\\\"50072\\\", \\\"50074\\\", \\\"16000\\\",\\\"16001\\\", \\\"16003\\\", \\\"50127\\\", \\\"50125\\\", \\\"50129\\\",\\\"50143\\\", \\\"81010\\\", \\\"81014\\\", \\\"81012\\\") \\r\\n| where '{ErrorCode}' == '*' or '{ErrorCode}' == ErrorCode\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project User = UserDisplayName, IPAddress, ['❌ Error Code'] = ErrorCode, ['Sign-in Time'] = TimeAgo, App = AppDisplayName, ['Error code'] = ErrorCode, ['Result type'] = ResultType, ['Result signature'] = ResultSignature, ['Result description'] = ResultDescription, ['Conditional access policies'] = ConditionalAccessPolicies, ['Conditional access status'] = ConditionalAccessStatus, ['Operating system'] = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser, ['Country or region'] = LocationDetails.countryOrRegion, ['State'] = LocationDetails.state, ['City'] = LocationDetails.city, ['Time generated'] = TimeGenerated, Status, ['User principal name'] = UserPrincipalName, Category\\r\\n| where Category in ({Category});\\r\\ndata\\r\\n\\r\\n\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Sign-ins with errors\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"❌ Error Code\",\"formatter\":7,\"formatOptions\":{\"linkTarget\":\"GenericDetails\",\"showIcon\":true}},{\"columnMatch\":\"App\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Error code\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result signature\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result description\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access policies\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Operating system\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Browser\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Country or region\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"State\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"City\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Time generated\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"User principal name\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true}},\"customWidth\":\"33\",\"name\":\"query - 5 - Copy\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend ErrorCode = tostring(Status.errorCode) \\r\\n| extend FailureReason = Status.failureReason \\r\\n| where ErrorCode in (\\\"50058\\\",\\\"50140\\\", \\\"51006\\\", \\\"50059\\\", \\\"65001\\\", \\\"52004\\\", \\\"50055\\\", \\\"50144\\\",\\\"50072\\\", \\\"50074\\\", \\\"16000\\\",\\\"16001\\\", \\\"16003\\\", \\\"50127\\\", \\\"50125\\\", \\\"50129\\\",\\\"50143\\\", \\\"81010\\\", \\\"81014\\\", \\\"81012\\\") \\r\\n|summarize errCount = count() by ErrorCode, tostring(FailureReason), Category\\r\\n| sort by errCount\\r\\n|project ['❌ Error Code'] = ErrorCode, ['Reason'] = FailureReason, ['Interrupt Count'] = toint(errCount), Category\\r\\n| where Category in ({Category});\\r\\ndata\",\"size\":1,\"showAnalytics\":true,\"title\":\"Summary of sign-ins waiting on user action\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"exportFieldName\":\"❌ Error Code\",\"exportParameterName\":\"InterruptErrorCode\",\"exportDefaultValue\":\"*\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Interrupt Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"orange\"}}],\"filter\":true}},\"customWidth\":\"67\",\"showPin\":true,\"name\":\"query - 7\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies)\\r\\n| extend DeviceDetail = parse_json(DeviceDetail)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive \\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend ErrorCode = tostring(Status.errorCode) \\r\\n| extend FailureReason = Status.failureReason \\r\\n| where ErrorCode in (\\\"50058\\\",\\\"50140\\\", \\\"51006\\\", \\\"50059\\\", \\\"65001\\\", \\\"52004\\\", \\\"50055\\\", \\\"50144\\\",\\\"50072\\\", \\\"50074\\\", \\\"16000\\\",\\\"16001\\\", \\\"16003\\\", \\\"50127\\\", \\\"50125\\\", \\\"50129\\\",\\\"50143\\\", \\\"81010\\\", \\\"81014\\\", \\\"81012\\\") \\r\\n| where '{InterruptErrorCode}' == '*' or '{InterruptErrorCode}' == ErrorCode\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project User = UserDisplayName, IPAddress, ['❌ Error Code'] = ErrorCode, ['Sign-in Time'] = TimeAgo, App = AppDisplayName, ['Error code'] = ErrorCode, ['Result type'] = ResultType, ['Result signature'] = ResultSignature, ['Result description'] = ResultDescription, ['Conditional access policies'] = ConditionalAccessPolicies, ['Conditional access status'] = ConditionalAccessStatus, ['Operating system'] = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser, ['Country or region'] = LocationDetails.countryOrRegion, ['State'] = LocationDetails.state, ['City'] = LocationDetails.city, ['Time generated'] = TimeGenerated, Status, ['User principal name'] = UserPrincipalName, Category\\r\\n| where Category in ({Category});\\r\\ndata\\r\\n\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Sign-ins waiting on user action\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"❌ Error Code\",\"formatter\":7,\"formatOptions\":{\"linkTarget\":\"GenericDetails\",\"showIcon\":true}},{\"columnMatch\":\"App\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Error code\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result signature\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result description\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access policies\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Operating system\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Browser\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Country or region\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"State\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"City\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Time generated\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"User principal name\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true}},\"customWidth\":\"33\",\"showPin\":true,\"name\":\"query - 7 - Copy\"}],\"fromTemplateId\":\"sentinel-AzureActiveDirectorySigninLogs\",\"$schema\":\"https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json\"}\r\n",
+ "version": "1.0",
+ "sourceId": "[variables('workspaceResourceId')]",
+ "category": "sentinel"
}
},
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('MicrosoftSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Workbook-', last(split(variables('workbookId2'),'/'))))]",
"properties": {
- "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-2')]"
+ "description": "@{workbookKey=AzureActiveDirectorySigninLogsWorkbook; logoFileName=azureactivedirectory_logo.svg; description=Gain insights into Azure Active Directory by connecting Microsoft Sentinel and using the sign-in logs to gather insights around Azure AD scenarios. \nYou can learn about sign-in operations, such as user sign-ins and locations, email addresses, and IP addresses of your users, as well as failed activities and the errors that triggered the failures.; dataTypesDependencies=System.Object[]; dataConnectorsDependencies=System.Object[]; previewImagesFileNames=System.Object[]; version=2.4.0; title=Azure AD Sign-in logs; templateRelativePath=AzureActiveDirectorySignins.json; subtitle=; provider=Microsoft}.description",
+ "parentId": "[variables('workbookId2')]",
+ "contentId": "[variables('_workbookContentId2')]",
+ "kind": "Workbook",
+ "version": "[variables('workbookVersion2')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ },
+ "dependencies": {
+ "operator": "AND",
+ "criteria": [
+ {
+ "contentId": "SigninLogs",
+ "kind": "DataType"
+ },
+ {
+ "contentId": "AzureActiveDirectory",
+ "kind": "DataConnector"
+ }
+ ]
}
}
- },
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_workbookContentId2')]",
+ "contentKind": "Workbook",
+ "displayName": "[parameters('workbook2-name')]",
+ "contentProductId": "[variables('_workbookcontentProductId2')]",
+ "id": "[variables('_workbookcontentProductId2')]",
+ "version": "[variables('workbookVersion2')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName1')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "AccountCreatedandDeletedinShortTimeframe_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion1')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('Office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId1')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
"properties": {
- "displayName": "[[variables('Office365ConnectionName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
- }
+ "description": "Search for user principal name (UPN) events. Look for accounts created and then deleted in under 24 hours. Attackers may create an account for their use, and then remove the account when no longer needed.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#short-lived-account",
+ "displayName": "Account Created and Deleted in Short Timeframe",
+ "enabled": false,
+ "query": "let queryfrequency = 1h;\nlet queryperiod = 1d;\nAuditLogs\n| where TimeGenerated > ago(queryfrequency)\n| where OperationName =~ \"Delete user\"\n//extend UserPrincipalName = tostring(TargetResources[0].userPrincipalName)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type == \"User\"\n | extend UserPrincipalName = extract(@'([a-f0-9]{32})?(.*)', 2, tostring(TargetResource.userPrincipalName))\n )\n| extend DeletedByUser = tostring(InitiatedBy.user.userPrincipalName), DeletedByIPAddress = tostring(InitiatedBy.user.ipAddress)\n| extend DeletedByApp = tostring(InitiatedBy.app.displayName)\n| project Deletion_TimeGenerated = TimeGenerated, UserPrincipalName, DeletedByUser, DeletedByIPAddress, DeletedByApp, Deletion_AdditionalDetails = AdditionalDetails, Deletion_InitiatedBy = InitiatedBy, Deletion_TargetResources = TargetResources\n| join kind=inner (\n AuditLogs\n | where TimeGenerated > ago(queryperiod)\n | where OperationName =~ \"Add user\" \n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type == \"User\"\n | extend UserPrincipalName = trim(@'\"',tostring(TargetResource.userPrincipalName))\n )\n | project-rename Creation_TimeGenerated = TimeGenerated\n) on UserPrincipalName\n| extend TimeDelta = Deletion_TimeGenerated - Creation_TimeGenerated\n| where TimeDelta between (time(0s) .. queryperiod)\n| extend CreatedByUser = tostring(InitiatedBy.user.userPrincipalName), CreatedByIPAddress = tostring(InitiatedBy.user.ipAddress)\n| extend CreatedByApp = tostring(InitiatedBy.app.displayName)\n| project Creation_TimeGenerated, Deletion_TimeGenerated, TimeDelta, UserPrincipalName, DeletedByUser, DeletedByIPAddress, DeletedByApp, CreatedByUser, CreatedByIPAddress, CreatedByApp, Creation_AdditionalDetails = AdditionalDetails, Creation_InitiatedBy = InitiatedBy, Creation_TargetResources = TargetResources, Deletion_AdditionalDetails, Deletion_InitiatedBy, Deletion_TargetResources\n| extend timestamp = Deletion_TimeGenerated, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "P1D",
+ "severity": "High",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess"
+ ],
+ "techniques": [
+ "T1078"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "DeletedByIPAddress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ]
}
},
{
- "type": "Microsoft.Logic/workflows",
- "apiVersion": "2017-07-01",
- "name": "[[parameters('PlaybookName')]",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Block-AADUser-EntityTrigger",
- "hidden-SentinelTemplateVersion": "1.1",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]"
- ],
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId1'),'/'))))]",
"properties": {
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_entity": {
- "type": "ApiConnectionWebhook",
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "path": "/entity/@{encodeURIComponent('Account')}"
- }
- }
- },
- "actions": {
- "Condition": {
- "actions": {
- "Condition_-_if_user_have_manager": {
- "actions": {
- "Condition_2": {
- "actions": {
- "Add_comment_to_incident_-_with_manager_-_no_admin": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['IncidentArmID']",
- "message": "User @{triggerBody()?['Entity']?['properties']?['Name']} (UPN - @{variables('AccountDetails')}) was disabled in AAD via playbook Block-AADUser. Manager (@{body('Parse_JSON_-_get_user_manager')?['userPrincipalName']}) is notified.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- },
- "runAfter": {
- "Get_user_-_details": [
- "Succeeded"
- ]
- },
- "expression": {
- "and": [
- {
- "not": {
- "equals": [
- "@triggerBody()?['IncidentArmID']",
- "@null"
- ]
- }
- }
- ]
- },
- "type": "If"
- },
- "Get_user_-_details": {
- "type": "ApiConnection",
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuread']['connectionId']"
- }
- },
- "method": "get",
- "path": "/v1.0/users/@{encodeURIComponent(variables('AccountDetails'))}"
- }
- },
- "Send_an_email_-_to_manager_-_no_admin": {
- "runAfter": {
- "Condition_2": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "Body": "Security notification! This is automated email sent by Microsoft Sentinel Automation!
\n
\nYour direct report @{triggerBody()?['Entity']?['properties']?['Name']} has been disabled in Azure AD due to the security incident. Can you please notify the user and work with him to reach our support.
\n
\nDirect report details:
\nFirst name: @{body('Get_user_-_details')?['displayName']}
\nSurname: @{body('Get_user_-_details')?['surname']}
\nJob title: @{body('Get_user_-_details')?['jobTitle']}
\nOffice location: @{body('Get_user_-_details')?['officeLocation']}
\nBusiness phone: @{body('Get_user_-_details')?['businessPhones']}
\nMobile phone: @{body('Get_user_-_details')?['mobilePhone']}
\nMail: @{body('Get_user_-_details')?['mail']}
\n
\nThank you!
",
- "Importance": "High",
- "Subject": "@{triggerBody()?['Entity']?['properties']?['Name']} has been disabled in Azure AD due to the security risk!",
- "To": "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "method": "post",
- "path": "/v2/Mail"
- }
- }
- },
- "runAfter": {
- "Parse_JSON_-_get_user_manager": [
- "Succeeded"
- ]
- },
- "else": {
- "actions": {
- "Condition_3": {
- "actions": {
- "Add_comment_to_incident_-_no_manager_-_no_admin": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['IncidentArmID']",
- "message": "User @{triggerBody()?['Entity']?['properties']?['Name']} (UPN - @{variables('AccountDetails')}) was disabled in AAD via playbook Block-AADUser. Manager has not been notified, since it is not found for this user!
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- },
- "expression": {
- "and": [
- {
- "not": {
- "equals": [
- "@triggerBody()?['IncidentArmID']",
- "@null"
- ]
- }
- }
- ]
- },
- "type": "If"
- }
- }
- },
- "expression": {
- "and": [
- {
- "not": {
- "equals": [
- "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']",
- "@null"
- ]
- }
- }
- ]
- },
- "type": "If"
- },
- "HTTP_-_get_user_manager": {
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com/",
- "type": "ManagedServiceIdentity"
- },
- "method": "GET",
- "uri": "https://graph.microsoft.com/v1.0/users/@{variables('AccountDetails')}/manager"
- }
- },
- "Parse_JSON_-_get_user_manager": {
- "runAfter": {
- "HTTP_-_get_user_manager": [
- "Succeeded",
- "Failed"
- ]
- },
- "type": "ParseJson",
- "inputs": {
- "content": "@body('HTTP_-_get_user_manager')",
- "schema": {
- "properties": {
- "userPrincipalName": {
- "type": "string"
- }
- },
- "type": "object"
- }
- }
- }
- },
- "runAfter": {
- "Update_user_-_disable_user": [
- "Succeeded",
- "Failed"
- ]
- },
- "else": {
- "actions": {
- "Add_comment_to_incident_-_error_details": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['IncidentArmID']",
- "message": "Block-AADUser playbook could not disable user @{triggerBody()?['Entity']?['properties']?['Name']}.
\nError message: @{body('Update_user_-_disable_user')['error']['message']}
\nNote: If user is admin, this playbook don't have privilages to block admin users!
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- }
- },
- "expression": {
- "and": [
- {
- "equals": [
- "@body('Update_user_-_disable_user')",
- "@null"
- ]
- }
- ]
- },
- "type": "If"
- },
- "Initialize_variable_Account_Details": {
- "type": "InitializeVariable",
- "inputs": {
- "variables": [
- {
- "name": "AccountDetails",
- "type": "string"
- }
- ]
- }
- },
- "Set_variable": {
- "runAfter": {
- "Initialize_variable_Account_Details": [
- "Succeeded"
- ]
- },
- "type": "SetVariable",
- "inputs": {
- "name": "AccountDetails",
- "value": "@{concat(triggerBody()?['Entity']?['properties']?['Name'],'@',triggerBody()?['Entity']?['properties']?['UPNSuffix'])}"
- }
- },
- "Update_user_-_disable_user": {
- "runAfter": {
- "Set_variable": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "accountEnabled": false
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuread']['connectionId']"
- }
- },
- "method": "patch",
- "path": "/v1.0/users/@{encodeURIComponent(variables('AccountDetails'))}"
- }
- }
- }
- },
- "parameters": {
- "$connections": {
- "value": {
- "azuread": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "connectionName": "[[variables('AzureADConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
- },
- "microsoftsentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
- },
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "connectionName": "[[variables('Office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
- }
- }
- }
- }
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId2'),'/'))))]",
- "properties": {
- "parentId": "[variables('playbookId2')]",
- "contentId": "[variables('_playbookContentId2')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion2')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
- }
- }
- }
- ],
- "metadata": {
- "title": "Block AAD user - Entity trigger",
- "description": "This playbook disables the selected user (account entity) in Azure Active Directoy. If this playbook triggered from an incident context, it will add a comment to the incident. This playbook will notify the disabled user manager if available. Note: This playbook will not disable admin user!",
- "postDeployment": [
- "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
- "2. Grant User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All permissions to the managed identity.",
- "3. Authorize Azure AD and Office 365 Outlook Logic App connections."
- ],
- "lastUpdateTime": "2022-12-08T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": [
- {
- "version": "1.0.0",
- "title": "Added manager notification action",
- "notes": [
- "Initial version"
- ]
- }
- ]
- }
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId2')]",
- "contentKind": "Playbook",
- "displayName": "Block-AADUser-EntityTrigger",
- "contentProductId": "[variables('_playbookcontentProductId2')]",
- "id": "[variables('_playbookcontentProductId2')]",
- "version": "[variables('playbookVersion2')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName3')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "Block-AADUser-Incident Playbook with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion3')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Block-AADUser-Incident",
- "type": "string"
- }
- },
- "variables": {
- "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
- "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
- "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
- "_connection-1": "[[variables('connection-1')]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-3": "[[variables('connection-3')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
- "resources": [
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('AzureADConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[variables('AzureADConnectionName')]",
- "api": {
- "id": "[[variables('_connection-1')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('MicrosoftSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
- "properties": {
- "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-2')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('Office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[variables('Office365ConnectionName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
- }
- }
- },
- {
- "type": "Microsoft.Logic/workflows",
- "apiVersion": "2017-07-01",
- "name": "[[parameters('PlaybookName')]",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Block-AADUser",
- "hidden-SentinelTemplateVersion": "1.1",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]"
- ],
- "properties": {
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_incident": {
- "type": "ApiConnectionWebhook",
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "path": "/incident-creation"
- }
- }
- },
- "actions": {
- "Entities_-_Get_Accounts": {
- "type": "ApiConnection",
- "inputs": {
- "body": "@triggerBody()?['object']?['properties']?['relatedEntities']",
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/entities/account"
- }
- },
- "For_each": {
- "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
- "actions": {
- "Condition": {
- "actions": {
- "Condition_-_if_user_have_manager": {
- "actions": {
- "Add_comment_to_incident_-_with_manager_-_no_admin": {
- "runAfter": {
- "Get_user_-_details": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['object']?['id']",
- "message": "User @{items('For_each')?['Name']} (UPN - @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}) was disabled in AAD via playbook Block-AADUser. Manager (@{body('Parse_JSON_-_get_user_manager')?['userPrincipalName']}) is notified.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- },
- "Get_user_-_details": {
- "type": "ApiConnection",
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuread']['connectionId']"
- }
- },
- "method": "get",
- "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}"
- }
- },
- "Send_an_email_-_to_manager_-_no_admin": {
- "runAfter": {
- "Add_comment_to_incident_-_with_manager_-_no_admin": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "Body": "Security notification! This is automated email sent by Microsoft Sentinel Automation!
\n
\nYour direct report @{items('For_each')?['Name']} has been disabled in Azure AD due to the security incident. Can you please notify the user and work with him to reach our support.
\n
\nDirect report details:
\nFirst name: @{body('Get_user_-_details')?['displayName']}
\nSurname: @{body('Get_user_-_details')?['surname']}
\nJob title: @{body('Get_user_-_details')?['jobTitle']}
\nOffice location: @{body('Get_user_-_details')?['officeLocation']}
\nBusiness phone: @{body('Get_user_-_details')?['businessPhones']}
\nMobile phone: @{body('Get_user_-_details')?['mobilePhone']}
\nMail: @{body('Get_user_-_details')?['mail']}
\n
\nThank you!
",
- "Importance": "High",
- "Subject": "@{items('For_each')?['Name']} has been disabled in Azure AD due to the security risk!",
- "To": "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "method": "post",
- "path": "/v2/Mail"
- }
- }
- },
- "runAfter": {
- "Parse_JSON_-_get_user_manager": [
- "Succeeded"
- ]
- },
- "else": {
- "actions": {
- "Add_comment_to_incident_-_no_manager_-_no_admin": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['object']?['id']",
- "message": "User @{items('For_each')?['Name']} (UPN - @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}) was disabled in AAD via playbook Block-AADUser. Manager has not been notified, since it is not found for this user!
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- }
- },
- "expression": {
- "and": [
- {
- "not": {
- "equals": [
- "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']",
- "@null"
- ]
- }
- }
- ]
- },
- "type": "If"
- },
- "HTTP_-_get_user_manager": {
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com/",
- "type": "ManagedServiceIdentity"
- },
- "method": "GET",
- "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/manager"
- }
- },
- "Parse_JSON_-_get_user_manager": {
- "runAfter": {
- "HTTP_-_get_user_manager": [
- "Succeeded",
- "Failed"
- ]
- },
- "type": "ParseJson",
- "inputs": {
- "content": "@body('HTTP_-_get_user_manager')",
- "schema": {
- "properties": {
- "userPrincipalName": {
- "type": "string"
- }
- },
- "type": "object"
- }
- }
- }
- },
- "runAfter": {
- "Update_user_-_disable_user": [
- "Succeeded",
- "Failed"
- ]
- },
- "else": {
- "actions": {
- "Add_comment_to_incident_-_error_details": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['object']?['id']",
- "message": "Block-AADUser playbook could not disable user @{items('For_each')?['Name']}.
\nError message: @{body('Update_user_-_disable_user')['error']['message']}
\nNote: If user is admin, this playbook don't have privilages to block admin users!
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- }
- },
- "expression": {
- "and": [
- {
- "equals": [
- "@body('Update_user_-_disable_user')",
- "@null"
- ]
- }
- ]
- },
- "type": "If"
- },
- "Update_user_-_disable_user": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "accountEnabled": false
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuread']['connectionId']"
- }
- },
- "method": "patch",
- "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}"
- }
- }
- },
- "runAfter": {
- "Entities_-_Get_Accounts": [
- "Succeeded"
- ]
- },
- "type": "Foreach"
- }
- }
- },
- "parameters": {
- "$connections": {
- "value": {
- "azuread": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "connectionName": "[[variables('AzureADConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
- },
- "microsoftsentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
- },
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "connectionName": "[[variables('Office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
- }
- }
- }
- }
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId3'),'/'))))]",
- "properties": {
- "parentId": "[variables('playbookId3')]",
- "contentId": "[variables('_playbookContentId3')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion3')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
- }
- }
- }
- ],
- "metadata": {
- "title": "Block AAD user - Incident",
- "description": "For each account entity included in the incident, this playbook will disable the user in Azure Active Directoy, add a comment to the incident that contains this alert and notify manager if available. Note: This playbook will not disable admin user!",
- "prerequisites": [
- "None"
- ],
- "postDeployment": [
- "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
- "2. Grant User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All permissions to the managed identity.",
- "3. Authorize Azure AD and Office 365 Outlook Logic App connections."
- ],
- "lastUpdateTime": "2022-07-11T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": [
- {
- "version": "1.0.0",
- "title": "Added manager notification action",
- "notes": [
- "Initial version"
- ]
- }
- ]
- }
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId3')]",
- "contentKind": "Playbook",
- "displayName": "Block-AADUser-Incident",
- "contentProductId": "[variables('_playbookcontentProductId3')]",
- "id": "[variables('_playbookcontentProductId3')]",
- "version": "[variables('playbookVersion3')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName4')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "Prompt-User-Alert Playbook with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion4')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Prompt-User-Alert",
- "type": "string"
- },
- "TeamsId": {
- "metadata": {
- "description": "Enter the Teams Group ID"
- },
- "type": "string"
- },
- "TeamsChannelId": {
- "metadata": {
- "description": "Enter the Teams Channel ID"
- },
- "type": "string"
- }
- },
- "variables": {
- "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
- "AzureSentinelConnectionName": "[[concat('azuresentinel-', parameters('PlaybookName'))]",
- "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "TeamsConnectionName": "[[concat('teams-', parameters('PlaybookName'))]",
- "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
- "_connection-1": "[[variables('connection-1')]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-3": "[[variables('connection-3')]",
- "connection-4": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/teams')]",
- "_connection-4": "[[variables('connection-4')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
- "resources": [
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('AzureADConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[variables('AzureADConnectionName')]",
- "api": {
- "id": "[[variables('_connection-1')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('AzureSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
- "properties": {
- "displayName": "[[variables('AzureSentinelConnectionName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-2')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('Office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[variables('Office365ConnectionName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('TeamsConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[variables('TeamsConnectionName')]",
- "api": {
- "id": "[[variables('_connection-4')]"
- }
- }
- },
- {
- "type": "Microsoft.Logic/workflows",
- "apiVersion": "2017-07-01",
- "name": "[[parameters('PlaybookName')]",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Prompt-User_alert",
- "hidden-SentinelTemplateVersion": "1.1",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('TeamsConnectionName'))]"
- ],
- "properties": {
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "actions": {
- "Alert_-_Get_incident": {
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "get",
- "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
- },
- "type": "ApiConnection"
- },
- "Entities_-_Get_Accounts": {
- "inputs": {
- "body": "@triggerBody()?['Entities']",
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/entities/account"
- },
- "runAfter": {
- "Alert_-_Get_incident": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- },
- "For_each": {
- "actions": {
- "Condition_2": {
- "actions": {
- "Add_comment_to_incident_(V3)": {
- "inputs": {
- "body": {
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "message": "@{body('Get_user')?['displayName']} confirms they completed the action that triggered the alert. Closing the incident.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- },
- "type": "ApiConnection"
- },
- "Update_incident": {
- "inputs": {
- "body": {
- "classification": {
- "ClassificationAndReason": "BenignPositive - SuspiciousButExpected",
- "ClassificationReasonText": "User Confirmed it was them"
- },
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "status": "Closed"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "put",
- "path": "/Incidents"
- },
- "runAfter": {
- "Add_comment_to_incident_(V3)": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- }
- },
- "else": {
- "actions": {
- "Add_comment_to_incident_(V3)_2": {
- "inputs": {
- "body": {
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "message": "@{body('Get_user')?['displayName']} confirms they did not complete the action. Further investigation is needed.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- },
- "type": "ApiConnection"
- },
- "Post_message_in_a_chat_or_channel": {
- "inputs": {
- "body": {
- "messageBody": "New alert from Microsoft Sentinel.
\nPlease investigate ASAP.
\nSeverity : @{body('Alert_-_Get_incident')?['properties']?['severity']}
\nDescription: @{body('Alert_-_Get_incident')?['properties']?['description']}
\n
\n@{body('Get_user')?['displayName']} user confirmed they did not complete the action.
",
- "recipient": {
- "channelId": "[[parameters('TeamsChannelId')]",
- "groupId": "[[parameters('TeamsId')]"
- },
- "subject": "Incident @{body('Alert_-_Get_incident')?['properties']?['incidentNumber']} - @{body('Alert_-_Get_incident')?['properties']?['title']}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['teams']['connectionId']"
- }
- },
- "method": "post",
- "path": "/beta/teams/conversation/message/poster/@{encodeURIComponent('User')}/location/@{encodeURIComponent('Channel')}"
- },
- "runAfter": {
- "Add_comment_to_incident_(V3)_2": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- }
- }
- },
- "expression": {
- "and": [
- {
- "equals": [
- "",
- "This was me"
- ]
- }
- ]
- },
- "runAfter": {
- "Send_approval_email": [
- "Succeeded"
- ]
- },
- "type": "If"
- },
- "Get_user": {
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuread']['connectionId']"
- }
- },
- "method": "get",
- "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@' ,items('For_each')?['UPNSuffix']))}"
- },
- "type": "ApiConnection"
- },
- "Send_approval_email": {
- "inputs": {
- "body": {
- "Message": {
- "Body": "New Alert from Microsoft Sentinel.\nPlease respond ASAP.\nSeverity: @{triggerBody()?['Severity']}\nName: @{triggerBody()?['AlertDisplayName']}\nDescription: @{triggerBody()?['Description']}",
- "HideHTMLMessage": false,
- "Importance": "High",
- "Options": "This was me, This was not me",
- "ShowHTMLConfirmationDialog": false,
- "Subject": "Security Alert: @{body('Alert_-_Get_incident')?['properties']?['title']}",
- "To": "@body('Get_user')?['mail']"
- },
- "NotificationUrl": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "path": "/approvalmail/$subscriptions"
- },
- "runAfter": {
- "Get_user": [
- "Succeeded"
- ]
- },
- "type": "ApiConnectionWebhook"
- }
- },
- "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
- "runAfter": {
- "Entities_-_Get_Accounts": [
- "Succeeded"
- ]
- },
- "type": "Foreach"
- }
- },
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_alert": {
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "path": "/subscribe"
- },
- "type": "ApiConnectionWebhook"
- }
- }
- },
- "parameters": {
- "$connections": {
- "value": {
- "azuread": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "connectionName": "[[variables('AzureADConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
- },
- "azuresentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
- "connectionName": "[[variables('AzureSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
- },
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "connectionName": "[[variables('Office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
- },
- "teams": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('TeamsConnectionName'))]",
- "connectionName": "[[variables('TeamsConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/teams')]"
- }
- }
- }
- }
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId4'),'/'))))]",
- "properties": {
- "parentId": "[variables('playbookId4')]",
- "contentId": "[variables('_playbookContentId4')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion4')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
- }
- }
- }
- ],
- "metadata": {
- "title": "Prompt User - Alert",
- "description": "This playbook will ask the user if they completed the action from the alert in Microsoft Sentinel. If so, it will close the incident and add a comment. If not, it will post a message to teams for the SOC to investigate and add a comment to the incident.",
- "prerequisites": [
- "1. You will need the Team Id and Channel Id."
- ],
- "postDeployment": [
- "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
- "2. Authorize Azure AD, Microsoft Teams, and Office 365 Outlook Logic App connections."
- ],
- "lastUpdateTime": "2022-07-11T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": [
- {
- "version": "1.0.0",
- "title": "Added new Post a Teams message action",
- "notes": [
- "Initial version"
- ]
- }
- ]
- }
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId4')]",
- "contentKind": "Playbook",
- "displayName": "Prompt-User-Alert",
- "contentProductId": "[variables('_playbookcontentProductId4')]",
- "id": "[variables('_playbookcontentProductId4')]",
- "version": "[variables('playbookVersion4')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName5')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "Prompt-User-Incident Playbook with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion5')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Prompt-User-Incident",
- "type": "string"
- },
- "TeamsId": {
- "metadata": {
- "description": "Enter the Teams Group ID"
- },
- "type": "string"
- },
- "TeamsChannelId": {
- "metadata": {
- "description": "Enter the Teams Channel ID"
- },
- "type": "string"
- }
- },
- "variables": {
- "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
- "AzureSentinelConnectionName": "[[concat('azuresentinel-', parameters('PlaybookName'))]",
- "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "TeamsConnectionName": "[[concat('teams-', parameters('PlaybookName'))]",
- "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
- "_connection-1": "[[variables('connection-1')]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-3": "[[variables('connection-3')]",
- "connection-4": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/teams')]",
- "_connection-4": "[[variables('connection-4')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
- "resources": [
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('AzureADConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[variables('AzureADConnectionName')]",
- "api": {
- "id": "[[variables('_connection-1')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('AzureSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
- "properties": {
- "displayName": "[[variables('AzureSentinelConnectionName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-2')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('Office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[variables('Office365ConnectionName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('TeamsConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[variables('TeamsConnectionName')]",
- "api": {
- "id": "[[variables('_connection-4')]"
- }
- }
- },
- {
- "type": "Microsoft.Logic/workflows",
- "apiVersion": "2017-07-01",
- "name": "[[parameters('PlaybookName')]",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Prompt-User",
- "hidden-SentinelTemplateVersion": "1.1",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('TeamsConnectionName'))]"
- ],
- "properties": {
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "actions": {
- "Entities_-_Get_Accounts": {
- "inputs": {
- "body": "@triggerBody()?['object']?['properties']?['relatedEntities']",
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/entities/account"
- },
- "type": "ApiConnection"
- },
- "For_each": {
- "actions": {
- "Condition_2": {
- "actions": {
- "Add_comment_to_incident_(V3)": {
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['object']?['id']",
- "message": "@{body('Get_user')?['displayName']} confirms they completed the action that triggered the alert. Closing the incident.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- },
- "type": "ApiConnection"
- },
- "Update_incident": {
- "inputs": {
- "body": {
- "classification": {
- "ClassificationAndReason": "BenignPositive - SuspiciousButExpected",
- "ClassificationReasonText": "User Confirmed it was them"
- },
- "incidentArmId": "@triggerBody()?['object']?['id']",
- "status": "Closed"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "put",
- "path": "/Incidents"
- },
- "runAfter": {
- "Add_comment_to_incident_(V3)": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- }
- },
- "else": {
- "actions": {
- "Add_comment_to_incident_(V3)_2": {
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['object']?['id']",
- "message": "@{body('Get_user')?['displayName']} confirms they did not complete the action. Further investigation is needed.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- },
- "type": "ApiConnection"
- },
- "Post_message_in_a_chat_or_channel": {
- "inputs": {
- "body": {
- "messageBody": "New alert from Microsoft Sentinel.
\nPlease investigate ASAP.
\nSeverity : @{triggerBody()?['object']?['properties']?['severity']}
\nDescription: @{triggerBody()?['object']?['properties']?['description']}
\n
\n@{body('Get_user')?['displayName']} user confirmed they did not complete the action.
",
- "recipient": {
- "channelId": "[[parameters('TeamsChannelId')]",
- "groupId": "[[parameters('TeamsId')]"
- },
- "subject": "Incident @{triggerBody()?['object']?['properties']?['incidentNumber']} - @{triggerBody()?['object']?['properties']?['title']}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['teams']['connectionId']"
- }
- },
- "method": "post",
- "path": "/beta/teams/conversation/message/poster/@{encodeURIComponent('User')}/location/@{encodeURIComponent('Channel')}"
- },
- "runAfter": {
- "Add_comment_to_incident_(V3)_2": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- }
- }
- },
- "expression": {
- "and": [
- {
- "equals": [
- "@body('Send_approval_email')?['SelectedOption']",
- "This was me"
- ]
- }
- ]
- },
- "runAfter": {
- "Send_approval_email": [
- "Succeeded"
- ]
- },
- "type": "If"
- },
- "Get_user": {
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuread']['connectionId']"
- }
- },
- "method": "get",
- "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@' ,items('For_each')?['UPNSuffix']))}"
- },
- "type": "ApiConnection"
- },
- "Send_approval_email": {
- "inputs": {
- "body": {
- "Message": {
- "Body": "New Alert from Microsoft Sentinel.\nPlease respond ASAP.\nSeverity: @{triggerBody()?['object']?['properties']?['severity']}\nName: @{triggerBody()?['object']?['properties']?['title']}\nDescription: @{triggerBody()?['object']?['properties']?['description']}",
- "HideHTMLMessage": false,
- "Importance": "High",
- "Options": "This was me, This was not me",
- "ShowHTMLConfirmationDialog": false,
- "Subject": "Security Alert: @{triggerBody()?['object']?['properties']?['title']}",
- "To": "@body('Get_user')?['mail']"
- },
- "NotificationUrl": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "path": "/approvalmail/$subscriptions"
- },
- "runAfter": {
- "Get_user": [
- "Succeeded"
- ]
- },
- "type": "ApiConnectionWebhook"
- }
- },
- "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
- "runAfter": {
- "Entities_-_Get_Accounts": [
- "Succeeded"
- ]
- },
- "type": "Foreach"
- }
- },
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_incident": {
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "path": "/incident-creation"
- },
- "type": "ApiConnectionWebhook"
- }
- }
- },
- "parameters": {
- "$connections": {
- "value": {
- "azuread": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
- "connectionName": "[[variables('AzureADConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
- },
- "azuresentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
- "connectionName": "[[variables('AzureSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
- },
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "connectionName": "[[variables('Office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
- },
- "teams": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('TeamsConnectionName'))]",
- "connectionName": "[[variables('TeamsConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/teams')]"
- }
- }
- }
- }
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId5'),'/'))))]",
- "properties": {
- "parentId": "[variables('playbookId5')]",
- "contentId": "[variables('_playbookContentId5')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion5')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
- }
- }
- }
- ],
- "metadata": {
- "title": "Prompt User - Incident",
- "description": "This playbook will ask the user if they completed the action from the Incident in Microsoft Sentinel. If so, it will close the incident and add a comment. If not, it will post a message to teams for the SOC to investigate and add a comment to the incident.",
- "prerequisites": [
- "1. You will need the Team Id and Channel Id."
- ],
- "postDeployment": [
- "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
- "2. Authorize Azure AD, Microsoft Teams, and Office 365 Outlook Logic App connections."
- ],
- "lastUpdateTime": "2022-07-11T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": [
- {
- "version": "1.0.0",
- "title": "Added new Post a Teams message action",
- "notes": [
- "Initial version"
- ]
- }
- ]
- }
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId5')]",
- "contentKind": "Playbook",
- "displayName": "Prompt-User-Incident",
- "contentProductId": "[variables('_playbookcontentProductId5')]",
- "id": "[variables('_playbookcontentProductId5')]",
- "version": "[variables('playbookVersion5')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName6')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "Reset-AADPassword-AlertTrigger Playbook with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion6')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Reset-AADPassword-AlertTrigger",
- "type": "string"
- }
- },
- "variables": {
- "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
- "office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-3": "[[variables('connection-3')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
- "resources": [
- {
- "properties": {
- "provisioningState": "Succeeded",
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_alert": {
- "type": "ApiConnectionWebhook",
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "path": "/subscribe"
- }
- }
- },
- "actions": {
- "Alert_-_Get_incident": {
- "runAfter": {
- "Set_variable_-_password": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "get",
- "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
- }
- },
- "Entities_-_Get_Accounts": {
- "runAfter": {
- "Alert_-_Get_incident": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": "@triggerBody()?['Entities']",
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/entities/account"
- }
- },
- "For_each": {
- "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
- "actions": {
- "Condition_-_is_manager_available": {
- "actions": {
- "Add_comment_to_incident_-_manager_available": {
- "runAfter": {
- "Send_an_email_-_to_manager_with_password_details": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} password was reset in AAD and their manager @{body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']} was contacted using playbook.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- },
- "Parse_JSON_-_HTTP_-_get_manager": {
- "type": "ParseJson",
- "inputs": {
- "content": "@body('HTTP_-_get_manager')",
- "schema": {
- "properties": {
- "userPrincipalName": {
- "type": "string"
- }
- },
- "type": "object"
- }
- }
- },
- "Send_an_email_-_to_manager_with_password_details": {
- "runAfter": {
- "Parse_JSON_-_HTTP_-_get_manager": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "Body": "User, @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}, was involved in part of a security incident. As part of remediation, the user password has been reset.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
",
- "Subject": "A user password was reset due to security incident.",
- "To": "@body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "method": "post",
- "path": "/v2/Mail"
- }
- }
- },
- "runAfter": {
- "HTTP_-_get_manager": [
- "Succeeded",
- "Failed"
- ]
- },
- "else": {
- "actions": {
- "Add_comment_to_incident_-_manager_not_available": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} password was reset in AAD but the user doesn't have a manager.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- }
- },
- "expression": {
- "and": [
- {
- "equals": [
- "@outputs('HTTP_-_get_manager')['statusCode']",
- 200
- ]
- }
- ]
- },
- "type": "If"
- },
- "HTTP_-_get_manager": {
- "runAfter": {
- "HTTP_-_reset_a_password": [
- "Succeeded"
- ]
- },
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com",
- "type": "ManagedServiceIdentity"
- },
- "method": "GET",
- "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/manager"
- }
- },
- "HTTP_-_reset_a_password": {
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com",
- "type": "ManagedServiceIdentity"
- },
- "body": {
- "passwordProfile": {
- "forceChangePasswordNextSignIn": true,
- "forceChangePasswordNextSignInWithMfa": false,
- "password": "@{variables('Password')}"
- }
- },
- "method": "PATCH",
- "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}"
- }
- }
- },
- "runAfter": {
- "Entities_-_Get_Accounts": [
- "Succeeded"
- ]
- },
- "type": "Foreach"
- },
- "Initialize_variable": {
- "type": "InitializeVariable",
- "inputs": {
- "variables": [
- {
- "name": "Password",
- "type": "String",
- "value": "null"
- }
- ]
- }
- },
- "Set_variable_-_password": {
- "runAfter": {
- "Initialize_variable": [
- "Succeeded"
- ]
- },
- "type": "SetVariable",
- "inputs": {
- "name": "Password",
- "value": "@{substring(guid(), 0, 10)}"
- }
- }
- }
- },
- "parameters": {
- "$connections": {
- "value": {
- "microsoftsentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
- },
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]",
- "connectionName": "[[variables('office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
- }
- }
- }
- }
- },
- "name": "[[parameters('PlaybookName')]",
- "type": "Microsoft.Logic/workflows",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Reset-AADUserPassword_alert",
- "hidden-SentinelTemplateVersion": "1.1",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "apiVersion": "2017-07-01",
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]"
- ]
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('MicrosoftSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
- "properties": {
- "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-2')]"
+ "description": "Azure Active Directory Analytics Rule 1",
+ "parentId": "[variables('analyticRuleId1')]",
+ "contentId": "[variables('_analyticRulecontentId1')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion1')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
}
}
- },
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId1')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Account Created and Deleted in Short Timeframe",
+ "contentProductId": "[variables('_analyticRulecontentProductId1')]",
+ "id": "[variables('_analyticRulecontentProductId1')]",
+ "version": "[variables('analyticRuleVersion1')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName2')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "AccountCreatedDeletedByNonApprovedUser_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion2')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId2')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
"properties": {
- "displayName": "[[variables('office365ConnectionName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
- }
+ "description": "Identifies accounts that were created or deleted by a defined list of non-approved user principal names. Add to this list before running the query for accurate results.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts",
+ "displayName": "Account created or deleted by non-approved user",
+ "enabled": false,
+ "query": "// Add non-approved user principal names to the list below to search for their account creation/deletion activity\n// ex: dynamic([\"UPN1\", \"upn123\"])\nlet nonapproved_users = dynamic([]);\nAuditLogs\n| where OperationName =~ \"Add user\" or OperationName =~ \"Delete user\"\n| where Result =~ \"success\"\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName)\n| where InitiatingUser has_any (nonapproved_users)\n| project-reorder TimeGenerated, ResourceId, OperationName, InitiatingUser, TargetResources\n| extend InitiatedUserIpAddress = tostring(InitiatedBy.user.ipAddress)\n| extend Name = tostring(split(InitiatingUser,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUser,'@',1)[0])\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P1D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess"
+ ],
+ "techniques": [
+ "T1078"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatedUserIpAddress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ]
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId6'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId2'),'/'))))]",
"properties": {
- "parentId": "[variables('playbookId6')]",
- "contentId": "[variables('_playbookContentId6')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion6')]",
+ "description": "Azure Active Directory Analytics Rule 2",
+ "parentId": "[variables('analyticRuleId2')]",
+ "contentId": "[variables('_analyticRulecontentId2')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion2')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -3053,399 +1294,454 @@
}
}
}
- ],
- "metadata": {
- "title": "Reset Azure AD User Password - Alert Trigger",
- "description": "This playbook will reset the user password using Graph API. It will send the password (which is a random guid substring) to the user's manager. The user will have to reset the password upon login.",
- "prerequisites": [
- "None"
- ],
- "postDeployment": [
- "1. Assign Password Administrator permission to managed identity.",
- "2. Assign Microsoft Sentinel Responder permission to managed identity.",
- "3. Authorize Office 365 Outlook connection"
- ],
- "lastUpdateTime": "2022-07-11T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": [
- {
- "version": "1.0.0",
- "title": " Added manager notification action",
- "notes": [
- "Initial version"
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId2')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Account created or deleted by non-approved user",
+ "contentProductId": "[variables('_analyticRulecontentProductId2')]",
+ "id": "[variables('_analyticRulecontentProductId2')]",
+ "version": "[variables('analyticRuleVersion2')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName3')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "ADFSDomainTrustMods_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion3')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId3')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "This will alert when a user or application modifies the federation settings on the domain or Update domain authentication from Managed to Federated.\nFor example, this alert will trigger when a new Active Directory Federated Service (ADFS) TrustedRealm object, such as a signing certificate, is added to the domain.\nModification to domain federation settings should be rare. Confirm the added or modified target domain/URL is legitimate administrator behavior.\nTo understand why an authorized user may update settings for a federated domain in Office 365, Azure, or Intune, see: https://docs.microsoft.com/office365/troubleshoot/active-directory/update-federated-domain-office-365.\nFor details on security realms that accept security tokens, see the ADFS Proxy Protocol (MS-ADFSPP) specification: https://docs.microsoft.com/openspecs/windows_protocols/ms-adfspp/e7b9ea73-1980-4318-96a6-da559486664b.\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "Modified domain federation trust settings",
+ "enabled": false,
+ "query": "(union isfuzzy=true\n(\nAuditLogs\n| where OperationName =~ \"Set federation settings on domain\"\n//| where Result =~ \"success\" // commenting out, as it may be interesting to capture failed attempts\n| mv-expand TargetResources\n| extend modifiedProperties = parse_json(TargetResources).modifiedProperties\n| mv-expand modifiedProperties\n| extend targetDisplayName = tostring(parse_json(modifiedProperties).displayName)\n),\n(\nAuditLogs\n| where OperationName =~ \"Set domain authentication\"\n//| where Result =~ \"success\" // commenting out, as it may be interesting to capture failed attempts\n| mv-expand TargetResources\n| extend modifiedProperties = parse_json(TargetResources).modifiedProperties\n| mv-expand modifiedProperties\n| mv-apply Property = modifiedProperties on \n (\n where Property.displayName =~ \"LiveType\"\n | extend targetDisplayName = tostring(Property.displayName),\n NewDomainValue = tostring(Property.newValue)\n )\n| where NewDomainValue has \"Federated\"\n)\n)\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, AADOperationType, targetDisplayName, Result, InitiatingIpAddress, UserAgent, CorrelationId, TenantId, AADTenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P1D",
+ "severity": "High",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "CredentialAccess"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatingIpAddress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
]
}
- ]
- }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId3'),'/'))))]",
+ "properties": {
+ "description": "Azure Active Directory Analytics Rule 3",
+ "parentId": "[variables('analyticRuleId3')]",
+ "contentId": "[variables('_analyticRulecontentId3')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion3')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ }
+ }
+ }
+ ]
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId6')]",
- "contentKind": "Playbook",
- "displayName": "Reset-AADPassword-AlertTrigger",
- "contentProductId": "[variables('_playbookcontentProductId6')]",
- "id": "[variables('_playbookcontentProductId6')]",
- "version": "[variables('playbookVersion6')]"
+ "contentId": "[variables('_analyticRulecontentId3')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Modified domain federation trust settings",
+ "contentProductId": "[variables('_analyticRulecontentProductId3')]",
+ "id": "[variables('_analyticRulecontentProductId3')]",
+ "version": "[variables('analyticRuleVersion3')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName7')]",
+ "name": "[variables('analyticRuleTemplateSpecName4')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Reset-AADUserPassword-EntityTrigger Playbook with template version 3.0.3",
+ "description": "ADFSSignInLogsPasswordSpray_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion7')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Reset-AADUserPassword-EntityTrigger",
- "type": "string"
- }
- },
- "variables": {
- "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
- "office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-3": "[[variables('connection-3')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
- "resources": [
- {
- "properties": {
- "provisioningState": "Succeeded",
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_entity": {
- "type": "ApiConnectionWebhook",
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "path": "/entity/@{encodeURIComponent('Account')}"
- }
- }
- },
- "actions": {
- "Condition_-_is_manager_available": {
- "actions": {
- "Condition_2": {
- "actions": {
- "Add_comment_to_incident_-_manager_available": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['IncidentArmID']",
- "message": "User @{variables('AccountDetails')} password was reset in AAD and their manager @{body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']} was contacted using playbook.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- },
- "runAfter": {
- "Send_an_email_-_to_manager_with_password_details": [
- "Succeeded"
- ]
- },
- "expression": {
- "and": [
- {
- "not": {
- "equals": [
- "@triggerBody()?['IncidentArmID']",
- "@null"
- ]
- }
- }
- ]
- },
- "type": "If"
- },
- "Parse_JSON_-_HTTP_-_get_manager": {
- "type": "ParseJson",
- "inputs": {
- "content": "@body('HTTP_-_get_manager')",
- "schema": {
- "properties": {
- "userPrincipalName": {
- "type": "string"
- }
- },
- "type": "object"
- }
- }
- },
- "Send_an_email_-_to_manager_with_password_details": {
- "runAfter": {
- "Parse_JSON_-_HTTP_-_get_manager": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "Body": "User, @{variables('AccountDetails')}, was involved in part of a security incident. As part of remediation, the user password has been reset.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
",
- "Subject": "A user password was reset due to security incident.",
- "To": "@body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "method": "post",
- "path": "/v2/Mail"
- }
- }
- },
- "runAfter": {
- "HTTP_-_get_manager": [
- "Succeeded",
- "Failed"
- ]
- },
- "else": {
- "actions": {
- "Condition": {
- "actions": {
- "Add_comment_to_incident_-_manager_not_available": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['IncidentArmID']",
- "message": "User @{variables('AccountDetails')} password was reset in AAD but the user doesn't have a manager.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- },
- "expression": {
- "and": [
- {
- "not": {
- "equals": [
- "@triggerBody()?['IncidentArmID']",
- "@null"
- ]
- }
- }
- ]
- },
- "type": "If"
- }
- }
- },
- "expression": {
- "and": [
- {
- "equals": [
- "@outputs('HTTP_-_get_manager')['statusCode']",
- 200
- ]
- }
- ]
- },
- "type": "If"
- },
- "HTTP_-_get_manager": {
- "runAfter": {
- "HTTP_-_reset_a_password": [
- "Succeeded"
- ]
- },
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com",
- "type": "ManagedServiceIdentity"
- },
- "method": "GET",
- "uri": "https://graph.microsoft.com/v1.0/users/@{variables('AccountDetails')}/manager"
- }
- },
- "HTTP_-_reset_a_password": {
- "runAfter": {
- "Initialize_variable_Account": [
- "Succeeded"
- ]
- },
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com",
- "type": "ManagedServiceIdentity"
- },
- "body": {
- "passwordProfile": {
- "forceChangePasswordNextSignIn": true,
- "forceChangePasswordNextSignInWithMfa": false,
- "password": "@{variables('Password')}"
- }
- },
- "method": "PATCH",
- "uri": "https://graph.microsoft.com/v1.0/users/@{variables('AccountDetails')}"
- }
- },
- "Initialize_variable": {
- "type": "InitializeVariable",
- "inputs": {
- "variables": [
- {
- "name": "Password",
- "type": "String",
- "value": "null"
- }
- ]
+ "contentVersion": "[variables('analyticRuleVersion4')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId4')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "Identifies evidence of password spray activity against Connect Health for AD FS sign-in events by looking for failures from multiple accounts from the same IP address within a time window.\nReference: https://adfshelp.microsoft.com/References/ConnectHealthErrorCodeReference",
+ "displayName": "Password spray attack against ADFSSignInLogs",
+ "enabled": false,
+ "query": "let queryfrequency = 30m;\nlet accountthreshold = 10;\nlet successCodes = dynamic([0, 50144]);\nADFSSignInLogs\n| extend IngestionTime = ingestion_time()\n| where IngestionTime > ago(queryfrequency)\n| where not(todynamic(AuthenticationDetails)[0].authenticationMethod == \"Integrated Windows Authentication\")\n| summarize\n DistinctFailureCount = dcountif(UserPrincipalName, ResultType !in (successCodes)),\n DistinctSuccessCount = dcountif(UserPrincipalName, ResultType in (successCodes)),\n SuccessAccounts = make_set_if(UserPrincipalName, ResultType in (successCodes), 250),\n arg_min(TimeGenerated, *)\n by IPAddress\n| where DistinctFailureCount > DistinctSuccessCount and DistinctFailureCount >= accountthreshold\n//| extend SuccessAccounts = iff(array_length(SuccessAccounts) != 0, SuccessAccounts, dynamic([\"null\"]))\n//| mv-expand SuccessAccounts\n| project TimeGenerated, Category, OperationName, IPAddress, DistinctFailureCount, DistinctSuccessCount, SuccessAccounts, AuthenticationRequirement, ConditionalAccessStatus, IsInteractive, UserAgent, NetworkLocationDetails, DeviceDetail, TokenIssuerType, TokenIssuerName, ResourceIdentity\n",
+ "queryFrequency": "PT30M",
+ "queryPeriod": "PT1H",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "ADFSSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "CredentialAccess"
+ ],
+ "techniques": [
+ "T1110"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- },
- "Initialize_variable_Account": {
- "runAfter": {
- "Set_variable_-_password": [
- "Succeeded"
- ]
- },
- "type": "InitializeVariable",
- "inputs": {
- "variables": [
- {
- "name": "AccountDetails",
- "type": "string",
- "value": "@{concat(triggerBody()?['Entity']?['properties']?['Name'],'@',triggerBody()?['Entity']?['properties']?['UPNSuffix'])}"
- }
- ]
+ ],
+ "entityType": "IP"
+ }
+ ]
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId4'),'/'))))]",
+ "properties": {
+ "description": "Azure Active Directory Analytics Rule 4",
+ "parentId": "[variables('analyticRuleId4')]",
+ "contentId": "[variables('_analyticRulecontentId4')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion4')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ }
+ }
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId4')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Password spray attack against ADFSSignInLogs",
+ "contentProductId": "[variables('_analyticRulecontentProductId4')]",
+ "id": "[variables('_analyticRulecontentProductId4')]",
+ "version": "[variables('analyticRuleVersion4')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName5')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "AdminPromoAfterRoleMgmtAppPermissionGrant_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion5')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId5')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "This rule looks for a service principal being granted the Microsoft Graph RoleManagement.ReadWrite.Directory (application) permission before being used to add an Azure AD object or user account to an Admin directory role (i.e. Global Administrators).\nThis is a known attack path that is usually abused when a service principal already has the AppRoleAssignment.ReadWrite.All permission granted. This permission allows an app to manage permission grants for application permissions to any API.\nA service principal can promote itself or other service principals to admin roles (i.e. Global Administrators). This would be considered a privilege escalation technique.\nRef : https://docs.microsoft.com/graph/permissions-reference#role-management-permissions, https://docs.microsoft.com/graph/api/directoryrole-post-members?view=graph-rest-1.0&tabs=http",
+ "displayName": "Admin promotion after Role Management Application Permission Grant",
+ "enabled": false,
+ "query": "let query_frequency = 1h;\nlet query_period = 2h;\nAuditLogs\n| where TimeGenerated > ago(query_period)\n| where Category =~ \"ApplicationManagement\" and LoggedByService =~ \"Core Directory\"\n| where OperationName =~ \"Add app role assignment to service principal\"\n| mv-expand TargetResource = TargetResources\n| mv-expand modifiedProperty = TargetResource[\"modifiedProperties\"]\n| where tostring(modifiedProperty[\"displayName\"]) == \"AppRole.Value\"\n| extend PermissionGrant = tostring(modifiedProperty[\"newValue\"])\n| where PermissionGrant has \"RoleManagement.ReadWrite.Directory\"\n| mv-apply modifiedProperty = TargetResource[\"modifiedProperties\"] on (\n summarize modifiedProperties = make_bag(\n bag_pack(tostring(modifiedProperty[\"displayName\"]),\n bag_pack(\"oldValue\", trim(@'[\\\"\\s]+', tostring(modifiedProperty[\"oldValue\"])),\n \"newValue\", trim(@'[\\\"\\s]+', tostring(modifiedProperty[\"newValue\"])))), 100)\n)\n| project\n PermissionGrant_TimeGenerated = TimeGenerated,\n PermissionGrant_OperationName = OperationName,\n PermissionGrant_Result = Result,\n PermissionGrant,\n AppDisplayName = tostring(modifiedProperties[\"ServicePrincipal.DisplayName\"][\"newValue\"]),\n AppServicePrincipalId = tostring(modifiedProperties[\"ServicePrincipal.ObjectID\"][\"newValue\"]),\n PermissionGrant_InitiatedBy = InitiatedBy,\n PermissionGrant_TargetResources = TargetResources,\n PermissionGrant_AdditionalDetails = AdditionalDetails,\n PermissionGrant_CorrelationId = CorrelationId\n| join kind=inner (\n AuditLogs\n | where TimeGenerated > ago(query_frequency)\n | where Category =~ \"RoleManagement\" and LoggedByService =~ \"Core Directory\" and AADOperationType =~ \"Assign\"\n | where isnotempty(InitiatedBy[\"app\"])\n | mv-expand TargetResource = TargetResources\n | mv-expand modifiedProperty = TargetResource[\"modifiedProperties\"]\n | where tostring(modifiedProperty[\"displayName\"]) in (\"Role.DisplayName\", \"RoleDefinition.DisplayName\")\n | extend RoleAssignment = tostring(modifiedProperty[\"newValue\"])\n | where RoleAssignment contains \"Admin\"\n | project\n RoleAssignment_TimeGenerated = TimeGenerated,\n RoleAssignment_OperationName = OperationName,\n RoleAssignment_Result = Result,\n RoleAssignment,\n TargetType = tostring(TargetResources[0][\"type\"]),\n Target = iff(isnotempty(TargetResources[0][\"displayName\"]), tostring(TargetResources[0][\"displayName\"]), tolower(TargetResources[0][\"userPrincipalName\"])),\n TargetId = tostring(TargetResources[0][\"id\"]),\n RoleAssignment_InitiatedBy = InitiatedBy,\n RoleAssignment_TargetResources = TargetResources,\n RoleAssignment_AdditionalDetails = AdditionalDetails,\n RoleAssignment_CorrelationId = CorrelationId,\n AppServicePrincipalId = tostring(InitiatedBy[\"app\"][\"servicePrincipalId\"])\n ) on AppServicePrincipalId\n| where PermissionGrant_TimeGenerated < RoleAssignment_TimeGenerated\n| extend\n TargetName = tostring(split(Target, \"@\")[0]),\n TargetUPNSuffix = tostring(split(Target, \"@\")[1])\n| project PermissionGrant_TimeGenerated, PermissionGrant_OperationName, PermissionGrant_Result, PermissionGrant, AppDisplayName, AppServicePrincipalId, PermissionGrant_InitiatedBy, PermissionGrant_TargetResources, PermissionGrant_AdditionalDetails, PermissionGrant_CorrelationId, RoleAssignment_TimeGenerated, RoleAssignment_OperationName, RoleAssignment_Result, RoleAssignment, TargetType, Target, TargetName, TargetUPNSuffix, TargetId, RoleAssignment_InitiatedBy, RoleAssignment_TargetResources, RoleAssignment_AdditionalDetails, RoleAssignment_CorrelationId\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "PT2H",
+ "severity": "High",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "PrivilegeEscalation",
+ "Persistence"
+ ],
+ "techniques": [
+ "T1098",
+ "T1078"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "AppDisplayName",
+ "identifier": "Name"
}
- },
- "Set_variable_-_password": {
- "runAfter": {
- "Initialize_variable": [
- "Succeeded"
- ]
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "TargetName",
+ "identifier": "Name"
},
- "type": "SetVariable",
- "inputs": {
- "name": "Password",
- "value": "@{substring(guid(), 0, 10)}"
+ {
+ "columnName": "TargetUPNSuffix",
+ "identifier": "UPNSuffix"
}
- }
+ ],
+ "entityType": "Account"
+ }
+ ]
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId5'),'/'))))]",
+ "properties": {
+ "description": "Azure Active Directory Analytics Rule 5",
+ "parentId": "[variables('analyticRuleId5')]",
+ "contentId": "[variables('_analyticRulecontentId5')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion5')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ }
+ }
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId5')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Admin promotion after Role Management Application Permission Grant",
+ "contentProductId": "[variables('_analyticRulecontentProductId5')]",
+ "id": "[variables('_analyticRulecontentProductId5')]",
+ "version": "[variables('analyticRuleVersion5')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName6')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "AnomalousUserAppSigninLocationIncrease-detection_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion6')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId6')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "This query over Azure Active Directory sign-in considers all user sign-ins for each Azure Active\nDirectory application and picks out the most anomalous change in location profile for a user within an\nindividual application",
+ "displayName": "Anomalous sign-in location by user account and authenticating application",
+ "enabled": false,
+ "query": "// Adjust this figure to adjust how sensitive this detection is\nlet sensitivity = 2.5;\nlet AuthEvents = materialize(\nunion isfuzzy=True SigninLogs, AADNonInteractiveUserSignInLogs\n| where TimeGenerated > ago(7d)\n| where ResultType == 0\n| extend LocationDetails = LocationDetails_dynamic\n| extend Location = strcat(LocationDetails.countryOrRegion, \"-\", LocationDetails.state,\"-\", LocationDetails.city)\n| where Location != \"--\");\nAuthEvents\n| summarize dcount(Location) by AppDisplayName, AppId, UserPrincipalName, UserId, bin(startofday(TimeGenerated), 1d)\n| where dcount_Location > 2\n| summarize CountOfLocations = make_list(dcount_Location, 10000), TimeStamp = make_list(TimeGenerated, 10000) by AppId, UserId\n| extend (Anomalies, Score, Baseline) = series_decompose_anomalies(CountOfLocations, sensitivity, -1, 'linefit')\n| mv-expand CountOfLocations to typeof(double), TimeStamp to typeof(datetime), Anomalies to typeof(double), Score to typeof(double), Baseline to typeof(long)\n| where Anomalies > 0\n| join kind=inner( AuthEvents | extend TimeStamp = startofday(TimeGenerated)) on UserId, AppId\n| extend SignInDetails = bag_pack(\"TimeGenerated\", TimeGenerated, \"Location\", Location, \"Source\", IPAddress, \"Device\", DeviceDetail_dynamic)\n| summarize SignInDetailsSet=make_set(SignInDetails, 1000) by UserId, UserPrincipalName, CountOfLocations, TimeStamp, AppId, AppDisplayName\n| extend Name = split(UserPrincipalName, \"@\")[0], UPNSuffix = split(UserPrincipalName, \"@\")[1]\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P7D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
- },
- "parameters": {
- "$connections": {
- "value": {
- "microsoftsentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
+ ],
+ "tactics": [
+ "InitialAccess"
+ ],
+ "techniques": [
+ "T1078"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
},
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]",
- "connectionName": "[[variables('office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ },
+ {
+ "columnName": "UserId",
+ "identifier": "AadUserId"
}
- }
+ ],
+ "entityType": "Account"
}
- }
- },
- "name": "[[parameters('PlaybookName')]",
- "type": "Microsoft.Logic/workflows",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Reset-AADUserPassword-EntityTrigger",
- "hidden-SentinelTemplateVersion": "1.1",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "apiVersion": "2017-07-01",
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]"
- ]
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('MicrosoftSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
- "properties": {
- "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-2')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
- "properties": {
- "displayName": "[[variables('office365ConnectionName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
+ ],
+ "eventGroupingSettings": {
+ "aggregationKind": "SingleAlert"
+ },
+ "customDetails": {
+ "Application": "AppDisplayName"
+ },
+ "alertDetailsOverride": {
+ "alertDescriptionFormat": "This query over Azure Active Directory sign-in considers all user sign-ins for each Azure Active\nDirectory application and picks out the most anomalous change in location profile for a user within an\nindividual application. This has detected {{UserPrincipalName}} signing into {{AppDisplayName}} from {{CountOfLocations}} \ndifferent locations.\n",
+ "alertDisplayNameFormat": "Anomalous sign-in location by {{UserPrincipalName}} to {{AppDisplayName}}"
}
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId7'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId6'),'/'))))]",
"properties": {
- "parentId": "[variables('playbookId7')]",
- "contentId": "[variables('_playbookContentId7')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion7')]",
+ "description": "Azure Active Directory Analytics Rule 6",
+ "parentId": "[variables('analyticRuleId6')]",
+ "contentId": "[variables('_analyticRulecontentId6')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion6')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -3463,367 +1759,490 @@
}
}
}
- ],
- "metadata": {
- "title": "Reset Azure AD User Password - Entity trigger",
- "description": "This playbook will reset the user password using Graph API. It will send the password (which is a random guid substring) to the user's manager. The user will have to reset the password upon login.",
- "postDeployment": [
- "1. Assign Password Administrator permission to managed identity.",
- "2. Assign Microsoft Sentinel Responder permission to managed identity.",
- "3. Authorize Office 365 Outlook connection"
- ],
- "lastUpdateTime": "2022-12-06T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": {
- "version": "1.1",
- "title": "[variables('blanks')]",
- "notes": [
- "Initial version"
- ]
- }
- }
+ ]
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId7')]",
- "contentKind": "Playbook",
- "displayName": "Reset-AADUserPassword-EntityTrigger",
- "contentProductId": "[variables('_playbookcontentProductId7')]",
- "id": "[variables('_playbookcontentProductId7')]",
- "version": "[variables('playbookVersion7')]"
+ "contentId": "[variables('_analyticRulecontentId6')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Anomalous sign-in location by user account and authenticating application",
+ "contentProductId": "[variables('_analyticRulecontentProductId6')]",
+ "id": "[variables('_analyticRulecontentProductId6')]",
+ "version": "[variables('analyticRuleVersion6')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName8')]",
+ "name": "[variables('analyticRuleTemplateSpecName7')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Reset-AADPassword-IncidentTrigger Playbook with template version 3.0.3",
+ "description": "AuthenticationMethodsChangedforPrivilegedAccount_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion8')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Reset-AADPassword-IncidentTrigger",
- "type": "string"
+ "contentVersion": "[variables('analyticRuleVersion7')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId7')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "Identifies authentication methods being changed for a privileged account. This could be an indication of an attacker adding an auth method to the account so they can have continued access.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor-1",
+ "displayName": "Authentication Methods Changed for Privileged Account",
+ "enabled": false,
+ "query": "let queryperiod = 14d;\nlet queryfrequency = 2h;\nlet security_info_actions = dynamic([\"User registered security info\", \"User changed default security info\", \"User deleted security info\", \"Admin updated security info\", \"User reviewed security info\", \"Admin deleted security info\", \"Admin registered security info\"]);\nlet VIPUsers = (\n IdentityInfo\n | where TimeGenerated > ago(queryperiod)\n | mv-expand AssignedRoles\n | where AssignedRoles contains 'Admin'\n | summarize by AccountUPN);\nAuditLogs\n| where TimeGenerated > ago(queryfrequency)\n| where Category =~ \"UserManagement\"\n| where ActivityDisplayName in (security_info_actions)\n| extend Initiator = tostring(InitiatedBy.user.userPrincipalName)\n| extend IP = tostring(InitiatedBy.user.ipAddress)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = tostring(TargetResource.userPrincipalName)\n )\n| where Target in~ (VIPUsers)\n// Uncomment the line below if you are experiencing high volumes of Target entities. If this is uncommented, the Target column will not be mapped to an entity.\n//| summarize Start=min(TimeGenerated), End=max(TimeGenerated), Actions = make_set(ResultReason, MaxSize=8), Targets=make_set(Target, MaxSize=256) by Initiator, IP, Result\n// Comment out this line below, if line above is used.\n| summarize Start=min(TimeGenerated), End=max(TimeGenerated), Actions = make_set(ResultReason, MaxSize=8) by Initiator, IP, Result, Targets = Target\n| extend InitiatorName = tostring(split(Initiator,'@',0)[0]), \n InitiatorUPNSuffix = tostring(split(Initiator,'@',1)[0]),\n TargetName = iff(tostring(Targets) has \"[\", \"\", tostring(split(Targets,'@',0)[0])), \n TargetUPNSuffix = iff(tostring(Targets) has \"[\", \"\", tostring(split(Targets,'@',1)[0]))\n",
+ "queryFrequency": "PT2H",
+ "queryPeriod": "P14D",
+ "severity": "High",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "Persistence"
+ ],
+ "techniques": [
+ "T1098"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatorName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "InitiatorUPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "TargetName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "TargetUPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "IP",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ]
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId7'),'/'))))]",
+ "properties": {
+ "description": "Azure Active Directory Analytics Rule 7",
+ "parentId": "[variables('analyticRuleId7')]",
+ "contentId": "[variables('_analyticRulecontentId7')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion7')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ }
+ }
}
- },
- "variables": {
- "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
- "office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-3": "[[variables('connection-3')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId7')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Authentication Methods Changed for Privileged Account",
+ "contentProductId": "[variables('_analyticRulecontentProductId7')]",
+ "id": "[variables('_analyticRulecontentProductId7')]",
+ "version": "[variables('analyticRuleVersion7')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName8')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "AzureAADPowerShellAnomaly_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion8')]",
+ "parameters": {},
+ "variables": {},
"resources": [
{
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId8')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
"properties": {
- "provisioningState": "Succeeded",
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_incident": {
- "type": "ApiConnectionWebhook",
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "path": "/incident-creation"
- }
- }
+ "description": "This will alert when a user or application signs in using Azure Active Directory PowerShell to access non-Active Directory resources, such as the Azure Key Vault, which may be undesired or unauthorized behavior.\nFor capabilities and expected behavior of the Azure Active Directory PowerShell module, see: https://docs.microsoft.com/powershell/module/azuread/?view=azureadps-2.0.\nFor further information on Azure Active Directory Signin activity reports, see: https://docs.microsoft.com/azure/active-directory/reports-monitoring/concept-sign-ins.",
+ "displayName": "Azure Active Directory PowerShell accessing non-AAD resources",
+ "enabled": false,
+ "query": "let aadFunc = (tableName:string){\ntable(tableName)\n| where AppId =~ \"1b730954-1685-4b74-9bfd-dac224a7b894\" // AppDisplayName IS Azure Active Directory PowerShell\n| where TokenIssuerType =~ \"AzureAD\"\n| where ResourceIdentity !in (\"00000002-0000-0000-c000-000000000000\", \"00000003-0000-0000-c000-000000000000\") // ResourceDisplayName IS NOT Windows Azure Active Directory OR Microsoft Graph\n| extend Status = todynamic(Status)\n| where Status.errorCode == 0 // Success\n| project-reorder IPAddress, UserAgent, ResourceDisplayName, UserDisplayName, UserId, UserPrincipalName, Type\n| order by TimeGenerated desc\n// New entity mapping\n| extend timestamp = TimeGenerated, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "PT1H",
+ "severity": "Low",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
},
- "actions": {
- "Entities_-_Get_Accounts": {
- "runAfter": {
- "Set_variable_-_password": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": "@triggerBody()?['object']?['properties']?['relatedEntities']",
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/entities/account"
- }
- },
- "For_each": {
- "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
- "actions": {
- "Condition_-_is_manager_available": {
- "actions": {
- "Add_comment_to_incident_-_manager_available": {
- "runAfter": {
- "Send_an_email_-_to_manager_with_password_details": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['object']?['id']",
- "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} password was reset in AAD and their manager @{body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']} was contacted using playbook.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- },
- "Parse_JSON_-_HTTP_-_get_manager": {
- "type": "ParseJson",
- "inputs": {
- "content": "@body('HTTP_-_get_manager')",
- "schema": {
- "properties": {
- "userPrincipalName": {
- "type": "string"
- }
- },
- "type": "object"
- }
- }
- },
- "Send_an_email_-_to_manager_with_password_details": {
- "runAfter": {
- "Parse_JSON_-_HTTP_-_get_manager": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "Body": "User, @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}, was involved in part of a security incident. As part of remediation, the user password has been reset.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
",
- "Subject": "A user password was reset due to security incident.",
- "To": "@body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "method": "post",
- "path": "/v2/Mail"
- }
- }
- },
- "runAfter": {
- "HTTP_-_get_manager": [
- "Succeeded",
- "Failed"
- ]
- },
- "else": {
- "actions": {
- "Add_comment_to_incident_-_manager_not_available": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['object']?['id']",
- "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} password was reset in AAD but the user doesn't have a manager.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- }
- },
- "expression": {
- "and": [
- {
- "equals": [
- "@outputs('HTTP_-_get_manager')['statusCode']",
- 200
- ]
- }
- ]
- },
- "type": "If"
- },
- "HTTP_-_get_manager": {
- "runAfter": {
- "HTTP_-_reset_a_password": [
- "Succeeded"
- ]
- },
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com",
- "type": "ManagedServiceIdentity"
- },
- "method": "GET",
- "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/manager"
- }
- },
- "HTTP_-_reset_a_password": {
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com",
- "type": "ManagedServiceIdentity"
- },
- "body": {
- "passwordProfile": {
- "forceChangePasswordNextSignIn": true,
- "forceChangePasswordNextSignInWithMfa": false,
- "password": "@{variables('Password')}"
- }
- },
- "method": "PATCH",
- "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}"
- }
- }
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess"
+ ],
+ "techniques": [
+ "T1078"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
},
- "runAfter": {
- "Entities_-_Get_Accounts": [
- "Succeeded"
- ]
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
},
- "type": "Foreach"
- },
- "Initialize_variable": {
- "type": "InitializeVariable",
- "inputs": {
- "variables": [
- {
- "name": "Password",
- "type": "String",
- "value": "null"
- }
- ]
+ {
+ "columnName": "UserId",
+ "identifier": "AadUserId"
}
- },
- "Set_variable_-_password": {
- "runAfter": {
- "Initialize_variable": [
- "Succeeded"
- ]
- },
- "type": "SetVariable",
- "inputs": {
- "name": "Password",
- "value": "@{substring(guid(), 0, 10)}"
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- }
+ ],
+ "entityType": "IP"
}
+ ]
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId8'),'/'))))]",
+ "properties": {
+ "description": "Azure Active Directory Analytics Rule 8",
+ "parentId": "[variables('analyticRuleId8')]",
+ "contentId": "[variables('_analyticRulecontentId8')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion8')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
},
- "parameters": {
- "$connections": {
- "value": {
- "microsoftsentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ }
+ }
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId8')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Azure Active Directory PowerShell accessing non-AAD resources",
+ "contentProductId": "[variables('_analyticRulecontentProductId8')]",
+ "id": "[variables('_analyticRulecontentProductId8')]",
+ "version": "[variables('analyticRuleVersion8')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName9')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "AzureADRoleManagementPermissionGrant_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion9')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId9')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "Identifies when the Microsoft Graph RoleManagement.ReadWrite.Directory (Delegated or Application) permission is granted to a service principal.\nThis permission allows an application to read and manage the role-based access control (RBAC) settings for your company's directory.\nAn adversary could use this permission to add an Azure AD object to an Admin directory role and escalate privileges.\nRef : https://docs.microsoft.com/graph/permissions-reference#role-management-permissions\nRef : https://docs.microsoft.com/graph/api/directoryrole-post-members?view=graph-rest-1.0&tabs=http",
+ "displayName": "Azure AD Role Management Permission Grant",
+ "enabled": false,
+ "query": "AuditLogs\n| where Category =~ \"ApplicationManagement\" and LoggedByService =~ \"Core Directory\" and OperationName in~ (\"Add delegated permission grant\", \"Add app role assignment to service principal\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName in~ (\"AppRole.Value\",\"DelegatedPermissionGrant.Scope\")\n | extend DisplayName = tostring(Property.displayName), PermissionGrant = trim('\"',tostring(Property.newValue))\n )\n| where PermissionGrant has \"RoleManagement.ReadWrite.Directory\"\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"ServicePrincipal.DisplayName\"\n | extend AppDisplayName = trim('\"',tostring(Property.newValue))\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"ServicePrincipal.ObjectID\"\n | extend AppServicePrincipalId = trim('\"',tostring(Property.newValue))\n )\n| extend \n Initiator = iif(isnotempty(InitiatedBy.app), tostring(InitiatedBy.app.displayName), tostring(InitiatedBy.user.userPrincipalName)),\n InitiatorId = iif(isnotempty(InitiatedBy.app), tostring(InitiatedBy.app.servicePrincipalId), tostring(InitiatedBy.user.id))\n| project TimeGenerated, OperationName, Result, PermissionGrant, AppDisplayName, AppServicePrincipalId, Initiator, InitiatorId, InitiatedBy, TargetResources, AdditionalDetails, CorrelationId\n| extend Name = tostring(split(Initiator,'@',0)[0]), UPNSuffix = tostring(split(Initiator,'@',1)[0])\n",
+ "queryFrequency": "PT2H",
+ "queryPeriod": "PT2H",
+ "severity": "High",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "Persistence",
+ "Impact"
+ ],
+ "techniques": [
+ "T1098",
+ "T1078"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
},
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]",
- "connectionName": "[[variables('office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "AppDisplayName",
+ "identifier": "Name"
+ }
+ ],
+ "entityType": "Account"
}
- }
- },
- "name": "[[parameters('PlaybookName')]",
- "type": "Microsoft.Logic/workflows",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Reset-AADUserPassword",
- "hidden-SentinelTemplateVersion": "1.1",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "apiVersion": "2017-07-01",
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]"
- ]
+ ]
+ }
},
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('MicrosoftSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId9'),'/'))))]",
"properties": {
- "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-2')]"
+ "description": "Azure Active Directory Analytics Rule 9",
+ "parentId": "[variables('analyticRuleId9')]",
+ "contentId": "[variables('_analyticRulecontentId9')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion9')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
}
}
- },
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId9')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Azure AD Role Management Permission Grant",
+ "contentProductId": "[variables('_analyticRulecontentProductId9')]",
+ "id": "[variables('_analyticRulecontentProductId9')]",
+ "version": "[variables('analyticRuleVersion9')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName10')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "AzurePortalSigninfromanotherAzureTenant_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion10')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId10')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
"properties": {
- "displayName": "[[variables('office365ConnectionName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
+ "description": "This query looks for successful sign in attempts to the Azure Portal where the user who is signing in from another Azure tenant,\n and the IP address the login attempt is from is an Azure IP. A threat actor who compromises an Azure tenant may look\n to pivot to other tenants leveraging cross-tenant delegated access in this manner.",
+ "displayName": "Azure Portal sign in from another Azure Tenant",
+ "enabled": false,
+ "query": "// Get details of current Azure Ranges (note this URL updates regularly so will need to be manually updated over time)\n// You may find the name of the new JSON here: https://www.microsoft.com/download/details.aspx?id=56519\n// On the downloads page, click the 'details' button, and then replace just the filename in the URL below\nlet azure_ranges = externaldata(changeNumber: string, cloud: string, values: dynamic)\n[\"https://raw.githubusercontent.com/microsoft/mstic/master/PublicFeeds/MSFTIPRanges/ServiceTags_Public.json\"] with(format='multijson')\n| mv-expand values\n| mv-expand values.properties.addressPrefixes\n| mv-expand values_properties_addressPrefixes\n| summarize by tostring(values_properties_addressPrefixes)\n| extend isipv4 = parse_ipv4(values_properties_addressPrefixes)\n| extend isipv6 = parse_ipv6(values_properties_addressPrefixes)\n| extend ip_type = case(isnotnull(isipv4), \"v4\", \"v6\")\n| summarize make_list(values_properties_addressPrefixes) by ip_type\n;\nSigninLogs\n// Limiting to Azure Portal really reduces false positives and helps focus on potential admin activity\n| where ResultType == 0\n| where AppDisplayName =~ \"Azure Portal\"\n| extend isipv4 = parse_ipv4(IPAddress)\n| extend ip_type = case(isnotnull(isipv4), \"v4\", \"v6\")\n // Only get logons where the IP address is in an Azure range\n| join kind=fullouter (azure_ranges) on ip_type\n| extend ipv6_match = ipv6_is_in_any_range(IPAddress, list_values_properties_addressPrefixes)\n| extend ipv4_match = ipv4_is_in_any_range(IPAddress, list_values_properties_addressPrefixes)\n| where ipv4_match or ipv6_match \n// Limit to where the user is external to the tenant\n| where HomeTenantId != ResourceTenantId\n// Further limit it to just access to the current tenant (you can drop this if you wanted to look elsewhere as well but it helps reduce FPs)\n| where ResourceTenantId == AADTenantId\n| summarize FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated), make_set(ResourceDisplayName) by UserPrincipalName, IPAddress, UserAgent, Location, HomeTenantId, ResourceTenantId, UserId\n| extend AccountName = split(UserPrincipalName, \"@\")[0]\n| extend UPNSuffix = split(UserPrincipalName, \"@\")[1]\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "PT1H",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess"
+ ],
+ "techniques": [
+ "T1199"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "AccountName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ },
+ {
+ "columnName": "UserId",
+ "identifier": "AadUserId"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "IPAddress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ],
+ "alertDetailsOverride": {
+ "alertDescriptionFormat": "This query looks for successful sign in attempts to the Azure Portal where the user who is signing in from another Azure tenant,\nand the IP address the login attempt is from is an Azure IP. A threat actor who compromises an Azure tenant may look\nto pivot to other tenants leveraging cross-tenant delegated access in this manner.\nIn this instance {{UserPrincipalName}} logged in at {{FirstSeen}} from IP Address {{IPAddress}}.\n",
+ "alertDisplayNameFormat": "Azure Portal sign in by {{UserPrincipalName}} from another Azure Tenant with IP Address {{IPAddress}}"
}
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId8'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId10'),'/'))))]",
"properties": {
- "parentId": "[variables('playbookId8')]",
- "contentId": "[variables('_playbookContentId8')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion8')]",
+ "description": "Azure Active Directory Analytics Rule 10",
+ "parentId": "[variables('analyticRuleId10')]",
+ "contentId": "[variables('_analyticRulecontentId10')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion10')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -3841,322 +2260,345 @@
}
}
}
- ],
- "metadata": {
- "title": "Reset Azure AD User Password - Incident Trigger",
- "description": "This playbook will reset the user password using Graph API. It will send the password (which is a random guid substring) to the user's manager. The user will have to reset the password upon login.",
- "prerequisites": [
- "None"
- ],
- "postDeployment": [
- "1. Assign Password Administrator permission to managed identity.",
- "2. Assign Microsoft Sentinel Responder permission to managed identity.",
- "3. Authorize Office 365 Outlook connection"
- ],
- "lastUpdateTime": "2022-07-11T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": [
- {
- "version": "1.0.0",
- "title": " Added manager notification action",
- "notes": [
- "Initial version"
- ]
- }
- ]
- }
+ ]
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId8')]",
- "contentKind": "Playbook",
- "displayName": "Reset-AADPassword-IncidentTrigger",
- "contentProductId": "[variables('_playbookcontentProductId8')]",
- "id": "[variables('_playbookcontentProductId8')]",
- "version": "[variables('playbookVersion8')]"
+ "contentId": "[variables('_analyticRulecontentId10')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Azure Portal sign in from another Azure Tenant",
+ "contentProductId": "[variables('_analyticRulecontentProductId10')]",
+ "id": "[variables('_analyticRulecontentProductId10')]",
+ "version": "[variables('analyticRuleVersion10')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName9')]",
+ "name": "[variables('analyticRuleTemplateSpecName11')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Revoke-AADSignInSessions-alert Playbook with template version 3.0.3",
+ "description": "Brute Force Attack against GitHub Account_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion9')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Revoke-AADSignInSessions-alert",
- "type": "string"
- },
- "UserName": {
- "defaultValue": "@",
- "type": "string"
- }
- },
- "variables": {
- "AzureSentinelConnectionName": "[[concat('azuresentinel-', parameters('PlaybookName'))]",
- "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "Office365UsersConnectionName": "[[concat('office365users-', parameters('PlaybookName'))]",
- "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-1": "[[variables('connection-1')]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365users')]",
- "_connection-3": "[[variables('connection-3')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
+ "contentVersion": "[variables('analyticRuleVersion11')]",
+ "parameters": {},
+ "variables": {},
"resources": [
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('AzureSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId11')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
"properties": {
- "displayName": "[[parameters('PlaybookName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-1')]"
- }
+ "description": "Attackers who are trying to guess your users' passwords or use brute-force methods to get in. If your organization is using SSO with Azure Active Directory, authentication logs to GitHub.com will be generated. Using the following query can help you identify a sudden increase in failed logon attempt of users.",
+ "displayName": "Brute Force Attack against GitHub Account",
+ "enabled": false,
+ "query": "let LearningPeriod = 7d;\nlet BinTime = 1h;\nlet RunTime = 1h;\nlet StartTime = 1h; \nlet sensitivity = 2.5;\nlet EndRunTime = StartTime - RunTime;\nlet EndLearningTime = StartTime + LearningPeriod;\nlet aadFunc = (tableName:string){\ntable(tableName) \n| where TimeGenerated between (ago(EndLearningTime) .. ago(EndRunTime))\n| where AppDisplayName =~ \"GitHub.com\"\n| where ResultType != 0\n| make-series FailedLogins = count() on TimeGenerated from ago(LearningPeriod) to ago(EndRunTime) step BinTime by UserPrincipalName, Type\n| extend (Anomalies, Score, Baseline) = series_decompose_anomalies(FailedLogins, sensitivity, -1, 'linefit')\n| mv-expand FailedLogins to typeof(double), TimeGenerated to typeof(datetime), Anomalies to typeof(double), Score to typeof(double), Baseline to typeof(long) \n| where TimeGenerated >= ago(RunTime)\n| where Anomalies > 0 and Baseline > 0\n| join kind=inner (\n table(tableName) \n | where TimeGenerated between (ago(StartTime) .. ago(EndRunTime))\n | where AppDisplayName =~ \"GitHub.com\"\n | where ResultType != 0\n | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), IPAddresses = make_set(IPAddress,100), Locations = make_set(LocationDetails,20), Devices = make_set(DeviceDetail,20) by UserPrincipalName \n ) on UserPrincipalName\n| extend timestamp = TimeGenerated, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "P7D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "CredentialAccess"
+ ],
+ "techniques": [
+ "T1110"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ }
+ ]
}
},
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('Office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId11'),'/'))))]",
"properties": {
- "displayName": "[[parameters('UserName')]",
- "api": {
- "id": "[[variables('_connection-2')]"
+ "description": "Azure Active Directory Analytics Rule 11",
+ "parentId": "[variables('analyticRuleId11')]",
+ "contentId": "[variables('_analyticRulecontentId11')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion11')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
}
}
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId11')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Brute Force Attack against GitHub Account",
+ "contentProductId": "[variables('_analyticRulecontentProductId11')]",
+ "id": "[variables('_analyticRulecontentProductId11')]",
+ "version": "[variables('analyticRuleVersion11')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName12')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "BruteForceCloudPC_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion12')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId12')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "Identifies evidence of brute force activity against a Windows 365 Cloud PC by highlighting multiple authentication failures and by a successful authentication within a given time window.",
+ "displayName": "Brute force attack against a Cloud PC",
+ "enabled": false,
+ "query": "let authenticationWindow = 20m;\nlet sensitivity = 2.5;\nSigninLogs\n| where AppDisplayName =~ \"Windows Sign In\"\n| extend FailureOrSuccess = iff(ResultType in (\"0\", \"50125\", \"50140\", \"70043\", \"70044\"), \"Success\", \"Failure\")\n| summarize FailureCount = countif(FailureOrSuccess==\"Failure\"), SuccessCount = countif(FailureOrSuccess==\"Success\"), IPAddresses = make_set(IPAddress,1000)\n by bin(TimeGenerated, authenticationWindow), UserDisplayName, UserPrincipalName\n| extend FailureSuccessDiff = FailureCount - SuccessCount\n| where FailureSuccessDiff > 0\n| summarize Diff = make_list(FailureSuccessDiff, 10000), TimeStamp = make_list(TimeGenerated, 10000) by UserDisplayName, UserPrincipalName//, tostring(IPAddresses)\n| extend (Anomalies, Score, Baseline) = series_decompose_anomalies(Diff, sensitivity, -1, 'linefit') \n| mv-expand Diff to typeof(double), TimeStamp to typeof(datetime), Anomalies to typeof(double), Score to typeof(double), Baseline to typeof(long)\n| where Anomalies > 0\n| summarize by UserDisplayName, UserPrincipalName\n| join kind=leftouter (\n SigninLogs\n | where AppDisplayName =~ \"Windows Sign In\"\n | extend OS = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser\n | extend StatusCode = tostring(Status.errorCode), StatusDetails = tostring(Status.additionalDetails)\n | extend State = tostring(LocationDetails.state), City = tostring(LocationDetails.city)\n | summarize StartTime = min(TimeGenerated), \n EndTime = max(TimeGenerated), \n IPAddress = make_set(IPAddress,100), \n OS = make_set(OS,20), \n Browser = make_set(Browser,20), \n City = make_set(City,100), \n ResultType = make_set(ResultType,100)\n by UserDisplayName, UserPrincipalName\n ) on UserDisplayName, UserPrincipalName\n| extend IPAddressFirst = IPAddress[0]\n| extend timestamp = StartTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P1D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "CredentialAccess"
+ ],
+ "techniques": [
+ "T1110"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "IPAddressFirst",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ]
+ }
},
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('Office365UsersConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId12'),'/'))))]",
"properties": {
- "displayName": "[[parameters('UserName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
+ "description": "Azure Active Directory Analytics Rule 12",
+ "parentId": "[variables('analyticRuleId12')]",
+ "contentId": "[variables('_analyticRulecontentId12')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion12')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
}
}
- },
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId12')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Brute force attack against a Cloud PC",
+ "contentProductId": "[variables('_analyticRulecontentProductId12')]",
+ "id": "[variables('_analyticRulecontentProductId12')]",
+ "version": "[variables('analyticRuleVersion12')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName13')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "BulkChangestoPrivilegedAccountPermissions_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion13')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
{
- "type": "Microsoft.Logic/workflows",
- "apiVersion": "2017-07-01",
- "name": "[[parameters('PlaybookName')]",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Revoke-AADSigninSessions_alert",
- "hidden-SentinelTemplateVersion": "1.0",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('Office365UsersConnectionName'))]"
- ],
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId13')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
"properties": {
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "actions": {
- "Alert_-_Get_incident": {
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "get",
- "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
- },
- "type": "ApiConnection"
- },
- "Entities_-_Get_Accounts": {
- "inputs": {
- "body": "@triggerBody()?['Entities']",
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/entities/account"
- },
- "runAfter": {
- "Alert_-_Get_incident": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- },
- "For_each": {
- "actions": {
- "Add_comment_to_incident_(V3)": {
- "inputs": {
- "body": {
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} singin sessions were revoked in AAD and their manager @{body('Get_manager_(V2)')?['displayName']} was contacted using playbook.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- },
- "runAfter": {
- "Send_an_email_(V2)": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- },
- "Get_manager_(V2)": {
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365users']['connectionId']"
- }
- },
- "method": "get",
- "path": "/codeless/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}/manager"
- },
- "runAfter": {
- "HTTP": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- },
- "HTTP": {
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com",
- "type": "ManagedServiceIdentity"
- },
- "method": "POST",
- "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/revokeSignInSessions"
- },
- "type": "Http"
- },
- "Send_an_email_(V2)": {
- "inputs": {
- "body": {
- "Body": "User, @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}, was involved in part of a security incident. As part of remediation, the user signin sessions have been revoked. The user will need to reauthenticate in all applications.
",
- "Subject": "User signin sessions were reset due to security incident.",
- "To": "@body('Get_manager_(V2)')?['mail']"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "method": "post",
- "path": "/v2/Mail"
- },
- "runAfter": {
- "Get_manager_(V2)": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- }
- },
- "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
- "runAfter": {
- "Entities_-_Get_Accounts": [
- "Succeeded"
- ]
- },
- "type": "Foreach"
- }
- },
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_alert": {
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "path": "/subscribe"
- },
- "type": "ApiConnectionWebhook"
- }
+ "description": "Identifies when changes to multiple users permissions are changed at once. Investigate immediately if not a planned change. This setting could enable an attacker access to Azure subscriptions in your environment.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-identity-management",
+ "displayName": "Bulk Changes to Privileged Account Permissions",
+ "enabled": false,
+ "query": "let AdminRecords = AuditLogs\n| where Category =~ \"RoleManagement\"\n| where ActivityDisplayName has_any (\"Add eligible member to role\", \"Add member to role\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = tostring(TargetResource.userPrincipalName),\n props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"Role.DisplayName\"\n | extend RoleName = trim('\"',tostring(Property.newValue))\n )\n| where RoleName contains \"Admin\";\nAdminRecords\n| summarize dcount(Target) by bin(TimeGenerated, 1h)\n| where dcount_Target > 9\n| join kind=rightsemi (\n AdminRecords\n | extend TimeWindow = bin(TimeGenerated, 1h)\n) on $left.TimeGenerated == $right.TimeWindow\n| extend InitiatedByUser = iff(isnotempty(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.user.userPrincipalName), \"\")\n| extend TargetName = tostring(split(Target,'@',0)[0]), TargetUPNSuffix = tostring(split(Target,'@',1)[0]),\n InitiatedByUserName = tostring(split(InitiatedByUser,'@',0)[0]), InitiatedByUserUPNSuffix = tostring(split(InitiatedByUser,'@',1)[0])\n",
+ "queryFrequency": "PT2H",
+ "queryPeriod": "PT2H",
+ "severity": "High",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
- },
- "parameters": {
- "$connections": {
- "value": {
- "azuresentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
- "connectionName": "[[variables('AzureSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
+ ],
+ "tactics": [
+ "PrivilegeEscalation"
+ ],
+ "techniques": [
+ "T1078"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "TargetName",
+ "identifier": "Name"
},
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "connectionName": "[[variables('Office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
+ {
+ "columnName": "TargetUPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatedByUserName",
+ "identifier": "Name"
},
- "office365users": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365UsersConnectionName'))]",
- "connectionName": "[[variables('Office365UsersConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365users')]"
+ {
+ "columnName": "InitiatedByUserUPNSuffix",
+ "identifier": "UPNSuffix"
}
- }
+ ],
+ "entityType": "Account"
}
+ ],
+ "customDetails": {
+ "TargetUser": "Target",
+ "InitiatedByUser": "InitiatedByUser"
}
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId9'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId13'),'/'))))]",
"properties": {
- "parentId": "[variables('playbookId9')]",
- "contentId": "[variables('_playbookContentId9')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion9')]",
+ "description": "Azure Active Directory Analytics Rule 13",
+ "parentId": "[variables('analyticRuleId13')]",
+ "contentId": "[variables('_analyticRulecontentId13')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion13')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -4174,208 +2616,349 @@
}
}
}
- ],
- "metadata": {
- "title": "Revoke-AADSignInSessions alert trigger",
- "description": "This playbook will revoke all signin sessions for the user using Graph API. It will send an email to the user's manager.",
- "prerequisites": [
- "1. You must create an app registration for graph api with appropriate permissions.",
- "2. You will need to add the managed identity that is created by the logic app to the Password Administrator role in Azure AD."
- ],
- "comments": "This playbook will revoke all signin sessions for the user using Graph API using a Beta API. It will send and email to the user's manager.",
- "lastUpdateTime": "2021-07-14T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": {
- "version": "1.0",
- "title": "[variables('blanks')]",
- "notes": [
- "Initial version"
- ]
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId13')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Bulk Changes to Privileged Account Permissions",
+ "contentProductId": "[variables('_analyticRulecontentProductId13')]",
+ "id": "[variables('_analyticRulecontentProductId13')]",
+ "version": "[variables('analyticRuleVersion13')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName14')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "BypassCondAccessRule_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion14')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId14')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "Identifies an attempt to Bypass conditional access rule(s) in Azure Active Directory.\nThe ConditionalAccessStatus column value details if there was an attempt to bypass Conditional Access\nor if the Conditional access rule was not satisfied (ConditionalAccessStatus == 1).\nReferences:\nhttps://docs.microsoft.com/azure/active-directory/conditional-access/overview\nhttps://docs.microsoft.com/azure/active-directory/reports-monitoring/concept-sign-ins\nhttps://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\nConditionalAccessStatus == 0 // Success\nConditionalAccessStatus == 1 // Failure\nConditionalAccessStatus == 2 // Not Applied\nConditionalAccessStatus == 3 // unknown",
+ "displayName": "Attempt to bypass conditional access rule in Azure AD",
+ "enabled": false,
+ "query": "let threshold = 1; // Modify this threshold value to reduce false positives based on your environment\nlet aadFunc = (tableName:string){\ntable(tableName)\n| where ConditionalAccessStatus == 1 or ConditionalAccessStatus =~ \"failure\"\n| mv-apply CAP = parse_json(ConditionalAccessPolicies) on (\n project ConditionalAccessPoliciesName = CAP.displayName, result = CAP.result\n | where result =~ \"failure\"\n)\n| extend DeviceDetail = todynamic(DeviceDetail), Status = todynamic(Status), LocationDetails = todynamic(LocationDetails)\n| extend OS = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser\n| extend State = tostring(LocationDetails.state), City = tostring(LocationDetails.city), Region = tostring(LocationDetails.countryOrRegion)\n| extend StatusCode = tostring(Status.errorCode), StatusDetails = tostring(Status.additionalDetails)\n| extend Status = strcat(StatusCode, \": \", ResultDescription)\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), Status = make_list(Status,10), StatusDetails = make_list(StatusDetails,50), IPAddresses = make_list(IPAddress,100), IPAddressCount = dcount(IPAddress), CorrelationIds = make_list(CorrelationId,100), ConditionalAccessPoliciesName = make_list(ConditionalAccessPoliciesName,100)\nby UserPrincipalName, AppDisplayName, tostring(Browser), tostring(OS), City, State, Region, Type\n| where IPAddressCount > threshold and StatusDetails !has \"MFA successfully completed\"\n| mv-expand IPAddresses, Status, StatusDetails, CorrelationIds\n| extend Status = strcat(Status, \" \", StatusDetails)\n| summarize IPAddresses = make_set(IPAddresses,100), Status = make_set(Status,10), CorrelationIds = make_set(CorrelationIds,100), ConditionalAccessPoliciesName = make_set(ConditionalAccessPoliciesName,100)\nby StartTime, EndTime, UserPrincipalName, AppDisplayName, tostring(Browser), tostring(OS), City, State, Region, IPAddressCount, Type\n| extend timestamp = StartTime, IPAddresses = tostring(IPAddresses), Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P1D",
+ "severity": "Low",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess",
+ "Persistence"
+ ],
+ "techniques": [
+ "T1078",
+ "T1098"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "IPAddresses",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ]
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId14'),'/'))))]",
+ "properties": {
+ "description": "Azure Active Directory Analytics Rule 14",
+ "parentId": "[variables('analyticRuleId14')]",
+ "contentId": "[variables('_analyticRulecontentId14')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion14')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ }
+ }
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId14')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Attempt to bypass conditional access rule in Azure AD",
+ "contentProductId": "[variables('_analyticRulecontentProductId14')]",
+ "id": "[variables('_analyticRulecontentProductId14')]",
+ "version": "[variables('analyticRuleVersion14')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName15')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "CredentialAddedAfterAdminConsent_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion15')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId15')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "This query will identify instances where Service Principal credentials were added to an application by one user after the application was granted admin consent rights by another user.\n If a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\n Additional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow.\n For further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities",
+ "displayName": "Credential added after admin consented to Application",
+ "enabled": false,
+ "query": "let auditLookbackStart = 2d;\nlet auditLookbackEnd = 1d;\nAuditLogs\n| where TimeGenerated >= ago(auditLookbackStart)\n| where OperationName =~ \"Consent to application\" \n| where Result =~ \"success\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend targetResourceName = tostring(TargetResource.displayName),\n targetResourceID = tostring(TargetResource.id),\n targetResourceType = tostring(TargetResource.type),\n targetModifiedProp = TargetResource.modifiedProperties\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"ConsentContext.IsAdminConsent\"\n | extend isAdminConsent = trim(@'\"',tostring(Property.newValue))\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"ConsentAction.Permissions\"\n | extend Consent_Permissions = trim(@'\"',tostring(Property.newValue))\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"TargetId.ServicePrincipalNames\"\n | extend Consent_ServicePrincipalNames = tostring(extract_all(@\"([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\",trim(@'\"',tostring(Property.newValue)))[0])\n )\n| extend Consent_InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend Consent_InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| join ( \nAuditLogs\n| where TimeGenerated >= ago(auditLookbackEnd)\n| where OperationName =~ \"Add service principal credentials\"\n| where Result =~ \"success\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend targetResourceName = tostring(TargetResource.displayName),\n targetResourceID = tostring(TargetResource.id),\n targetModifiedProp = TargetResource.modifiedProperties\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend Credential_KeyDescription = trim(@'\"',tostring(Property.newValue))\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"Included Updated Properties\"\n | extend UpdatedProperties = trim(@'\"',tostring(Property.newValue))\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"TargetId.ServicePrincipalNames\"\n | extend Credential_ServicePrincipalNames = tostring(extract_all(@\"([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\",trim(@'\"',tostring(Property.newValue)))[0])\n )\n| extend Credential_InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend Credential_InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n) on targetResourceName, targetResourceID\n| extend TimeConsent = TimeGenerated, TimeCred = TimeGenerated1\n| where TimeConsent < TimeCred \n| project TimeConsent, TimeCred, Consent_InitiatingUserOrApp, Credential_InitiatingUserOrApp, targetResourceName, targetResourceType, isAdminConsent, Consent_ServicePrincipalNames, Credential_ServicePrincipalNames, Consent_Permissions, Credential_KeyDescription, Consent_InitiatingIpAddress, Credential_InitiatingIpAddress\n| extend timestamp = TimeConsent, Name = tostring(split(Credential_InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(Credential_InitiatingUserOrApp,'@',1)[0])\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P2D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "CredentialAccess"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Consent_InitiatingIpAddress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ]
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId15'),'/'))))]",
+ "properties": {
+ "description": "Azure Active Directory Analytics Rule 15",
+ "parentId": "[variables('analyticRuleId15')]",
+ "contentId": "[variables('_analyticRulecontentId15')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion15')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ }
+ }
}
- }
+ ]
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId9')]",
- "contentKind": "Playbook",
- "displayName": "Revoke-AADSignInSessions-alert",
- "contentProductId": "[variables('_playbookcontentProductId9')]",
- "id": "[variables('_playbookcontentProductId9')]",
- "version": "[variables('playbookVersion9')]"
+ "contentId": "[variables('_analyticRulecontentId15')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Credential added after admin consented to Application",
+ "contentProductId": "[variables('_analyticRulecontentProductId15')]",
+ "id": "[variables('_analyticRulecontentProductId15')]",
+ "version": "[variables('analyticRuleVersion15')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName10')]",
+ "name": "[variables('analyticRuleTemplateSpecName16')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Revoke-AADSignIn-Session-entityTrigger Playbook with template version 3.0.3",
+ "description": "Cross-tenantAccessSettingsOrganizationAdded_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion10')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Revoke-AADSignIn-Session-entityTrigger",
- "type": "string"
- }
- },
- "variables": {
- "MicrosoftSentinelConnectionName": "[[concat('MicrosoftSentinel-', parameters('PlaybookName'))]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/Azuresentinel')]",
- "_connection-2": "[[variables('connection-2')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
+ "contentVersion": "[variables('analyticRuleVersion16')]",
+ "parameters": {},
+ "variables": {},
"resources": [
{
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId16')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
"properties": {
- "provisioningState": "Succeeded",
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_entity": {
- "type": "ApiConnectionWebhook",
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "path": "/entity/@{encodeURIComponent('Account')}"
- }
- }
- },
- "actions": {
- "Condition": {
- "actions": {
- "Add_comment_to_incident_(V3)_-_session_revoked": {
- "type": "ApiConnection",
- "inputs": {
- "body": {
- "incidentArmId": "@triggerBody()?['IncidentArmID']",
- "message": "Sign-in session revoked for the user - @{concat(triggerBody()?['Entity']?['properties']?['Name'], '@', triggerBody()?['Entity']?['properties']?['upnSuffix'])}
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- }
- }
- },
- "runAfter": {
- "HTTP_-_revoke_sign-in_session": [
- "Succeeded"
- ]
- },
- "expression": {
- "and": [
- {
- "not": {
- "equals": [
- "@triggerBody()?['IncidentArmID']",
- "@null"
- ]
- }
- }
- ]
+ "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when an Organization is added other than the list that is supposed to exist from the Azure AD Cross-tenant Access Settings.",
+ "displayName": "Cross-tenant Access Settings Organization Added",
+ "enabled": false,
+ "query": "// Tenants IDs can be found by navigating to Azure Active Directory then from menu on the left, select External Identities, then from menu on the left, select Cross-tenant access settings and from the list shown of Tenants\nlet ExpectedTenantIDs = dynamic([\"List of expected tenant IDs\",\"Tenant ID 2\"]);\nAuditLogs\n| where OperationName has \"Add a partner to cross-tenant access setting\"\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"tenantId\"\n | extend ExtTenantIDAdded = trim('\"',tostring(Property.newValue))\n )\n| where ExtTenantIDAdded !in (ExpectedTenantIDs)\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
+ "queryFrequency": "P2D",
+ "queryPeriod": "P2D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess",
+ "Persistence",
+ "Discovery"
+ ],
+ "techniques": [
+ "T1078",
+ "T1136",
+ "T1087"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
},
- "type": "If"
- },
- "HTTP_-_revoke_sign-in_session": {
- "type": "Http",
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com",
- "type": "ManagedServiceIdentity"
- },
- "method": "POST",
- "uri": "https://graph.microsoft.com/v1.0/users/@{concat(triggerBody()?['Entity']?['properties']?['Name'], '@', triggerBody()?['Entity']?['properties']?['upnSuffix'])}/revokeSignInSessions"
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- }
- }
- },
- "parameters": {
- "$connections": {
- "value": {
- "microsoftsentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
- "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/Azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatedByIPAdress",
+ "identifier": "Address"
}
- }
+ ],
+ "entityType": "IP"
}
- }
- },
- "name": "[[parameters('PlaybookName')]",
- "type": "Microsoft.Logic/workflows",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "hidden-SentinelTemplateName": "Revoke-AADSignIn-Session-entityTrigger",
- "hidden-SentinelTemplateVersion": "1.0",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "apiVersion": "2017-07-01",
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]"
- ]
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('MicrosoftSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
- "properties": {
- "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-2')]"
- }
+ ]
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId10'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId16'),'/'))))]",
"properties": {
- "parentId": "[variables('playbookId10')]",
- "contentId": "[variables('_playbookContentId10')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion10')]",
+ "description": "Azure Active Directory Analytics Rule 16",
+ "parentId": "[variables('analyticRuleId16')]",
+ "contentId": "[variables('_analyticRulecontentId16')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion16')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -4393,313 +2976,352 @@
}
}
}
- ],
- "metadata": {
- "title": "Revoke AAD Sign-in session using entity trigger",
- "description": "This playbook will revoke user's sign-in sessions and user will have to perform authentication again. It invalidates all the refresh tokens issued to applications for a user (as well as session cookies in a user's browser), by resetting the signInSessionsValidFromDateTime user property to the current date-time.",
- "postDeployment": [
- "1. Add Microsoft Sentinel Responder role to the managed identity.",
- "2. Assign User.ReadWrite.All and Directory.ReadWrite.All API permissions to the managed identity."
- ],
- "lastUpdateTime": "2022-12-22T00:00:00Z",
- "entities": [
- "Account"
- ],
- "releaseNotes": {
- "version": "1.0",
- "title": "[variables('blanks')]",
- "notes": [
- "Initial version"
- ]
- }
- }
+ ]
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId10')]",
- "contentKind": "Playbook",
- "displayName": "Revoke-AADSignIn-Session-entityTrigger",
- "contentProductId": "[variables('_playbookcontentProductId10')]",
- "id": "[variables('_playbookcontentProductId10')]",
- "version": "[variables('playbookVersion10')]"
+ "contentId": "[variables('_analyticRulecontentId16')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Cross-tenant Access Settings Organization Added",
+ "contentProductId": "[variables('_analyticRulecontentProductId16')]",
+ "id": "[variables('_analyticRulecontentProductId16')]",
+ "version": "[variables('analyticRuleVersion16')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('playbookTemplateSpecName11')]",
+ "name": "[variables('analyticRuleTemplateSpecName17')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Revoke-AADSignInSessions-incident Playbook with template version 3.0.3",
+ "description": "Cross-tenantAccessSettingsOrganizationDeleted_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('playbookVersion11')]",
- "parameters": {
- "PlaybookName": {
- "defaultValue": "Revoke-AADSignInSessions-incident",
- "type": "string"
- },
- "UserName": {
- "defaultValue": "@",
- "type": "string"
- }
- },
- "variables": {
- "AzureSentinelConnectionName": "[[concat('azuresentinel-', parameters('PlaybookName'))]",
- "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
- "Office365UsersConnectionName": "[[concat('office365users-', parameters('PlaybookName'))]",
- "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "_connection-1": "[[variables('connection-1')]",
- "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
- "_connection-2": "[[variables('connection-2')]",
- "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365users')]",
- "_connection-3": "[[variables('connection-3')]",
- "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
- "workspace-name": "[parameters('workspace')]",
- "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
- },
+ "contentVersion": "[variables('analyticRuleVersion17')]",
+ "parameters": {},
+ "variables": {},
"resources": [
{
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('AzureSentinelConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "kind": "V1",
- "properties": {
- "displayName": "[[parameters('PlaybookName')]",
- "parameterValueType": "Alternative",
- "api": {
- "id": "[[variables('_connection-1')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('Office365ConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[parameters('UserName')]",
- "api": {
- "id": "[[variables('_connection-2')]"
- }
- }
- },
- {
- "type": "Microsoft.Web/connections",
- "apiVersion": "2016-06-01",
- "name": "[[variables('Office365UsersConnectionName')]",
- "location": "[[variables('workspace-location-inline')]",
- "properties": {
- "displayName": "[[parameters('UserName')]",
- "api": {
- "id": "[[variables('_connection-3')]"
- }
- }
- },
- {
- "type": "Microsoft.Logic/workflows",
- "apiVersion": "2017-07-01",
- "name": "[[parameters('PlaybookName')]",
- "location": "[[variables('workspace-location-inline')]",
- "tags": {
- "LogicAppsCategory": "security",
- "hidden-SentinelTemplateName": "Revoke-AADSigninSessions",
- "hidden-SentinelTemplateVersion": "1.0",
- "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
- },
- "identity": {
- "type": "SystemAssigned"
- },
- "dependsOn": [
- "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "[[resourceId('Microsoft.Web/connections', variables('Office365UsersConnectionName'))]"
- ],
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId17')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
"properties": {
- "state": "Enabled",
- "definition": {
- "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
- "actions": {
- "Alert_-_Get_incident": {
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "get",
- "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
- },
- "type": "ApiConnection"
- },
- "Entities_-_Get_Accounts": {
- "inputs": {
- "body": "@triggerBody()?['Entities']",
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/entities/account"
- },
- "runAfter": {
- "Alert_-_Get_incident": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- },
- "For_each": {
- "actions": {
- "Add_comment_to_incident_(V3)": {
- "inputs": {
- "body": {
- "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
- "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} singin sessions were revoked in AAD and their manager @{body('Get_manager_(V2)')?['displayName']} was contacted using playbook.
"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "method": "post",
- "path": "/Incidents/Comment"
- },
- "runAfter": {
- "Send_an_email_(V2)": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- },
- "Get_manager_(V2)": {
- "inputs": {
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365users']['connectionId']"
- }
- },
- "method": "get",
- "path": "/codeless/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}/manager"
- },
- "runAfter": {
- "HTTP": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- },
- "HTTP": {
- "inputs": {
- "authentication": {
- "audience": "https://graph.microsoft.com",
- "type": "ManagedServiceIdentity"
- },
- "method": "POST",
- "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/revokeSignInSessions"
- },
- "type": "Http"
- },
- "Send_an_email_(V2)": {
- "inputs": {
- "body": {
- "Body": "User, @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}, was involved in part of a security incident. As part of remediation, the user signin sessions have been revoked. The user will need to reauthenticate in all applications.
",
- "Subject": "User signin sessions were reset due to security incident.",
- "To": "@body('Get_manager_(V2)')?['mail']"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['office365']['connectionId']"
- }
- },
- "method": "post",
- "path": "/v2/Mail"
- },
- "runAfter": {
- "Get_manager_(V2)": [
- "Succeeded"
- ]
- },
- "type": "ApiConnection"
- }
- },
- "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
- "runAfter": {
- "Entities_-_Get_Accounts": [
- "Succeeded"
- ]
- },
- "type": "Foreach"
- }
- },
- "contentVersion": "1.0.0.0",
- "parameters": {
- "$connections": {
- "type": "Object"
- }
- },
- "triggers": {
- "Microsoft_Sentinel_alert": {
- "inputs": {
- "body": {
- "callback_url": "@{listCallbackUrl()}"
- },
- "host": {
- "connection": {
- "name": "@parameters('$connections')['azuresentinel']['connectionId']"
- }
- },
- "path": "/subscribe"
+ "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when an Organization is deleted from the Azure AD Cross-tenant Access Settings.",
+ "displayName": "Cross-tenant Access Settings Organization Deleted",
+ "enabled": false,
+ "query": "AuditLogs\n| where OperationName has \"Delete partner specific cross-tenant access setting\"\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"tenantId\"\n | extend ExtTenantDeleted = trim('\"',tostring(Property.oldValue))\n )\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
+ "queryFrequency": "P2D",
+ "queryPeriod": "P2D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess",
+ "Persistence",
+ "Discovery"
+ ],
+ "techniques": [
+ "T1078",
+ "T1136",
+ "T1087"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
},
- "type": "ApiConnectionWebhook"
- }
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatedByIPAdress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
}
+ ]
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId17'),'/'))))]",
+ "properties": {
+ "description": "Azure Active Directory Analytics Rule 17",
+ "parentId": "[variables('analyticRuleId17')]",
+ "contentId": "[variables('_analyticRulecontentId17')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion17')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
},
- "parameters": {
- "$connections": {
- "value": {
- "azuresentinel": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
- "connectionName": "[[variables('AzureSentinelConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
- "connectionProperties": {
- "authentication": {
- "type": "ManagedServiceIdentity"
- }
- }
- },
- "office365": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
- "connectionName": "[[variables('Office365ConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
+ }
+ }
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId17')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Cross-tenant Access Settings Organization Deleted",
+ "contentProductId": "[variables('_analyticRulecontentProductId17')]",
+ "id": "[variables('_analyticRulecontentProductId17')]",
+ "version": "[variables('analyticRuleVersion17')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName18')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "Cross-tenantAccessSettingsOrganizationInboundCollaborationSettingsChanged_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion18')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId18')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when Organization Inbound Collaboration Settings are changed for \"Users & Groups\" and for \"Applications\".",
+ "displayName": "Cross-tenant Access Settings Organization Inbound Collaboration Settings Changed",
+ "enabled": false,
+ "query": "//In User & Groups and in Applications, the following \"AccessType\" values in columns PremodifiedInboundSettings and ModifiedInboundSettings are interpreted accordingly:\n// When Access Type in premodified inbound settings value was 1 that means that the initial access was allowed. When Access Type in premodified inbound settings value was 2 that means that the initial access was blocked. \n// When Access Type in modified inbound settings value is 1 that means that now access is allowed. When Access Type in modified inbound settings value is 2 that means that now access is blocked. \nAuditLogs\n| where OperationName has \"Update a partner cross-tenant access setting\"\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"b2bCollaborationInbound\"\n | extend PremodifiedInboundSettings = trim('\"',tostring(Property.oldValue)),\n ModifiedInboundSettings = trim(@'\"',tostring(Property.newValue))\n )\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| where PremodifiedInboundSettings != ModifiedInboundSettings\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
+ "queryFrequency": "P2D",
+ "queryPeriod": "P2D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess",
+ "Persistence",
+ "Discovery"
+ ],
+ "techniques": [
+ "T1078",
+ "T1136",
+ "T1087"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
},
- "office365users": {
- "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365UsersConnectionName'))]",
- "connectionName": "[[variables('Office365UsersConnectionName')]",
- "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365users')]"
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatedByIPAdress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
}
+ ]
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
+ "apiVersion": "2022-01-01-preview",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId18'),'/'))))]",
+ "properties": {
+ "description": "Azure Active Directory Analytics Rule 18",
+ "parentId": "[variables('analyticRuleId18')]",
+ "contentId": "[variables('_analyticRulecontentId18')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion18')]",
+ "source": {
+ "kind": "Solution",
+ "name": "Azure Active Directory",
+ "sourceId": "[variables('_solutionId')]"
+ },
+ "author": {
+ "name": "Microsoft",
+ "email": "[variables('_email')]"
+ },
+ "support": {
+ "tier": "Microsoft",
+ "name": "Microsoft Corporation",
+ "email": "support@microsoft.com",
+ "link": "https://support.microsoft.com/"
}
}
+ }
+ ]
+ },
+ "packageKind": "Solution",
+ "packageVersion": "[variables('_solutionVersion')]",
+ "packageName": "[variables('_solutionName')]",
+ "packageId": "[variables('_solutionId')]",
+ "contentSchemaVersion": "3.0.0",
+ "contentId": "[variables('_analyticRulecontentId18')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Cross-tenant Access Settings Organization Inbound Collaboration Settings Changed",
+ "contentProductId": "[variables('_analyticRulecontentProductId18')]",
+ "id": "[variables('_analyticRulecontentProductId18')]",
+ "version": "[variables('analyticRuleVersion18')]"
+ }
+ },
+ {
+ "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
+ "apiVersion": "2023-04-01-preview",
+ "name": "[variables('analyticRuleTemplateSpecName19')]",
+ "location": "[parameters('workspace-location')]",
+ "dependsOn": [
+ "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
+ ],
+ "properties": {
+ "description": "Cross-tenantAccessSettingsOrganizationInboundDirectSettingsChanged_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "mainTemplate": {
+ "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
+ "contentVersion": "[variables('analyticRuleVersion19')]",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId19')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
+ "location": "[parameters('workspace-location')]",
+ "properties": {
+ "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when Organization Inbound Direct Settings are changed for \"Users & Groups\" and for \"Applications\".",
+ "displayName": "Cross-tenant Access Settings Organization Inbound Direct Settings Changed",
+ "enabled": false,
+ "query": "//In User & Groups and in Applications, the following \"AccessType\" values in columns PremodifiedInboundSettings and ModifiedInboundSettings are interpreted accordingly:\n// When Access Type in premodified inbound settings value was 1 that means that the initial access was allowed. When Access Type in premodified inbound settings value was 2 that means that the initial access was blocked. \n// When Access Type in modified inbound settings value is 1 that means that now access is allowed. When Access Type in modified inbound settings value is 2 that means that now access is blocked. \nAuditLogs\n| where OperationName has \"Update a partner cross-tenant access setting\"\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"b2bDirectConnectInbound\"\n | extend PremodifiedInboundSettings = trim('\"',tostring(Property.oldValue)),\n ModifiedInboundSettings = trim(@'\"',tostring(Property.newValue))\n )\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| where PremodifiedInboundSettings != ModifiedInboundSettings\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
+ "queryFrequency": "P2D",
+ "queryPeriod": "P2D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess",
+ "Persistence",
+ "Discovery"
+ ],
+ "techniques": [
+ "T1078",
+ "T1136",
+ "T1087"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatedByIPAdress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ]
+ }
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId11'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId19'),'/'))))]",
"properties": {
- "parentId": "[variables('playbookId11')]",
- "contentId": "[variables('_playbookContentId11')]",
- "kind": "Playbook",
- "version": "[variables('playbookVersion11')]",
+ "description": "Azure Active Directory Analytics Rule 19",
+ "parentId": "[variables('analyticRuleId19')]",
+ "contentId": "[variables('_analyticRulecontentId19')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion19')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -4717,83 +3339,110 @@
}
}
}
- ],
- "metadata": {
- "title": "Revoke AAD SignIn Sessions - incident trigger",
- "description": "This playbook will revoke all signin sessions for the user using Graph API. It will send an email to the user's manager.",
- "prerequisites": "1. You will need to grant User.ReadWrite.All permissions to the managed identity.",
- "lastUpdateTime": "2021-07-14T00:00:00Z",
- "entities": [
- "Account"
- ],
- "tags": [
- "Remediation"
- ],
- "releaseNotes": {
- "version": "1.0",
- "title": "[variables('blanks')]",
- "notes": [
- "Initial version"
- ]
- }
- }
+ ]
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_playbookContentId11')]",
- "contentKind": "Playbook",
- "displayName": "Revoke-AADSignInSessions-incident",
- "contentProductId": "[variables('_playbookcontentProductId11')]",
- "id": "[variables('_playbookcontentProductId11')]",
- "version": "[variables('playbookVersion11')]"
+ "contentId": "[variables('_analyticRulecontentId19')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Cross-tenant Access Settings Organization Inbound Direct Settings Changed",
+ "contentProductId": "[variables('_analyticRulecontentProductId19')]",
+ "id": "[variables('_analyticRulecontentProductId19')]",
+ "version": "[variables('analyticRuleVersion19')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('workbookTemplateSpecName1')]",
+ "name": "[variables('analyticRuleTemplateSpecName20')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AzureActiveDirectoryAuditLogsWorkbook Workbook with template version 3.0.3",
+ "description": "Cross-tenantAccessSettingsOrganizationOutboundCollaborationSettingsChanged_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('workbookVersion1')]",
+ "contentVersion": "[variables('analyticRuleVersion20')]",
"parameters": {},
"variables": {},
"resources": [
{
- "type": "Microsoft.Insights/workbooks",
- "name": "[variables('workbookContentId1')]",
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId20')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
"location": "[parameters('workspace-location')]",
- "kind": "shared",
- "apiVersion": "2021-08-01",
- "metadata": {
- "description": "Gain insights into Azure Active Directory by connecting Microsoft Sentinel and using the audit logs to gather insights around Azure AD scenarios. \nYou can learn about user operations, including password and group management, device activities, and top active users and apps."
- },
"properties": {
- "displayName": "[parameters('workbook1-name')]",
- "serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"## Azure AD audit logs\"},\"name\":\"text - 1\"},{\"type\":9,\"content\":{\"version\":\"KqlParameterItem/1.0\",\"parameters\":[{\"id\":\"bc372bf5-2dcd-4efa-aa85-94b6e6fafe14\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"TimeRange\",\"type\":4,\"isRequired\":true,\"value\":{\"durationMs\":7776000000},\"typeSettings\":{\"selectableValues\":[{\"durationMs\":300000},{\"durationMs\":900000},{\"durationMs\":1800000},{\"durationMs\":3600000},{\"durationMs\":14400000},{\"durationMs\":43200000},{\"durationMs\":86400000},{\"durationMs\":172800000},{\"durationMs\":259200000},{\"durationMs\":604800000},{\"durationMs\":1209600000},{\"durationMs\":2419200000},{\"durationMs\":2592000000},{\"durationMs\":5184000000},{\"durationMs\":7776000000}],\"allowCustom\":true}},{\"id\":\"e032b9f7-5449-4180-9c20-75760afa96f6\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"User\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"AuditLogs\\r\\n| where SourceSystem == \\\"Azure AD\\\"\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n//| where initiator!= \\\"\\\"\\r\\n| summarize Count = count() by initiator\\r\\n| order by Count desc, initiator asc\\r\\n| project Value = initiator, Label = strcat(initiator, ' - ', Count), Selected = false\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"All\"},\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"0a59a0b3-6d93-4fee-bdbe-147383c510c6\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Category\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"AuditLogs\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiator in ({User})\\r\\n| summarize Count = count() by Category\\r\\n| order by Count desc, Category asc\\r\\n| project Value = Category, Label = strcat(Category, ' - ', Count)\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"All\"},\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"4d2b245b-5e59-4eb6-9f51-ba926581ab47\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Result\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"AuditLogs\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiator in ({User})\\r\\n| summarize Count = count() by Result\\r\\n| order by Count desc, Result asc\\r\\n| project Value = Result, Label = strcat(Result, ' - ', Count, ' sign-ins')\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"All\"},\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"}],\"style\":\"pills\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},\"name\":\"parameters - 1\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let data = AuditLogs\\r\\n| where \\\"{Category:lable}\\\" == \\\"All\\\" or Category in ({Category})\\r\\n| where \\\"{Result:lable}\\\" == \\\"All\\\" or Result in ({Result})\\r\\n| extend initiatingUserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)\\r\\n| where initiatingUserPrincipalName != \\\"\\\" \\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiatingUserPrincipalName in ({User});\\r\\ndata\\r\\n| summarize Count = count() by Category\\r\\n| join kind = fullouter (datatable(Category:string)['Medium', 'high', 'low']) on Category\\r\\n| project Category = iff(Category == '', Category1, Category), Count = iff(Category == '', 0, Count)\\r\\n| join kind = inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by Category)\\r\\n on Category\\r\\n| project-away Category1, TimeGenerated\\r\\n| extend Category = Category\\r\\n| union (\\r\\n data \\r\\n | summarize Count = count() \\r\\n | extend jkey = 1\\r\\n | join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain}\\r\\n | extend jkey = 1) on jkey\\r\\n | extend Category = 'All', Categorys = '*' \\r\\n)\\r\\n| order by Count desc\\r\\n| take 10\",\"size\":4,\"title\":\"Categories volume\",\"timeContext\":{\"durationMs\":7776000000},\"timeContextFromParameter\":\"TimeRange\",\"exportFieldName\":\"Category\",\"exportParameterName\":\"CategoryFIlter\",\"exportDefaultValue\":\"All\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"tiles\",\"tileSettings\":{\"titleContent\":{\"columnMatch\":\"Category\",\"formatter\":1,\"formatOptions\":{\"showIcon\":true}},\"leftContent\":{\"columnMatch\":\"Count\",\"formatter\":12,\"formatOptions\":{\"palette\":\"auto\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\",\"maximumFractionDigits\":2,\"maximumSignificantDigits\":3}}},\"secondaryContent\":{\"columnMatch\":\"Trend\",\"formatter\":21,\"formatOptions\":{\"palette\":\"purple\",\"showIcon\":true}},\"showBorder\":false}},\"name\":\"query - 4\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let data = AuditLogs\\r\\n| where \\\"{Result:lable}\\\" == \\\"All\\\" or Result in ({Result})\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiator in ({User})\\r\\n| where \\\"{Category:lable}\\\" == \\\"All\\\" or Category in ({Category})\\r\\n| where Category == '{CategoryFIlter}' or '{CategoryFIlter}' == \\\"All\\\";\\r\\nlet appData = data\\r\\n| summarize TotalCount = count() by OperationName, Category\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by OperationName\\r\\n | project-away TimeGenerated) on OperationName\\r\\n| order by TotalCount desc, OperationName asc\\r\\n| project OperationName, TotalCount, Trend, Category\\r\\n| serialize Id = row_number();\\r\\ndata\\r\\n| summarize TotalCount = count() by initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\"), Category, OperationName\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by OperationName, initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n | project-away TimeGenerated) on OperationName, initiator\\r\\n| order by TotalCount desc, OperationName asc\\r\\n| project OperationName, initiator, TotalCount, Category, Trend\\r\\n| serialize Id = row_number(1000000)\\r\\n| join kind=inner (appData) on OperationName\\r\\n| project Id, Name = initiator, Type = 'initiator', ['Operations Count'] = TotalCount, Trend, Category, ParentId = Id1\\r\\n| union (appData \\r\\n | project Id, Name = OperationName, Type = 'Operation', ['Operations Count'] = TotalCount, Category, Trend)\\r\\n| order by ['Operations Count'] desc, Name asc\",\"size\":0,\"showAnalytics\":true,\"title\":\"User activities\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"exportParameterName\":\"UserInfo\",\"exportDefaultValue\":\"{ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"}\",\"showExportToExcel\":true,\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Operations Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"turquoise\",\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"ParentId\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"rowLimit\":1000,\"filter\":true,\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"ParentId\",\"treeType\":0,\"expanderColumn\":\"Name\"}}},\"customWidth\":\"70\",\"showPin\":true,\"name\":\"query - 2\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let details = dynamic({UserInfo});\\r\\nAuditLogs\\r\\n| where \\\"{Category:lable}\\\" == \\\"All\\\" or Category in ({Category})\\r\\n| where \\\"{Result:lable}\\\" == \\\"All\\\" or Result in ({Result})\\r\\n| extend initiatingUserPrincipalName = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n//| where initiatingUserPrincipalName != \\\"\\\" \\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiatingUserPrincipalName in ({User})\\r\\n| where details.Type == '*' or (details.Type == 'initiator' and initiatingUserPrincipalName == details.Name) or (details.Type == 'Operation' and OperationName == details.Name)\\r\\n| summarize Activities = count() by initiatingUserPrincipalName\\r\\n| sort by Activities desc nulls last \",\"size\":0,\"title\":\"Top active users\",\"timeContext\":{\"durationMs\":7776000000},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"piechart\"},\"customWidth\":\"30\",\"name\":\"query - 3\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let details = dynamic({UserInfo});\\r\\nlet data = AuditLogs\\r\\n| extend initiator = iif (tostring(InitiatedBy.user.userPrincipalName) != \\\"\\\", tostring(InitiatedBy.user.userPrincipalName), \\\"unknown\\\")\\r\\n| where details.Type == '*' or (details.Type == 'initiator' and initiator == details.Name) or (details.Type == 'Operation' and OperationName == details.Name)\\r\\n| where \\\"{Category:lable}\\\" == \\\"All\\\" or Category in ({Category})\\r\\n| where \\\"{Result:lable}\\\" == \\\"All\\\" or Result in ({Result})\\r\\n| where \\\"{User:lable}\\\" == \\\"All\\\" or initiator in ({User});\\r\\nlet appData = data\\r\\n| summarize TotalCount = count() by Result\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Result\\r\\n | project-away TimeGenerated) on Result\\r\\n| order by TotalCount desc, Result asc\\r\\n| project Result, TotalCount, Trend\\r\\n| serialize Id = row_number();\\r\\ndata\\r\\n| summarize TotalCount = count() by OperationName, Result\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Result, OperationName\\r\\n | project-away TimeGenerated) on Result, OperationName\\r\\n| order by TotalCount desc, Result asc\\r\\n| project Result, OperationName, TotalCount, Trend\\r\\n| serialize Id = row_number(1000000)\\r\\n| join kind=inner (appData) on Result\\r\\n| project Id, Name = OperationName, Type = 'Operation', ['Results Count'] = TotalCount, Trend, ParentId = Id1\\r\\n| union (appData \\r\\n | project Id, Name = Result, Type = 'Result', ['Results Count'] = TotalCount, Trend)\\r\\n| order by ['Results Count'] desc, Name asc\",\"size\":0,\"title\":\"Result status\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"exportParameterName\":\"ResultInfo\",\"exportDefaultValue\":\"{ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"}\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5},{\"columnMatch\":\"Type\",\"formatter\":5},{\"columnMatch\":\"Results Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"grayBlue\"}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"palette\":\"greenDark\"}},{\"columnMatch\":\"ParentId\",\"formatter\":5}],\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"ParentId\",\"treeType\":0,\"expanderColumn\":\"Name\"}}},\"customWidth\":\"70\",\"name\":\"query - 5\"}],\"fallbackResourceIds\":[\"\"],\"fromTemplateId\":\"sentinel-AzureActiveDirectoryAuditLogs\",\"$schema\":\"https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json\"}\n",
- "version": "1.0",
- "sourceId": "[variables('workspaceResourceId')]",
- "category": "sentinel"
+ "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when Organization Outbound Collaboration Settings are changed for \"Users & Groups\" and for \"Applications\".",
+ "displayName": "Cross-tenant Access Settings Organization Outbound Collaboration Settings Changed",
+ "enabled": false,
+ "query": "//In User & Groups and in Applications, the following \"AccessType\" values in columns PremodifiedOutboundSettings and ModifiedOutboundSettings are interpreted accordingly:\n// When Access Type in premodified outbound settings value was 1 that means that the initial access was allowed. When Access Type in premodified outbound settings value was 2 that means that the initial access was blocked. \n// When Access Type in modified outbound settings value is 1 that means that now access is allowed. When Access Type in modified outbound settings value is 2 that means that now access is blocked. \nAuditLogs\n| where OperationName has \"Update a partner cross-tenant access setting\"\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"b2bCollaborationOutbound\"\n | extend PremodifiedOutboundSettings = trim('\"',tostring(Property.oldValue)),\n ModifiedOutboundSettings = trim(@'\"',tostring(Property.newValue))\n )\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| where PremodifiedOutboundSettings != ModifiedOutboundSettings\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
+ "queryFrequency": "P2D",
+ "queryPeriod": "P2D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess",
+ "Persistence",
+ "Discovery"
+ ],
+ "techniques": [
+ "T1078",
+ "T1136",
+ "T1087"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatedByIPAdress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ]
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Workbook-', last(split(variables('workbookId1'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId20'),'/'))))]",
"properties": {
- "description": "@{workbookKey=AzureActiveDirectoryAuditLogsWorkbook; logoFileName=azureactivedirectory_logo.svg; description=Gain insights into Azure Active Directory by connecting Microsoft Sentinel and using the audit logs to gather insights around Azure AD scenarios. \nYou can learn about user operations, including password and group management, device activities, and top active users and apps.; dataTypesDependencies=System.Object[]; dataConnectorsDependencies=System.Object[]; previewImagesFileNames=System.Object[]; version=1.2.0; title=Azure AD Audit logs; templateRelativePath=AzureActiveDirectoryAuditLogs.json; subtitle=; provider=Microsoft}.description",
- "parentId": "[variables('workbookId1')]",
- "contentId": "[variables('_workbookContentId1')]",
- "kind": "Workbook",
- "version": "[variables('workbookVersion1')]",
+ "description": "Azure Active Directory Analytics Rule 20",
+ "parentId": "[variables('analyticRuleId20')]",
+ "contentId": "[variables('_analyticRulecontentId20')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion20')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -4808,19 +3457,6 @@
"name": "Microsoft Corporation",
"email": "support@microsoft.com",
"link": "https://support.microsoft.com/"
- },
- "dependencies": {
- "operator": "AND",
- "criteria": [
- {
- "contentId": "AuditLogs",
- "kind": "DataType"
- },
- {
- "contentId": "AzureActiveDirectory",
- "kind": "DataConnector"
- }
- ]
}
}
}
@@ -4831,57 +3467,103 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_workbookContentId1')]",
- "contentKind": "Workbook",
- "displayName": "[parameters('workbook1-name')]",
- "contentProductId": "[variables('_workbookcontentProductId1')]",
- "id": "[variables('_workbookcontentProductId1')]",
- "version": "[variables('workbookVersion1')]"
+ "contentId": "[variables('_analyticRulecontentId20')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Cross-tenant Access Settings Organization Outbound Collaboration Settings Changed",
+ "contentProductId": "[variables('_analyticRulecontentProductId20')]",
+ "id": "[variables('_analyticRulecontentProductId20')]",
+ "version": "[variables('analyticRuleVersion20')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('workbookTemplateSpecName2')]",
+ "name": "[variables('analyticRuleTemplateSpecName21')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AzureActiveDirectorySigninsWorkbook Workbook with template version 3.0.3",
+ "description": "Cross-tenantAccessSettingsOrganizationOutboundDirectSettingsChanged_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('workbookVersion2')]",
+ "contentVersion": "[variables('analyticRuleVersion21')]",
"parameters": {},
"variables": {},
"resources": [
{
- "type": "Microsoft.Insights/workbooks",
- "name": "[variables('workbookContentId2')]",
+ "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
+ "name": "[variables('analyticRulecontentId21')]",
+ "apiVersion": "2022-04-01-preview",
+ "kind": "Scheduled",
"location": "[parameters('workspace-location')]",
- "kind": "shared",
- "apiVersion": "2021-08-01",
- "metadata": {
- "description": "Gain insights into Azure Active Directory by connecting Microsoft Sentinel and using the sign-in logs to gather insights around Azure AD scenarios. \nYou can learn about sign-in operations, such as user sign-ins and locations, email addresses, and IP addresses of your users, as well as failed activities and the errors that triggered the failures."
- },
"properties": {
- "displayName": "[parameters('workbook2-name')]",
- "serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"## Sign-in Analysis\"},\"name\":\"text - 0\"},{\"type\":9,\"content\":{\"version\":\"KqlParameterItem/1.0\",\"parameters\":[{\"id\":\"13f56671-7604-4427-a4d8-663f3da0cbc5\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"TimeRange\",\"type\":4,\"isRequired\":true,\"value\":{\"durationMs\":1209600000},\"typeSettings\":{\"selectableValues\":[{\"durationMs\":300000,\"createdTime\":\"2018-11-13T19:33:10.162Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":900000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":1800000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":3600000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":14400000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":43200000,\"createdTime\":\"2018-11-13T19:33:10.164Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":86400000,\"createdTime\":\"2018-11-13T19:33:10.165Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":172800000,\"createdTime\":\"2018-11-13T19:33:10.166Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":259200000,\"createdTime\":\"2018-11-13T19:33:10.166Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":604800000,\"createdTime\":\"2018-11-13T19:33:10.166Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":1209600000,\"createdTime\":\"2018-11-13T19:33:10.166Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false},{\"durationMs\":2592000000,\"createdTime\":\"2018-11-13T19:33:10.167Z\",\"isInitialTime\":false,\"grain\":1,\"useDashboardTimeRange\":false}],\"allowCustom\":true}},{\"id\":\"3b5cc420-8ad8-4523-ba28-a54910756794\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Apps\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"SigninLogs\\r\\n| summarize Count = count() by AppDisplayName\\r\\n| order by Count desc, AppDisplayName asc\\r\\n| project Value = AppDisplayName, Label = strcat(AppDisplayName, ' - ', Count, ' sign-ins'), Selected = false\\r\\n\",\"value\":[\"value::all\"],\"typeSettings\":{\"limitSelectTo\":10,\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"*\"},\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"0611ecce-d6a0-4a6f-a1bc-6be314ae36a7\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"UserNamePrefix\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"SigninLogs\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n| summarize Count = count() by UserDisplayName\\r\\n| order by Count desc, UserDisplayName asc\\r\\n| project Value = UserDisplayName, Label = strcat(UserDisplayName, ' - ', Count, ' sign-ins'), Selected = false\\r\\n| extend prefix = substring(Value, 0, 1)\\r\\n| distinct prefix\\r\\n| sort by prefix asc\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"*\",\"showDefault\":false},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"f7f7970b-58c1-474f-9043-62243d2d4edd\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Users\",\"label\":\"UserName\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"query\":\"SigninLogs\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n| summarize Count = count() by UserDisplayName\\r\\n| order by Count desc, UserDisplayName asc\\r\\n| project Value = UserDisplayName, Label = strcat(UserDisplayName, ' - ', Count, ' sign-ins'), Selected = false\\r\\n| where (substring(Value, 0, 1) in ({UserNamePrefix})) or ('*' in ({UserNamePrefix}))\\r\\n| sort by Value asc\\r\\n\",\"value\":[\"value::all\"],\"typeSettings\":{\"limitSelectTo\":10000000,\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"\",\"showDefault\":false},\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},{\"id\":\"85568f4e-9ad4-46c5-91d4-0ee1b2c8f3aa\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"Category\",\"type\":2,\"isRequired\":true,\"multiSelect\":true,\"quote\":\"'\",\"delimiter\":\",\",\"value\":[\"value::all\"],\"typeSettings\":{\"additionalResourceOptions\":[\"value::all\"],\"selectAllValue\":\"\"},\"jsonData\":\"[\\\"SignInLogs\\\", \\\"NonInteractiveUserSignInLogs\\\"]\"}],\"style\":\"pills\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\"},\"name\":\"parameters - 1\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let data = \\r\\nunion SigninLogs,AADNonInteractiveUserSignInLogs\\r\\n| where Category in ({Category})\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users});\\r\\ndata\\r\\n| summarize count() by UserPrincipalName, bin (TimeGenerated,5m)\\r\\n\",\"size\":0,\"title\":\"Sign-in Trend over Time\",\"timeContext\":{\"durationMs\":86400000},\"timeContextFromParameter\":\"TimeRange\",\"timeBrushParameterName\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"timechart\"},\"name\":\"query - 19\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n| where Category in ({Category})\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend errorCode = Status.errorCode\\r\\n|extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\",errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\",errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012 ,\\\"Pending user action\\\", \\\"Failure\\\");\\r\\ndata\\r\\n| summarize Count = count() by SigninStatus\\r\\n| join kind = fullouter (datatable(SigninStatus:string)['Success', 'Pending action (Interrupts)', 'Failure']) on SigninStatus\\r\\n| project SigninStatus = iff(SigninStatus == '', SigninStatus1, SigninStatus), Count = iff(SigninStatus == '', 0, Count)\\r\\n| join kind = inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by SigninStatus)\\r\\n on SigninStatus\\r\\n| project-away SigninStatus1, TimeGenerated\\r\\n| extend Status = SigninStatus\\r\\n| union (\\r\\n data \\r\\n | summarize Count = count()\\r\\n | extend jkey = 1\\r\\n | join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain}\\r\\n | extend jkey = 1) on jkey\\r\\n | extend SigninStatus = 'All Sign-ins', Status = '*' \\r\\n)\\r\\n| order by Count desc\\r\\n\\r\\n\\r\\n\\r\\n\",\"size\":3,\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"exportFieldName\":\"Status\",\"exportParameterName\":\"SigninStatus\",\"exportDefaultValue\":\"*\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"tiles\",\"tileSettings\":{\"titleContent\":{\"columnMatch\":\"SigninStatus\",\"formatter\":1,\"formatOptions\":{\"showIcon\":true}},\"leftContent\":{\"columnMatch\":\"Count\",\"formatter\":12,\"formatOptions\":{\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\",\"maximumFractionDigits\":2,\"maximumSignificantDigits\":3}}},\"secondaryContent\":{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true}},\"showBorder\":false}},\"name\":\"query - 5\"},{\"type\":1,\"content\":{\"json\":\"
\\r\\n💡 _Click on a tile or a row in the grid to drill-in further_\"},\"name\":\"text - 6 - Copy\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n| extend AppDisplayName = iff(AppDisplayName == '', 'Unknown', AppDisplayName)\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend Country = iff(LocationDetails.countryOrRegion == '', 'Unknown country', tostring(LocationDetails.countryOrRegion))\\r\\n| extend City = iff(LocationDetails.city == '', 'Unknown city', tostring(LocationDetails.city))\\r\\n| extend errorCode = Status.errorCode\\r\\n| extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\",errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\",errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012 ,\\\"Pending user action\\\", \\\"Failure\\\")\\r\\n| where SigninStatus == '{SigninStatus}' or '{SigninStatus}' == '*' or '{SigninStatus}' == 'All Sign-ins';\\r\\nlet countryData = data\\r\\n| summarize TotalCount = count(), SuccessCount = countif(SigninStatus == \\\"Success\\\"), FailureCount = countif(SigninStatus == \\\"Failure\\\"), InterruptCount = countif(SigninStatus == \\\"Pending user action\\\") by Country,Category\\r\\n| join kind=inner\\r\\n(\\r\\n data\\r\\n| make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Country\\r\\n| project-away TimeGenerated\\r\\n)\\r\\non Country\\r\\n| project Country, TotalCount, SuccessCount,FailureCount,InterruptCount,Trend,Category\\r\\n| order by TotalCount desc, Country asc;\\r\\ndata\\r\\n| summarize TotalCount = count(), SuccessCount = countif(SigninStatus == \\\"Success\\\"), FailureCount = countif(SigninStatus == \\\"Failure\\\"), InterruptCount = countif(SigninStatus == \\\"Pending user action\\\") by Country, City,Category\\r\\n| join kind=inner\\r\\n(\\r\\n data \\r\\n| make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Country, City\\r\\n| project-away TimeGenerated\\r\\n)\\r\\non Country, City\\r\\n| order by TotalCount desc, Country asc\\r\\n| project Country, City,TotalCount, SuccessCount,FailureCount,InterruptCount, Trend,Category\\r\\n| join kind=inner\\r\\n(\\r\\n countryData\\r\\n)\\r\\non Country\\r\\n| project Id = City, Name = City, Type = 'City', ['Sign-in Count'] = TotalCount, Trend, ['Failure Count'] = FailureCount, ['Interrupt Count'] = InterruptCount, ['Success Rate'] = 1.0 * SuccessCount / TotalCount, ParentId = Country,Category\\r\\n| union (countryData\\r\\n| project Id = Country, Name = Country, Type = 'Country', ['Sign-in Count'] = TotalCount, Trend, ['Failure Count'] = FailureCount, ['Interrupt Count'] = InterruptCount, ['Success Rate'] = 1.0 * SuccessCount / TotalCount, ParentId = 'root',Category)\\r\\n| where Category in ({Category})\\r\\n| order by ['Sign-in Count'] desc, Name asc\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Sign-ins by Location\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeBrush\",\"showRefreshButton\":true,\"exportMultipleValues\":true,\"exportedParameters\":[{\"fieldName\":\"Name\",\"parameterName\":\"LocationDetail\",\"parameterType\":1}],\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Sign-in Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true}},{\"columnMatch\":\"Failure Count|Interrupt Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"orange\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Success Rate\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"percent\"}}},{\"columnMatch\":\"ParentId\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true,\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"ParentId\",\"treeType\":0,\"expanderColumn\":\"Name\",\"expandTopLevel\":false}}},\"customWidth\":\"67\",\"showPin\":true,\"name\":\"query - 8\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let selectedCountry = dynamic([{LocationDetail}]);\\r\\nlet nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails),Status = parse_json(Status),ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies),DeviceDetail =parse_json(DeviceDetail);\\r\\nlet details = dynamic({ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"});\\r\\nlet data = union SigninLogs,nonInteractive\\r\\n| extend AppDisplayName = iff(AppDisplayName == '', 'Unknown', AppDisplayName)\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend Country = tostring(LocationDetails.countryOrRegion)\\r\\n| extend City = tostring(LocationDetails.city) \\r\\n| where array_length(selectedCountry) == 0 or \\\"*\\\" in (selectedCountry) or Country in (selectedCountry) or City in (selectedCountry) \\r\\n| extend errorCode = Status.errorCode\\r\\n| extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\",errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\",errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012 ,\\\"Pending user action\\\", \\\"Failure\\\")\\r\\n| where SigninStatus == '{SigninStatus}' or '{SigninStatus}' == '*' or '{SigninStatus}' == 'All Sign-ins'\\r\\n| where details.Type == '*' or (details.Type == 'Country' and Country == details.Name) or (details.Type == 'City' and City == details.Name);\\r\\ndata\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project User = UserDisplayName, ['Sign-in Status'] = strcat(iff(SigninStatus == 'Success', '✔️', '❌'), ' ', SigninStatus), ['Sign-in Time'] = TimeAgo, App = AppDisplayName, ['Error code'] = errorCode, ['Result type'] = ResultType, ['Result signature'] = ResultSignature, ['Result description'] = ResultDescription, ['Conditional access policies'] = ConditionalAccessPolicies, ['Conditional access status'] = ConditionalAccessStatus, ['Operating system'] = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser, ['Country or region'] = LocationDetails.countryOrRegion, ['State'] = LocationDetails.state, ['City'] = LocationDetails.city, ['Time generated'] = TimeGenerated, Status, ['User principal name'] = UserPrincipalName, Category\\r\\n| where Category in ({Category})\\r\\n\\r\\n\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Location Sign-in details\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Sign-in Status\",\"formatter\":7,\"formatOptions\":{\"linkTarget\":\"CellDetails\",\"showIcon\":true}},{\"columnMatch\":\"App\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Error code\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result signature\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result description\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access policies\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Operating system\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Browser\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Time generated\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"User principal name\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"TimeGenerated\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true}},\"customWidth\":\"33\",\"name\":\"query - 8\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs | extend LocationDetails = parse_json(LocationDetails), Status = parse_json(Status), DeviceDetail = parse_json(DeviceDetail);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n | extend errorCode = Status.errorCode\\r\\n | extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\", errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\", errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012, \\\"Pending user action\\\", \\\"Failure\\\")\\r\\n| where SigninStatus == '{SigninStatus}' or '{SigninStatus}' == '*' or '{SigninStatus}' == 'All Sign-ins';\\r\\nlet appData = data\\r\\n | summarize TotalCount = count(), SuccessCount = countif(SigninStatus == \\\"Success\\\"), FailureCount = countif(SigninStatus == \\\"Failure\\\"), InterruptCount = countif(SigninStatus == \\\"Pending user action\\\") by Os = tostring(DeviceDetail.operatingSystem) ,Category\\r\\n | where Os != ''\\r\\n | join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by Os = tostring(DeviceDetail.operatingSystem)\\r\\n | project-away TimeGenerated)\\r\\n on Os\\r\\n | order by TotalCount desc, Os asc\\r\\n | project Os, TotalCount, SuccessCount, FailureCount, InterruptCount, Trend,Category\\r\\n | serialize Id = row_number();\\r\\ndata\\r\\n| summarize TotalCount = count(), SuccessCount = countif(SigninStatus == \\\"Success\\\"), FailureCount = countif(SigninStatus == \\\"Failure\\\"), InterruptCount = countif(SigninStatus == \\\"Pending user action\\\") by Os = tostring(DeviceDetail.operatingSystem), Browser = tostring(DeviceDetail.browser),Category\\r\\n| join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain})by Os = tostring(DeviceDetail.operatingSystem), Browser = tostring(DeviceDetail.browser)\\r\\n | project-away TimeGenerated)\\r\\n on Os, Browser\\r\\n| order by TotalCount desc, Os asc\\r\\n| project Os, Browser, TotalCount, SuccessCount, FailureCount, InterruptCount, Trend,Category\\r\\n| serialize Id = row_number(1000000)\\r\\n| join kind=inner (appData) on Os\\r\\n| project Id, Name = Browser, Type = 'Browser', ['Sign-in Count'] = TotalCount, Trend, ['Failure Count'] = FailureCount, ['Interrupt Count'] = InterruptCount, ['Success Rate'] = 1.0 * SuccessCount / TotalCount, ParentId = Id1,Category\\r\\n| union (appData \\r\\n | project Id, Name = Os, Type = 'Operating System', ['Sign-in Count'] = TotalCount, Trend, ['Failure Count'] = FailureCount, ['Interrupt Count'] = InterruptCount, ['Success Rate'] = 1.0 * SuccessCount / TotalCount, ParentId = -1,Category)\\r\\n| where Category in ({Category})\\r\\n| order by ['Sign-in Count'] desc, Name asc\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Sign-ins by Device\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeBrush\",\"exportedParameters\":[{\"parameterName\":\"DeviceDetail\",\"defaultValue\":\"{ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"}\"},{\"fieldName\":\"Category\",\"parameterName\":\"exportCategory\",\"parameterType\":1,\"defaultValue\":\"*\"},{\"fieldName\":\"Name\",\"parameterName\":\"exportName\",\"parameterType\":1,\"defaultValue\":\"*\"}],\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Sign-in Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Failure Count|Interrupt Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"orange\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Success Rate\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"percent\"}}},{\"columnMatch\":\"ParentId\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true,\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"ParentId\",\"treeType\":0,\"expanderColumn\":\"Name\",\"expandTopLevel\":false}}},\"customWidth\":\"67\",\"showPin\":true,\"name\":\"query - 9\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails),Status = parse_json(Status),ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies),DeviceDetail =parse_json(DeviceDetail);\\r\\nlet details = dynamic({ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\"});\\r\\nlet data = union SigninLogs,nonInteractive\\r\\n| extend AppDisplayName = iff(AppDisplayName == '', 'Unknown', AppDisplayName)\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend Country = tostring(LocationDetails.countryOrRegion)\\r\\n| extend City = tostring(LocationDetails.city)\\r\\n| extend errorCode = Status.errorCode\\r\\n| extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending user action\\\",errorCode == 50140, \\\"Pending user action\\\", errorCode == 51006, \\\"Pending user action\\\", errorCode == 50059, \\\"Pending user action\\\",errorCode == 65001, \\\"Pending user action\\\", errorCode == 52004, \\\"Pending user action\\\", errorCode == 50055, \\\"Pending user action\\\", errorCode == 50144, \\\"Pending user action\\\", errorCode == 50072, \\\"Pending user action\\\", errorCode == 50074, \\\"Pending user action\\\", errorCode == 16000, \\\"Pending user action\\\", errorCode == 16001, \\\"Pending user action\\\", errorCode == 16003, \\\"Pending user action\\\", errorCode == 50127, \\\"Pending user action\\\", errorCode == 50125, \\\"Pending user action\\\", errorCode == 50129, \\\"Pending user action\\\", errorCode == 50143, \\\"Pending user action\\\", errorCode == 81010, \\\"Pending user action\\\", errorCode == 81014, \\\"Pending user action\\\", errorCode == 81012 ,\\\"Pending user action\\\", \\\"Failure\\\")\\r\\n| where SigninStatus == '{SigninStatus}' or '{SigninStatus}' == '*' or '{SigninStatus}' == 'All Sign-ins'\\r\\n| where details.Type == '*' or (details.Type == 'Country' and Country == details.Name) or (details.Type == 'City' and City == details.Name);\\r\\ndata\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project User = UserDisplayName, ['Sign-in Status'] = strcat(iff(SigninStatus == 'Success', '✔️', '❌'), ' ', SigninStatus), ['Sign-in Time'] = TimeAgo, App = AppDisplayName, ['Error code'] = errorCode, ['Result type'] = ResultType, ['Result signature'] = ResultSignature, ['Result description'] = ResultDescription, ['Conditional access policies'] = ConditionalAccessPolicies, ['Conditional access status'] = ConditionalAccessStatus, ['Operating system'] = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser, ['Country or region'] = LocationDetails.countryOrRegion, ['State'] = LocationDetails.state, ['City'] = LocationDetails.city, ['Time generated'] = TimeGenerated, Status, ['User principal name'] = UserPrincipalName, Category, Name = tostring(DeviceDetail.operatingSystem)\\r\\n| where Category in ('{exportCategory}') or \\\"*\\\" in ('{exportCategory}')\\r\\n| where Name in ('{exportName}') or \\\"*\\\" in ('{exportName}')\",\"size\":1,\"showAnalytics\":true,\"title\":\"Device Sign-in details\",\"timeContext\":{\"durationMs\":0},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Sign-in Status\",\"formatter\":7,\"formatOptions\":{\"linkTarget\":\"CellDetails\"}},{\"columnMatch\":\"App\",\"formatter\":5},{\"columnMatch\":\"Error code\",\"formatter\":5},{\"columnMatch\":\"Result type\",\"formatter\":5},{\"columnMatch\":\"Result signature\",\"formatter\":5},{\"columnMatch\":\"Result description\",\"formatter\":5},{\"columnMatch\":\"Conditional access policies\",\"formatter\":5},{\"columnMatch\":\"Conditional access status\",\"formatter\":5},{\"columnMatch\":\"Operating system\",\"formatter\":5},{\"columnMatch\":\"Browser\",\"formatter\":5},{\"columnMatch\":\"Country or region\",\"formatter\":5},{\"columnMatch\":\"State\",\"formatter\":5},{\"columnMatch\":\"City\",\"formatter\":5},{\"columnMatch\":\"Time generated\",\"formatter\":5},{\"columnMatch\":\"Status\",\"formatter\":5},{\"columnMatch\":\"User principal name\",\"formatter\":5},{\"columnMatch\":\"Category\",\"formatter\":5},{\"columnMatch\":\"Name\",\"formatter\":5}],\"filter\":true}},\"customWidth\":\"33\",\"name\":\"query - 8 - Copy\"},{\"type\":1,\"content\":{\"json\":\"## Sign-ins using Conditional Access\"},\"name\":\"text - 12\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend CAStatus = case(ConditionalAccessStatus ==\\\"success\\\",\\\"Successful\\\",\\r\\n ConditionalAccessStatus == \\\"failure\\\", \\\"Failed\\\", \\r\\n ConditionalAccessStatus == \\\"notApplied\\\", \\\"Not applied\\\", \\r\\n isempty(ConditionalAccessStatus), \\\"Not applied\\\", \\r\\n \\\"Disabled\\\")\\r\\n|mvexpand ConditionalAccessPolicies\\r\\n|extend CAGrantControlName = tostring(ConditionalAccessPolicies.enforcedGrantControls[0])\\r\\n|extend CAGrantControl = case(CAGrantControlName contains \\\"MFA\\\", \\\"Require MFA\\\", \\r\\n CAGrantControlName contains \\\"Terms of Use\\\", \\\"Require Terms of Use\\\", \\r\\n CAGrantControlName contains \\\"Privacy\\\", \\\"Require Privacy Statement\\\", \\r\\n CAGrantControlName contains \\\"Device\\\", \\\"Require Device Compliant\\\", \\r\\n CAGrantControlName contains \\\"Azure AD Joined\\\", \\\"Require Hybird Azure AD Joined Device\\\", \\r\\n CAGrantControlName contains \\\"Apps\\\", \\\"Require Approved Apps\\\",\\r\\n \\\"Other\\\");\\r\\ndata\\r\\n| where Category in ({Category})\\r\\n| summarize Count = dcount(Id) by CAStatus\\r\\n| join kind = inner (data\\r\\n | make-series Trend = dcount(Id) default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by CAStatus\\r\\n ) on CAStatus\\r\\n| project-away CAStatus1, TimeGenerated\\r\\n| order by Count desc\",\"size\":4,\"title\":\"Conditional access status\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"tiles\",\"tileSettings\":{\"titleContent\":{\"columnMatch\":\"CAStatus\",\"formatter\":1},\"subtitleContent\":{\"columnMatch\":\"Category\"},\"leftContent\":{\"columnMatch\":\"Count\",\"formatter\":12,\"formatOptions\":{\"palette\":\"auto\"},\"numberFormat\":{\"unit\":17,\"options\":{\"maximumSignificantDigits\":3,\"maximumFractionDigits\":2}}},\"showBorder\":false}},\"name\":\"query - 9\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend errorCode = toint(Status.errorCode)\\r\\n|extend Reason = tostring(Status.failureReason)\\r\\n|extend CAStatus = case(ConditionalAccessStatus ==0,\\\"✔️ Success\\\", \\r\\n ConditionalAccessStatus == 1, \\\"❌ Failure\\\", \\r\\n ConditionalAccessStatus == 2, \\\"⚠️ Not Applied\\\", \\r\\n ConditionalAccessStatus == \\\"\\\", \\\"⚠️ Not Applied\\\", \\r\\n \\\"🚫 Disabled\\\")\\r\\n|mvexpand ConditionalAccessPolicies\\r\\n|extend CAGrantControlName = tostring(ConditionalAccessPolicies.enforcedGrantControls[0])\\r\\n|extend CAGrantControl = case(CAGrantControlName contains \\\"MFA\\\", \\\"Require MFA\\\", \\r\\n CAGrantControlName contains \\\"Terms of Use\\\", \\\"Require Terms of Use\\\", \\r\\n CAGrantControlName contains \\\"Privacy\\\", \\\"Require Privacy Statement\\\", \\r\\n CAGrantControlName contains \\\"Device\\\", \\\"Require Device Compliant\\\", \\r\\n CAGrantControlName contains \\\"Azure AD Joined\\\", \\\"Require Hybird Azure AD Joined Device\\\", \\r\\n CAGrantControlName contains \\\"Apps\\\", \\\"Require Approved Apps\\\",\\\"Other\\\");\\r\\ndata\\r\\n| summarize Count = dcount(Id) by CAStatus, CAGrantControl\\r\\n| project Id = strcat(CAStatus, '/', CAGrantControl), Name = CAGrantControl, Parent = CAStatus, Count, Type = 'CAGrantControl'\\r\\n| join kind = inner (data\\r\\n | make-series Trend = dcount(Id) default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by CAStatus, CAGrantControl\\r\\n | project Id = strcat(CAStatus, '/', CAGrantControl), Trend\\r\\n ) on Id\\r\\n| project-away Id1\\r\\n| union (data\\r\\n | where Category in ({Category})\\r\\n | summarize Count = dcount(Id) by CAStatus\\r\\n | project Id = CAStatus, Name = CAStatus, Parent = '', Count, Type = 'CAStatus'\\r\\n | join kind = inner (data\\r\\n | make-series Trend = dcount(Id) default = 0 on TimeGenerated in range({TimeRange:start}, {TimeRange:end}, {TimeRange:grain}) by CAStatus\\r\\n | project Id = CAStatus, Trend\\r\\n ) on Id\\r\\n | project-away Id1)\\r\\n| order by Count desc\",\"size\":0,\"title\":\"Conditional access status\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"exportParameterName\":\"Detail\",\"exportDefaultValue\":\"{ \\\"Name\\\":\\\"\\\", \\\"Type\\\":\\\"*\\\", \\\"Parent\\\":\\\"*\\\"}\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Id\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Parent\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":0,\"options\":{\"style\":\"decimal\"}}},{\"columnMatch\":\"Type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true}}],\"hierarchySettings\":{\"idColumn\":\"Id\",\"parentColumn\":\"Parent\",\"treeType\":0,\"expanderColumn\":\"Name\",\"expandTopLevel\":true}}},\"customWidth\":\"50\",\"name\":\"query - 10\",\"styleSettings\":{\"margin\":\"50\"}},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let details = dynamic({Detail});\\r\\nlet nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend errorCode = toint(Status.errorCode)\\r\\n|extend Reason = tostring(Status.failureReason)\\r\\n|extend CAStatus = case(ConditionalAccessStatus ==\\\"success\\\",\\\"✔️ Success\\\", \\r\\n ConditionalAccessStatus == \\\"failure\\\", \\\"❌ Failure\\\", \\r\\n ConditionalAccessStatus == \\\"notApplied\\\", \\\"⚠️ Not Applied\\\", \\r\\n ConditionalAccessStatus == \\\"\\\", \\\"⚠️ Not Applied\\\", \\r\\n \\\"🚫 Disabled\\\")\\r\\n|mvexpand ConditionalAccessPolicies\\r\\n|extend CAGrantControlName = tostring(ConditionalAccessPolicies.enforcedGrantControls[0])\\r\\n|extend CAGrantControl = case(CAGrantControlName contains \\\"MFA\\\", \\\"Require MFA\\\", \\r\\n CAGrantControlName contains \\\"Terms of Use\\\", \\\"Require Terms of Use\\\", \\r\\n CAGrantControlName contains \\\"Privacy\\\", \\\"Require Privacy Statement\\\", \\r\\n CAGrantControlName contains \\\"Device\\\", \\\"Require Device Compliant\\\", \\r\\n CAGrantControlName contains \\\"Azure AD Joined\\\", \\\"Require Hybird Azure AD Joined Device\\\", \\r\\n CAGrantControlName contains \\\"Apps\\\", \\\"Require Approved Apps\\\",\\r\\n \\\"Other\\\")\\r\\n|extend CAGrantControlRank = case(CAGrantControlName contains \\\"MFA\\\", 1, \\r\\n CAGrantControlName contains \\\"Terms of Use\\\", 2, \\r\\n CAGrantControlName contains \\\"Privacy\\\", 3, \\r\\n CAGrantControlName contains \\\"Device\\\", 4, \\r\\n CAGrantControlName contains \\\"Azure AD Joined\\\", 5, \\r\\n CAGrantControlName contains \\\"Apps\\\", 6,\\r\\n 7)\\r\\n| where details.Type == '*' or (details.Type == 'CAStatus' and CAStatus == details.Name) or (details.Type == 'CAGrantControl' and CAGrantControl == details.Name and CAStatus == details.Parent);\\r\\ndata\\r\\n| order by CAGrantControlRank desc\\r\\n| summarize CAGrantControls = make_set(CAGrantControl) by AppDisplayName, CAStatus, TimeGenerated, UserDisplayName, Category\\r\\n| extend CAGrantControlText = replace(@\\\",\\\", \\\", \\\", replace(@'\\\"', @'', replace(@\\\"\\\\]\\\", @\\\"\\\", replace(@\\\"\\\\[\\\", @\\\"\\\", tostring(CAGrantControls)))))\\r\\n| extend CAGrantControlSummary = case(array_length(CAGrantControls) > 1, strcat(CAGrantControls[0], ' + ', array_length(CAGrantControls) - 1, ' more'), array_length(CAGrantControls) == 1, tostring(CAGrantControls[0]), 'None')\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project Application = AppDisplayName, ['CA Status'] = CAStatus, ['CA Grant Controls'] = CAGrantControlSummary, ['All CA Grant Controls'] = CAGrantControlText, ['Sign-in Time'] = TimeAgo, ['User'] = UserDisplayName, Category\\r\\n| where Category in ({Category})\",\"size\":0,\"showAnalytics\":true,\"title\":\"Recent sign-ins\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"CA Grant Controls\",\"formatter\":1,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"All CA Grant Controls\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"User\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}]}},\"customWidth\":\"50\",\"showPin\":true,\"name\":\"query - 7 - Copy\"},{\"type\":1,\"content\":{\"json\":\"## Troubleshooting Sign-ins\"},\"name\":\"text - 13\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n|extend errorCode = Status.errorCode\\r\\n|extend SigninStatus = case(errorCode == 0, \\\"Success\\\", errorCode == 50058, \\\"Pending action (Interrupts)\\\",errorCode == 50140, \\\"Pending action (Interrupts)\\\", errorCode == 51006, \\\"Pending action (Interrupts)\\\", errorCode == 50059, \\\"Pending action (Interrupts)\\\",errorCode == 65001, \\\"Pending action (Interrupts)\\\", errorCode == 52004, \\\"Pending action (Interrupts)\\\", errorCode == 50055, \\\"Pending action (Interrupts)\\\", errorCode == 50144, \\\"Pending action (Interrupts)\\\", errorCode == 50072, \\\"Pending action (Interrupts)\\\", errorCode == 50074, \\\"Pending action (Interrupts)\\\", errorCode == 16000, \\\"Pending action (Interrupts)\\\", errorCode == 16001, \\\"Pending action (Interrupts)\\\", errorCode == 16003, \\\"Pending action (Interrupts)\\\", errorCode == 50127, \\\"Pending action (Interrupts)\\\", errorCode == 50125, \\\"Pending action (Interrupts)\\\", errorCode == 50129, \\\"Pending action (Interrupts)\\\", errorCode == 50143, \\\"Pending action (Interrupts)\\\", errorCode == 81010, \\\"Pending action (Interrupts)\\\", errorCode == 81014, \\\"Pending action (Interrupts)\\\", errorCode == 81012 ,\\\"Pending action (Interrupts)\\\", \\\"Failure\\\");\\r\\ndata\\r\\n| summarize Count = count() by SigninStatus, Category\\r\\n| join kind = fullouter (datatable(SigninStatus:string)['Success', 'Pending action (Interrupts)', 'Failure']) on SigninStatus\\r\\n| project SigninStatus = iff(SigninStatus == '', SigninStatus1, SigninStatus), Count = iff(SigninStatus == '', 0, Count), Category\\r\\n| join kind = inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain} by SigninStatus)\\r\\n on SigninStatus\\r\\n| project-away SigninStatus1, TimeGenerated\\r\\n| extend Status = SigninStatus\\r\\n| union (\\r\\n data \\r\\n | summarize Count = count() \\r\\n | extend jkey = 1\\r\\n | join kind=inner (data\\r\\n | make-series Trend = count() default = 0 on TimeGenerated from {TimeRange:start} to {TimeRange:end} step {TimeRange:grain}\\r\\n | extend jkey = 1) on jkey\\r\\n | extend SigninStatus = 'All Sign-ins', Status = '*' \\r\\n)\\r\\n| where Category in ({Category})\\r\\n| order by Count desc\\r\\n\\r\\n\\r\\n\\r\\n\",\"size\":3,\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeRange\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"tiles\",\"tileSettings\":{\"titleContent\":{\"columnMatch\":\"SigninStatus\",\"formatter\":1,\"formatOptions\":{\"showIcon\":true}},\"leftContent\":{\"columnMatch\":\"Count\",\"formatter\":12,\"formatOptions\":{\"palette\":\"blue\",\"showIcon\":true},\"numberFormat\":{\"unit\":17,\"options\":{\"style\":\"decimal\",\"maximumFractionDigits\":2,\"maximumSignificantDigits\":3}}},\"secondaryContent\":{\"columnMatch\":\"Trend\",\"formatter\":9,\"formatOptions\":{\"min\":0,\"palette\":\"blue\",\"showIcon\":true}},\"showBorder\":false}},\"name\":\"query - 5\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend ErrorCode = tostring(Status.errorCode) \\r\\n| extend FailureReason = tostring(Status.failureReason) \\r\\n| where ErrorCode !in (\\\"0\\\",\\\"50058\\\",\\\"50148\\\",\\\"50140\\\", \\\"51006\\\", \\\"50059\\\", \\\"65001\\\", \\\"52004\\\", \\\"50055\\\", \\\"50144\\\",\\\"50072\\\", \\\"50074\\\", \\\"16000\\\",\\\"16001\\\", \\\"16003\\\", \\\"50127\\\", \\\"50125\\\", \\\"50129\\\",\\\"50143\\\", \\\"81010\\\", \\\"81014\\\", \\\"81012\\\") \\r\\n|summarize errCount = count() by ErrorCode, tostring(FailureReason), Category| sort by errCount, Category\\r\\n|project ['❌ Error Code'] = ErrorCode, ['Reason']= FailureReason, ['Error Count'] = toint(errCount), Category\\r\\n|where Category in ({Category});\\r\\ndata\",\"size\":1,\"showAnalytics\":true,\"title\":\"Summary of top errors\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"exportFieldName\":\"❌ Error Code\",\"exportParameterName\":\"ErrorCode\",\"exportDefaultValue\":\"*\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Error Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"orange\",\"showIcon\":true}}],\"filter\":true}},\"customWidth\":\"67\",\"showPin\":true,\"name\":\"query - 5\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status)\\r\\n| extend DeviceDetail = parse_json(DeviceDetail)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies);\\r\\nlet data=\\r\\nunion SigninLogs,nonInteractive\\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend ErrorCode = tostring(Status.errorCode) \\r\\n| extend FailureReason = tostring(Status.failureReason) \\r\\n| where ErrorCode !in (\\\"0\\\",\\\"50058\\\",\\\"50148\\\",\\\"50140\\\", \\\"51006\\\", \\\"50059\\\", \\\"65001\\\", \\\"52004\\\", \\\"50055\\\", \\\"50144\\\",\\\"50072\\\", \\\"50074\\\", \\\"16000\\\",\\\"16001\\\", \\\"16003\\\", \\\"50127\\\", \\\"50125\\\", \\\"50129\\\",\\\"50143\\\", \\\"81010\\\", \\\"81014\\\", \\\"81012\\\") \\r\\n| where '{ErrorCode}' == '*' or '{ErrorCode}' == ErrorCode\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project User = UserDisplayName, IPAddress, ['❌ Error Code'] = ErrorCode, ['Sign-in Time'] = TimeAgo, App = AppDisplayName, ['Error code'] = ErrorCode, ['Result type'] = ResultType, ['Result signature'] = ResultSignature, ['Result description'] = ResultDescription, ['Conditional access policies'] = ConditionalAccessPolicies, ['Conditional access status'] = ConditionalAccessStatus, ['Operating system'] = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser, ['Country or region'] = LocationDetails.countryOrRegion, ['State'] = LocationDetails.state, ['City'] = LocationDetails.city, ['Time generated'] = TimeGenerated, Status, ['User principal name'] = UserPrincipalName, Category\\r\\n| where Category in ({Category});\\r\\ndata\\r\\n\\r\\n\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Sign-ins with errors\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"visualization\":\"table\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"❌ Error Code\",\"formatter\":7,\"formatOptions\":{\"linkTarget\":\"GenericDetails\",\"showIcon\":true}},{\"columnMatch\":\"App\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Error code\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result signature\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result description\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access policies\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Operating system\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Browser\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Country or region\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"State\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"City\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Time generated\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"User principal name\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true}},\"customWidth\":\"33\",\"name\":\"query - 5 - Copy\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend ErrorCode = tostring(Status.errorCode) \\r\\n| extend FailureReason = Status.failureReason \\r\\n| where ErrorCode in (\\\"50058\\\",\\\"50140\\\", \\\"51006\\\", \\\"50059\\\", \\\"65001\\\", \\\"52004\\\", \\\"50055\\\", \\\"50144\\\",\\\"50072\\\", \\\"50074\\\", \\\"16000\\\",\\\"16001\\\", \\\"16003\\\", \\\"50127\\\", \\\"50125\\\", \\\"50129\\\",\\\"50143\\\", \\\"81010\\\", \\\"81014\\\", \\\"81012\\\") \\r\\n|summarize errCount = count() by ErrorCode, tostring(FailureReason), Category\\r\\n| sort by errCount\\r\\n|project ['❌ Error Code'] = ErrorCode, ['Reason'] = FailureReason, ['Interrupt Count'] = toint(errCount), Category\\r\\n| where Category in ({Category});\\r\\ndata\",\"size\":1,\"showAnalytics\":true,\"title\":\"Summary of sign-ins waiting on user action\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"exportFieldName\":\"❌ Error Code\",\"exportParameterName\":\"InterruptErrorCode\",\"exportDefaultValue\":\"*\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Interrupt Count\",\"formatter\":8,\"formatOptions\":{\"min\":0,\"palette\":\"orange\"}}],\"filter\":true}},\"customWidth\":\"67\",\"showPin\":true,\"name\":\"query - 7\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"let nonInteractive = AADNonInteractiveUserSignInLogs\\r\\n| extend LocationDetails = parse_json(LocationDetails)\\r\\n| extend ConditionalAccessPolicies = parse_json(ConditionalAccessPolicies)\\r\\n| extend DeviceDetail = parse_json(DeviceDetail)\\r\\n| extend Status = parse_json(Status);\\r\\nlet data = \\r\\nunion SigninLogs,nonInteractive \\r\\n|where AppDisplayName in ({Apps}) or '*' in ({Apps})\\r\\n|where UserDisplayName in ({Users}) \\r\\n| extend ErrorCode = tostring(Status.errorCode) \\r\\n| extend FailureReason = Status.failureReason \\r\\n| where ErrorCode in (\\\"50058\\\",\\\"50140\\\", \\\"51006\\\", \\\"50059\\\", \\\"65001\\\", \\\"52004\\\", \\\"50055\\\", \\\"50144\\\",\\\"50072\\\", \\\"50074\\\", \\\"16000\\\",\\\"16001\\\", \\\"16003\\\", \\\"50127\\\", \\\"50125\\\", \\\"50129\\\",\\\"50143\\\", \\\"81010\\\", \\\"81014\\\", \\\"81012\\\") \\r\\n| where '{InterruptErrorCode}' == '*' or '{InterruptErrorCode}' == ErrorCode\\r\\n| top 200 by TimeGenerated desc\\r\\n| extend TimeFromNow = now() - TimeGenerated\\r\\n| extend TimeAgo = strcat(case(TimeFromNow < 2m, strcat(toint(TimeFromNow / 1m), ' seconds'), TimeFromNow < 2h, strcat(toint(TimeFromNow / 1m), ' minutes'), TimeFromNow < 2d, strcat(toint(TimeFromNow / 1h), ' hours'), strcat(toint(TimeFromNow / 1d), ' days')), ' ago')\\r\\n| project User = UserDisplayName, IPAddress, ['❌ Error Code'] = ErrorCode, ['Sign-in Time'] = TimeAgo, App = AppDisplayName, ['Error code'] = ErrorCode, ['Result type'] = ResultType, ['Result signature'] = ResultSignature, ['Result description'] = ResultDescription, ['Conditional access policies'] = ConditionalAccessPolicies, ['Conditional access status'] = ConditionalAccessStatus, ['Operating system'] = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser, ['Country or region'] = LocationDetails.countryOrRegion, ['State'] = LocationDetails.state, ['City'] = LocationDetails.city, ['Time generated'] = TimeGenerated, Status, ['User principal name'] = UserPrincipalName, Category\\r\\n| where Category in ({Category});\\r\\ndata\\r\\n\\r\\n\",\"size\":1,\"showAnalytics\":true,\"title\":\"Sign-ins waiting on user action\",\"timeContext\":{\"durationMs\":1209600000},\"timeContextFromParameter\":\"TimeBrush\",\"queryType\":0,\"resourceType\":\"microsoft.operationalinsights/workspaces\",\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"❌ Error Code\",\"formatter\":7,\"formatOptions\":{\"linkTarget\":\"GenericDetails\",\"showIcon\":true}},{\"columnMatch\":\"App\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Error code\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result type\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result signature\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Result description\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access policies\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Conditional access status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Operating system\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Browser\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Country or region\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"State\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"City\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Time generated\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"Status\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}},{\"columnMatch\":\"User principal name\",\"formatter\":5,\"formatOptions\":{\"showIcon\":true}}],\"filter\":true}},\"customWidth\":\"33\",\"showPin\":true,\"name\":\"query - 7 - Copy\"}],\"fromTemplateId\":\"sentinel-AzureActiveDirectorySigninLogs\",\"$schema\":\"https://github.com/Microsoft/Application-Insights-Workbooks/blob/master/schema/workbook.json\"}\n",
- "version": "1.0",
- "sourceId": "[variables('workspaceResourceId')]",
- "category": "sentinel"
+ "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when Organization Outbound Direct Settings are changed for \"Users & Groups\" and for \"Applications\".",
+ "displayName": "Cross-tenant Access Settings Organization Outbound Direct Settings Changed",
+ "enabled": false,
+ "query": "//In User & Groups and in Applications, the following \"AccessType\" values in columns PremodifiedOutboundSettings and ModifiedOutboundSettings are interpreted accordingly:\n// When Access Type in premodified outbound settings value was 1 that means that the initial access was allowed. When Access Type in premodified outbound settings value was 2 that means that the initial access was blocked. \n// When Access Type in modified outbound settings value is 1 that means that now access is allowed. When Access Type in modified outbound settings value is 2 that means that now access is blocked. \nAuditLogs\n| where OperationName has \"Update a partner cross-tenant access setting\"\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"b2bDirectConnectOutbound\"\n | extend PremodifiedOutboundSettings = trim('\"',tostring(Property.oldValue)),\n ModifiedOutboundSettings = trim(@'\"',tostring(Property.newValue))\n )\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| where PremodifiedOutboundSettings != ModifiedOutboundSettings\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
+ "queryFrequency": "P2D",
+ "queryPeriod": "P2D",
+ "severity": "Medium",
+ "suppressionDuration": "PT1H",
+ "suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
+ "status": "Available",
+ "requiredDataConnectors": [
+ {
+ "dataTypes": [
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ }
+ ],
+ "tactics": [
+ "InitialAccess",
+ "Persistence",
+ "Discovery"
+ ],
+ "techniques": [
+ "T1078",
+ "T1136",
+ "T1087"
+ ],
+ "entityMappings": [
+ {
+ "fieldMappings": [
+ {
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatedByIPAdress",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ }
+ ]
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Workbook-', last(split(variables('workbookId2'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId21'),'/'))))]",
"properties": {
- "description": "@{workbookKey=AzureActiveDirectorySigninLogsWorkbook; logoFileName=azureactivedirectory_logo.svg; description=Gain insights into Azure Active Directory by connecting Microsoft Sentinel and using the sign-in logs to gather insights around Azure AD scenarios. \nYou can learn about sign-in operations, such as user sign-ins and locations, email addresses, and IP addresses of your users, as well as failed activities and the errors that triggered the failures.; dataTypesDependencies=System.Object[]; dataConnectorsDependencies=System.Object[]; previewImagesFileNames=System.Object[]; version=2.4.0; title=Azure AD Sign-in logs; templateRelativePath=AzureActiveDirectorySignins.json; subtitle=; provider=Microsoft}.description",
- "parentId": "[variables('workbookId2')]",
- "contentId": "[variables('_workbookContentId2')]",
- "kind": "Workbook",
- "version": "[variables('workbookVersion2')]",
+ "description": "Azure Active Directory Analytics Rule 21",
+ "parentId": "[variables('analyticRuleId21')]",
+ "contentId": "[variables('_analyticRulecontentId21')]",
+ "kind": "AnalyticsRule",
+ "version": "[variables('analyticRuleVersion21')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -4896,19 +3578,6 @@
"name": "Microsoft Corporation",
"email": "support@microsoft.com",
"link": "https://support.microsoft.com/"
- },
- "dependencies": {
- "operator": "AND",
- "criteria": [
- {
- "contentId": "SigninLogs",
- "kind": "DataType"
- },
- {
- "contentId": "AzureActiveDirectory",
- "kind": "DataConnector"
- }
- ]
}
}
}
@@ -4919,44 +3588,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_workbookContentId2')]",
- "contentKind": "Workbook",
- "displayName": "[parameters('workbook2-name')]",
- "contentProductId": "[variables('_workbookcontentProductId2')]",
- "id": "[variables('_workbookcontentProductId2')]",
- "version": "[variables('workbookVersion2')]"
+ "contentId": "[variables('_analyticRulecontentId21')]",
+ "contentKind": "AnalyticsRule",
+ "displayName": "Cross-tenant Access Settings Organization Outbound Direct Settings Changed",
+ "contentProductId": "[variables('_analyticRulecontentProductId21')]",
+ "id": "[variables('_analyticRulecontentProductId21')]",
+ "version": "[variables('analyticRuleVersion21')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName1')]",
+ "name": "[variables('analyticRuleTemplateSpecName22')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AccountCreatedandDeletedinShortTimeframe_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "DisabledAccountSigninsAcrossManyApplications_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion1')]",
+ "contentVersion": "[variables('analyticRuleVersion22')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId1')]",
+ "name": "[variables('analyticRulecontentId22')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Search for user principal name (UPN) events. Look for accounts created and then deleted in under 24 hours. Attackers may create an account for their use, and then remove the account when no longer needed.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#short-lived-account",
- "displayName": "Account Created and Deleted in Short Timeframe",
+ "description": "Identifies failed attempts to sign in to disabled accounts across multiple Azure Applications.\nDefault threshold for Azure Applications attempted to sign in to is 3.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\n50057 - User account is disabled. The account has been disabled by an administrator.",
+ "displayName": "Attempts to sign in to disabled accounts",
"enabled": false,
- "query": "let queryfrequency = 1h;\nlet queryperiod = 1d;\nAuditLogs\n| where TimeGenerated > ago(queryfrequency)\n| where OperationName =~ \"Delete user\"\n//extend UserPrincipalName = tostring(TargetResources[0].userPrincipalName)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type == \"User\"\n | extend UserPrincipalName = extract(@'([a-f0-9]{32})?(.*)', 2, tostring(TargetResource.userPrincipalName))\n )\n| extend DeletedByUser = tostring(InitiatedBy.user.userPrincipalName), DeletedByIPAddress = tostring(InitiatedBy.user.ipAddress)\n| extend DeletedByApp = tostring(InitiatedBy.app.displayName)\n| project Deletion_TimeGenerated = TimeGenerated, UserPrincipalName, DeletedByUser, DeletedByIPAddress, DeletedByApp, Deletion_AdditionalDetails = AdditionalDetails, Deletion_InitiatedBy = InitiatedBy, Deletion_TargetResources = TargetResources\n| join kind=inner (\n AuditLogs\n | where TimeGenerated > ago(queryperiod)\n | where OperationName =~ \"Add user\" \n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type == \"User\"\n | extend UserPrincipalName = trim(@'\"',tostring(TargetResource.userPrincipalName))\n )\n | project-rename Creation_TimeGenerated = TimeGenerated\n) on UserPrincipalName\n| extend TimeDelta = Deletion_TimeGenerated - Creation_TimeGenerated\n| where TimeDelta between (time(0s) .. queryperiod)\n| extend CreatedByUser = tostring(InitiatedBy.user.userPrincipalName), CreatedByIPAddress = tostring(InitiatedBy.user.ipAddress)\n| extend CreatedByApp = tostring(InitiatedBy.app.displayName)\n| project Creation_TimeGenerated, Deletion_TimeGenerated, TimeDelta, UserPrincipalName, DeletedByUser, DeletedByIPAddress, DeletedByApp, CreatedByUser, CreatedByIPAddress, CreatedByApp, Creation_AdditionalDetails = AdditionalDetails, Creation_InitiatedBy = InitiatedBy, Creation_TargetResources = TargetResources, Deletion_AdditionalDetails, Deletion_InitiatedBy, Deletion_TargetResources\n| extend timestamp = Deletion_TimeGenerated, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
- "queryFrequency": "PT1H",
+ "query": "let threshold = 3;\nlet aadFunc = (tableName:string){\ntable(tableName)\n| where ResultType == \"50057\"\n| where ResultDescription =~ \"User account is disabled. The account has been disabled by an administrator.\"\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), applicationCount = dcount(AppDisplayName),\napplicationSet = make_set(AppDisplayName), count() by UserPrincipalName, IPAddress, Type\n| where applicationCount >= threshold\n| extend timestamp = StartTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
+ "queryFrequency": "P1D",
"queryPeriod": "P1D",
- "severity": "High",
+ "severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -4964,10 +3633,16 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "SigninLogs"
- ]
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
@@ -4978,26 +3653,26 @@
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "DeletedByIPAddress"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -5005,13 +3680,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId1'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId22'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 1",
- "parentId": "[variables('analyticRuleId1')]",
- "contentId": "[variables('_analyticRulecontentId1')]",
+ "description": "Azure Active Directory Analytics Rule 22",
+ "parentId": "[variables('analyticRuleId22')]",
+ "contentId": "[variables('_analyticRulecontentId22')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion1')]",
+ "version": "[variables('analyticRuleVersion22')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -5036,41 +3711,41 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId1')]",
+ "contentId": "[variables('_analyticRulecontentId22')]",
"contentKind": "AnalyticsRule",
- "displayName": "Account Created and Deleted in Short Timeframe",
- "contentProductId": "[variables('_analyticRulecontentProductId1')]",
- "id": "[variables('_analyticRulecontentProductId1')]",
- "version": "[variables('analyticRuleVersion1')]"
+ "displayName": "Attempts to sign in to disabled accounts",
+ "contentProductId": "[variables('_analyticRulecontentProductId22')]",
+ "id": "[variables('_analyticRulecontentProductId22')]",
+ "version": "[variables('analyticRuleVersion22')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName2')]",
+ "name": "[variables('analyticRuleTemplateSpecName23')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AccountCreatedDeletedByNonApprovedUser_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "DistribPassCrackAttempt_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion2')]",
+ "contentVersion": "[variables('analyticRuleVersion23')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId2')]",
+ "name": "[variables('analyticRulecontentId23')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies accounts that were created or deleted by a defined list of non-approved user principal names. Add to this list before running the query for accurate results.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts",
- "displayName": "Account created or deleted by non-approved user",
+ "description": "Identifies distributed password cracking attempts from the Azure Active Directory SigninLogs.\nThe query looks for unusually high number of failed password attempts coming from multiple locations for a user account.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\n50053 Account is locked because the user tried to sign in too many times with an incorrect user ID or password.\n50055 Invalid password, entered expired password.\n50056 Invalid or null password - Password does not exist in store for this user.\n50126 Invalid username or password, or invalid on-premises username or password.",
+ "displayName": "Distributed Password cracking attempts in AzureAD",
"enabled": false,
- "query": "// Add non-approved user principal names to the list below to search for their account creation/deletion activity\n// ex: dynamic([\"UPN1\", \"upn123\"])\nlet nonapproved_users = dynamic([]);\nAuditLogs\n| where OperationName =~ \"Add user\" or OperationName =~ \"Delete user\"\n| where Result =~ \"success\"\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName)\n| where InitiatingUser has_any (nonapproved_users)\n| project-reorder TimeGenerated, ResourceId, OperationName, InitiatingUser, TargetResources\n| extend InitiatedUserIpAddress = tostring(InitiatedBy.user.ipAddress)\n| extend Name = tostring(split(InitiatingUser,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUser,'@',1)[0])\n",
+ "query": "let s_threshold = 30;\nlet l_threshold = 3;\nlet aadFunc = (tableName:string){\ntable(tableName)\n| where OperationName =~ \"Sign-in activity\"\n// Error codes that we want to look at as they are related to the use of incorrect password.\n| where ResultType in (\"50126\", \"50053\" , \"50055\", \"50056\")\n| extend DeviceDetail = todynamic(DeviceDetail), Status = todynamic(DeviceDetail), LocationDetails = todynamic(LocationDetails)\n| extend OS = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser\n| extend StatusCode = tostring(Status.errorCode), StatusDetails = tostring(Status.additionalDetails)\n| extend LocationString = strcat(tostring(LocationDetails.countryOrRegion), \"/\", tostring(LocationDetails.state), \"/\", tostring(LocationDetails.city))\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), LocationCount=dcount(LocationString), Location = make_set(LocationString,100),\nIPAddress = make_set(IPAddress,100), IPAddressCount = dcount(IPAddress), AppDisplayName = make_set(AppDisplayName,100), ResultDescription = make_set(ResultDescription,50),\nBrowser = make_set(Browser,20), OS = make_set(OS,20), SigninCount = count() by UserPrincipalName, Type\n// Setting a generic threshold - Can be different for different environment\n| where SigninCount > s_threshold and LocationCount >= l_threshold\n| extend Location = tostring(Location), IPAddress = tostring(IPAddress), AppDisplayName = tostring(AppDisplayName), ResultDescription = tostring(ResultDescription), Browser = tostring(Browser), OS = tostring(OS)\n| extend timestamp = StartTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
"queryFrequency": "P1D",
"queryPeriod": "P1D",
"severity": "Medium",
@@ -5081,40 +3756,46 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess"
+ "CredentialAccess"
],
"techniques": [
- "T1078"
+ "T1110"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatedUserIpAddress"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -5122,13 +3803,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId2'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId23'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 2",
- "parentId": "[variables('analyticRuleId2')]",
- "contentId": "[variables('_analyticRulecontentId2')]",
+ "description": "Azure Active Directory Analytics Rule 23",
+ "parentId": "[variables('analyticRuleId23')]",
+ "contentId": "[variables('_analyticRulecontentId23')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion2')]",
+ "version": "[variables('analyticRuleVersion23')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -5153,44 +3834,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId2')]",
+ "contentId": "[variables('_analyticRulecontentId23')]",
"contentKind": "AnalyticsRule",
- "displayName": "Account created or deleted by non-approved user",
- "contentProductId": "[variables('_analyticRulecontentProductId2')]",
- "id": "[variables('_analyticRulecontentProductId2')]",
- "version": "[variables('analyticRuleVersion2')]"
+ "displayName": "Distributed Password cracking attempts in AzureAD",
+ "contentProductId": "[variables('_analyticRulecontentProductId23')]",
+ "id": "[variables('_analyticRulecontentProductId23')]",
+ "version": "[variables('analyticRuleVersion23')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName3')]",
+ "name": "[variables('analyticRuleTemplateSpecName24')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "ADFSDomainTrustMods_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "ExplicitMFADeny_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion3')]",
+ "contentVersion": "[variables('analyticRuleVersion24')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId3')]",
+ "name": "[variables('analyticRulecontentId24')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This will alert when a user or application modifies the federation settings on the domain or Update domain authentication from Managed to Federated.\nFor example, this alert will trigger when a new Active Directory Federated Service (ADFS) TrustedRealm object, such as a signing certificate, is added to the domain.\nModification to domain federation settings should be rare. Confirm the added or modified target domain/URL is legitimate administrator behavior.\nTo understand why an authorized user may update settings for a federated domain in Office 365, Azure, or Intune, see: https://docs.microsoft.com/office365/troubleshoot/active-directory/update-federated-domain-office-365.\nFor details on security realms that accept security tokens, see the ADFS Proxy Protocol (MS-ADFSPP) specification: https://docs.microsoft.com/openspecs/windows_protocols/ms-adfspp/e7b9ea73-1980-4318-96a6-da559486664b.\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "Modified domain federation trust settings",
+ "description": "User explicitly denies MFA push, indicating that login was not expected and the account's password may be compromised.",
+ "displayName": "Explicit MFA Deny",
"enabled": false,
- "query": "(union isfuzzy=true\n(\nAuditLogs\n| where OperationName =~ \"Set federation settings on domain\"\n//| where Result =~ \"success\" // commenting out, as it may be interesting to capture failed attempts\n| mv-expand TargetResources\n| extend modifiedProperties = parse_json(TargetResources).modifiedProperties\n| mv-expand modifiedProperties\n| extend targetDisplayName = tostring(parse_json(modifiedProperties).displayName)\n),\n(\nAuditLogs\n| where OperationName =~ \"Set domain authentication\"\n//| where Result =~ \"success\" // commenting out, as it may be interesting to capture failed attempts\n| mv-expand TargetResources\n| extend modifiedProperties = parse_json(TargetResources).modifiedProperties\n| mv-expand modifiedProperties\n| mv-apply Property = modifiedProperties on \n (\n where Property.displayName =~ \"LiveType\"\n | extend targetDisplayName = tostring(Property.displayName),\n NewDomainValue = tostring(Property.newValue)\n )\n| where NewDomainValue has \"Federated\"\n)\n)\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, AADOperationType, targetDisplayName, Result, InitiatingIpAddress, UserAgent, CorrelationId, TenantId, AADTenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
+ "query": "let aadFunc = (tableName:string){\ntable(tableName)\n| where ResultType == 500121\n| where Status has \"MFA Denied; user declined the authentication\" or Status has \"MFA denied; Phone App Reported Fraud\"\n| extend Type = Type\n| extend timestamp = TimeGenerated, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
"queryFrequency": "P1D",
"queryPeriod": "P1D",
- "severity": "High",
+ "severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -5198,37 +3879,55 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
"CredentialAccess"
],
+ "techniques": [
+ "T1110"
+ ],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatingIpAddress"
+ "columnName": "ClientAppUsed",
+ "identifier": "Url"
}
- ]
+ ],
+ "entityType": "URL"
}
]
}
@@ -5236,13 +3935,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId3'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId24'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 3",
- "parentId": "[variables('analyticRuleId3')]",
- "contentId": "[variables('_analyticRulecontentId3')]",
+ "description": "Azure Active Directory Analytics Rule 24",
+ "parentId": "[variables('analyticRuleId24')]",
+ "contentId": "[variables('_analyticRulecontentId24')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion3')]",
+ "version": "[variables('analyticRuleVersion24')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -5267,42 +3966,42 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId3')]",
+ "contentId": "[variables('_analyticRulecontentId24')]",
"contentKind": "AnalyticsRule",
- "displayName": "Modified domain federation trust settings",
- "contentProductId": "[variables('_analyticRulecontentProductId3')]",
- "id": "[variables('_analyticRulecontentProductId3')]",
- "version": "[variables('analyticRuleVersion3')]"
+ "displayName": "Explicit MFA Deny",
+ "contentProductId": "[variables('_analyticRulecontentProductId24')]",
+ "id": "[variables('_analyticRulecontentProductId24')]",
+ "version": "[variables('analyticRuleVersion24')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName4')]",
+ "name": "[variables('analyticRuleTemplateSpecName25')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "ADFSSignInLogsPasswordSpray_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "ExchangeFullAccessGrantedToApp_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion4')]",
+ "contentVersion": "[variables('analyticRuleVersion25')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId4')]",
+ "name": "[variables('analyticRulecontentId25')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies evidence of password spray activity against Connect Health for AD FS sign-in events by looking for failures from multiple accounts from the same IP address within a time window.\nReference: https://adfshelp.microsoft.com/References/ConnectHealthErrorCodeReference",
- "displayName": "Password spray attack against ADFSSignInLogs",
+ "description": "This detection looks for the full_access_as_app permission being granted to an OAuth application with Admin Consent.\nThis permission provide access to all Exchange mailboxes via the EWS API can could be exploited to access sensitive data \nby being added to a compromised application. The application granted this permission should be reviewed to ensure that it \nis absolutely necessary for the applications function.\nRef: https://learn.microsoft.com/graph/auth-limit-mailbox-access",
+ "displayName": "full_access_as_app Granted To Application",
"enabled": false,
- "query": "let queryfrequency = 30m;\nlet accountthreshold = 10;\nlet successCodes = dynamic([0, 50144]);\nADFSSignInLogs\n| extend IngestionTime = ingestion_time()\n| where IngestionTime > ago(queryfrequency)\n| where not(todynamic(AuthenticationDetails)[0].authenticationMethod == \"Integrated Windows Authentication\")\n| summarize\n DistinctFailureCount = dcountif(UserPrincipalName, ResultType !in (successCodes)),\n DistinctSuccessCount = dcountif(UserPrincipalName, ResultType in (successCodes)),\n SuccessAccounts = make_set_if(UserPrincipalName, ResultType in (successCodes), 250),\n arg_min(TimeGenerated, *)\n by IPAddress\n| where DistinctFailureCount > DistinctSuccessCount and DistinctFailureCount >= accountthreshold\n//| extend SuccessAccounts = iff(array_length(SuccessAccounts) != 0, SuccessAccounts, dynamic([\"null\"]))\n//| mv-expand SuccessAccounts\n| project TimeGenerated, Category, OperationName, IPAddress, DistinctFailureCount, DistinctSuccessCount, SuccessAccounts, AuthenticationRequirement, ConditionalAccessStatus, IsInteractive, UserAgent, NetworkLocationDetails, DeviceDetail, TokenIssuerType, TokenIssuerName, ResourceIdentity\n",
- "queryFrequency": "PT30M",
+ "query": "AuditLogs\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Consent to application\"\n| where TargetResources has \"full_access_as_app\"\n| mv-expand TargetResources\n| extend OAuthAppName = TargetResources.displayName\n| extend ModifiedProperties = TargetResources.modifiedProperties \n| mv-apply Property = ModifiedProperties on \n (\n where Property.displayName =~ \"ConsentContext.isAdminConsent\"\n | extend AdminConsent = tostring(Property.newValue)\n )\n| mv-apply Property = ModifiedProperties on \n (\n where Property.displayName =~ \"ConsentAction.Permissions\"\n | extend Permissions = tostring(Property.newValue)\n )\n| mv-apply Property = ModifiedProperties on \n (\n where Property.displayName =~ \"TargetId.ServicePrincipalNames\"\n | extend AppId = tostring(Property.newValue)\n )\n| mv-expand AdditionalDetails\n| extend GrantUserAgent = tostring(iff(AdditionalDetails.key =~ \"User-Agent\", AdditionalDetails.value, \"\"))\n| parse Permissions with * \"ConsentType: \" GrantConsentType \", Scope: \" GrantScope1 \",\" *\n| where GrantScope1 =~ \"full_access_as_app\"\n| extend GrantIpAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))\n| extend GrantInitiatedBy = tostring(iff(isnotempty(InitiatedBy.user.userPrincipalName),InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName))\n| project-reorder TimeGenerated, OAuthAppName, AppId, AdminConsent, Permissions, GrantIpAddress, GrantInitiatedBy, GrantUserAgent, GrantScope1, GrantConsentType\n| extend Name = split(GrantInitiatedBy, \"@\")[0], UPNSuffix = split(GrantInitiatedBy, \"@\")[1]\n",
+ "queryFrequency": "PT1H",
"queryPeriod": "PT1H",
"severity": "Medium",
"suppressionDuration": "PT1H",
@@ -5312,41 +4011,63 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "ADFSSignInLogs"
- ]
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "CredentialAccess"
+ "DefenseEvasion"
],
"techniques": [
- "T1110"
+ "T1550"
],
"entityMappings": [
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IPAddress"
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "GrantIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
- ]
+ ],
+ "customDetails": {
+ "OAuthApplication": "OAuthAppName",
+ "UserAgent": "GrantUserAgent",
+ "OAuthAppId": "AppId"
+ },
+ "alertDetailsOverride": {
+ "alertDescriptionFormat": "This detection looks for the full_access_as_app permission being granted to an OAuth application with Admin Consent.\nThis permission provide access to all Exchange mailboxes via the EWS API can could be exploited to access sensitive data \nby being added to a compromised application. The application granted this permission should be reviewed to ensure that it \nis absolutely necessary for the applications function.\nIn this case {{GrantInitiatedBy}} granted full_access_as_app to {{OAuthAppName}} from {{GrantIpAddress}}\nRef: https://learn.microsoft.com/graph/auth-limit-mailbox-access\n",
+ "alertDisplayNameFormat": "User {{GrantInitiatedBy}} granted full_access_as_app to {{OAuthAppName}}"
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId4'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId25'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 4",
- "parentId": "[variables('analyticRuleId4')]",
- "contentId": "[variables('_analyticRulecontentId4')]",
+ "description": "Azure Active Directory Analytics Rule 25",
+ "parentId": "[variables('analyticRuleId25')]",
+ "contentId": "[variables('_analyticRulecontentId25')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion4')]",
+ "version": "[variables('analyticRuleVersion25')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -5371,44 +4092,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId4')]",
+ "contentId": "[variables('_analyticRulecontentId25')]",
"contentKind": "AnalyticsRule",
- "displayName": "Password spray attack against ADFSSignInLogs",
- "contentProductId": "[variables('_analyticRulecontentProductId4')]",
- "id": "[variables('_analyticRulecontentProductId4')]",
- "version": "[variables('analyticRuleVersion4')]"
+ "displayName": "full_access_as_app Granted To Application",
+ "contentProductId": "[variables('_analyticRulecontentProductId25')]",
+ "id": "[variables('_analyticRulecontentProductId25')]",
+ "version": "[variables('analyticRuleVersion25')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName5')]",
+ "name": "[variables('analyticRuleTemplateSpecName26')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AdminPromoAfterRoleMgmtAppPermissionGrant_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "FailedLogonToAzurePortal_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion5')]",
+ "contentVersion": "[variables('analyticRuleVersion26')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId5')]",
+ "name": "[variables('analyticRulecontentId26')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This rule looks for a service principal being granted the Microsoft Graph RoleManagement.ReadWrite.Directory (application) permission before being used to add an Azure AD object or user account to an Admin directory role (i.e. Global Administrators).\nThis is a known attack path that is usually abused when a service principal already has the AppRoleAssignment.ReadWrite.All permission granted. This permission allows an app to manage permission grants for application permissions to any API.\nA service principal can promote itself or other service principals to admin roles (i.e. Global Administrators). This would be considered a privilege escalation technique.\nRef : https://docs.microsoft.com/graph/permissions-reference#role-management-permissions, https://docs.microsoft.com/graph/api/directoryrole-post-members?view=graph-rest-1.0&tabs=http",
- "displayName": "Admin promotion after Role Management Application Permission Grant",
+ "description": "Identifies failed login attempts in the Azure Active Directory SigninLogs to the Azure Portal. Many failed logon\nattempts or some failed logon attempts from multiple IPs could indicate a potential brute force attack.\nThe following are excluded due to success and non-failure results:\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\n0 - successful logon\n50125 - Sign-in was interrupted due to a password reset or password registration entry.\n50140 - This error occurred due to 'Keep me signed in' interrupt when the user was signing-in.",
+ "displayName": "Failed login attempts to Azure Portal",
"enabled": false,
- "query": "let query_frequency = 1h;\nlet query_period = 2h;\nAuditLogs\n| where TimeGenerated > ago(query_period)\n| where Category =~ \"ApplicationManagement\" and LoggedByService =~ \"Core Directory\"\n| where OperationName =~ \"Add app role assignment to service principal\"\n| mv-expand TargetResource = TargetResources\n| mv-expand modifiedProperty = TargetResource[\"modifiedProperties\"]\n| where tostring(modifiedProperty[\"displayName\"]) == \"AppRole.Value\"\n| extend PermissionGrant = tostring(modifiedProperty[\"newValue\"])\n| where PermissionGrant has \"RoleManagement.ReadWrite.Directory\"\n| mv-apply modifiedProperty = TargetResource[\"modifiedProperties\"] on (\n summarize modifiedProperties = make_bag(\n bag_pack(tostring(modifiedProperty[\"displayName\"]),\n bag_pack(\"oldValue\", trim(@'[\\\"\\s]+', tostring(modifiedProperty[\"oldValue\"])),\n \"newValue\", trim(@'[\\\"\\s]+', tostring(modifiedProperty[\"newValue\"])))), 100)\n)\n| project\n PermissionGrant_TimeGenerated = TimeGenerated,\n PermissionGrant_OperationName = OperationName,\n PermissionGrant_Result = Result,\n PermissionGrant,\n AppDisplayName = tostring(modifiedProperties[\"ServicePrincipal.DisplayName\"][\"newValue\"]),\n AppServicePrincipalId = tostring(modifiedProperties[\"ServicePrincipal.ObjectID\"][\"newValue\"]),\n PermissionGrant_InitiatedBy = InitiatedBy,\n PermissionGrant_TargetResources = TargetResources,\n PermissionGrant_AdditionalDetails = AdditionalDetails,\n PermissionGrant_CorrelationId = CorrelationId\n| join kind=inner (\n AuditLogs\n | where TimeGenerated > ago(query_frequency)\n | where Category =~ \"RoleManagement\" and LoggedByService =~ \"Core Directory\" and AADOperationType =~ \"Assign\"\n | where isnotempty(InitiatedBy[\"app\"])\n | mv-expand TargetResource = TargetResources\n | mv-expand modifiedProperty = TargetResource[\"modifiedProperties\"]\n | where tostring(modifiedProperty[\"displayName\"]) in (\"Role.DisplayName\", \"RoleDefinition.DisplayName\")\n | extend RoleAssignment = tostring(modifiedProperty[\"newValue\"])\n | where RoleAssignment contains \"Admin\"\n | project\n RoleAssignment_TimeGenerated = TimeGenerated,\n RoleAssignment_OperationName = OperationName,\n RoleAssignment_Result = Result,\n RoleAssignment,\n TargetType = tostring(TargetResources[0][\"type\"]),\n Target = iff(isnotempty(TargetResources[0][\"displayName\"]), tostring(TargetResources[0][\"displayName\"]), tolower(TargetResources[0][\"userPrincipalName\"])),\n TargetId = tostring(TargetResources[0][\"id\"]),\n RoleAssignment_InitiatedBy = InitiatedBy,\n RoleAssignment_TargetResources = TargetResources,\n RoleAssignment_AdditionalDetails = AdditionalDetails,\n RoleAssignment_CorrelationId = CorrelationId,\n AppServicePrincipalId = tostring(InitiatedBy[\"app\"][\"servicePrincipalId\"])\n ) on AppServicePrincipalId\n| where PermissionGrant_TimeGenerated < RoleAssignment_TimeGenerated\n| extend\n TargetName = tostring(split(Target, \"@\")[0]),\n TargetUPNSuffix = tostring(split(Target, \"@\")[1])\n| project PermissionGrant_TimeGenerated, PermissionGrant_OperationName, PermissionGrant_Result, PermissionGrant, AppDisplayName, AppServicePrincipalId, PermissionGrant_InitiatedBy, PermissionGrant_TargetResources, PermissionGrant_AdditionalDetails, PermissionGrant_CorrelationId, RoleAssignment_TimeGenerated, RoleAssignment_OperationName, RoleAssignment_Result, RoleAssignment, TargetType, Target, TargetName, TargetUPNSuffix, TargetId, RoleAssignment_InitiatedBy, RoleAssignment_TargetResources, RoleAssignment_AdditionalDetails, RoleAssignment_CorrelationId\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT2H",
- "severity": "High",
+ "query": "let timeRange = 1d;\nlet lookBack = 7d;\nlet threshold_Failed = 5;\nlet threshold_FailedwithSingleIP = 20;\nlet threshold_IPAddressCount = 2;\nlet isGUID = \"[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}\";\nlet aadFunc = (tableName:string){\nlet azPortalSignins = materialize(table(tableName)\n| where TimeGenerated >= ago(lookBack)\n// Azure Portal only\n| where AppDisplayName =~ \"Azure Portal\")\n;\nlet successPortalSignins = azPortalSignins\n| where TimeGenerated >= ago(timeRange)\n// Azure Portal only and exclude non-failure Result Types\n| where ResultType in (\"0\", \"50125\", \"50140\")\n// Tagging identities not resolved to friendly names\n//| extend Unresolved = iff(Identity matches regex isGUID, true, false)\n| distinct TimeGenerated, UserPrincipalName\n;\nlet failPortalSignins = azPortalSignins\n| where TimeGenerated >= ago(timeRange)\n// Azure Portal only and exclude non-failure Result Types\n| where ResultType !in (\"0\", \"50125\", \"50140\", \"70044\", \"70043\")\n// Tagging identities not resolved to friendly names\n| extend Unresolved = iff(Identity matches regex isGUID, true, false)\n;\n// Verify there is no success for the same connection attempt after the fail\nlet failnoSuccess = failPortalSignins | join kind= leftouter (\n successPortalSignins\n) on UserPrincipalName\n| where TimeGenerated > TimeGenerated1 or isempty(TimeGenerated1)\n| project-away TimeGenerated1, UserPrincipalName1\n;\n// Lookup up resolved identities from last 7 days\nlet identityLookup = azPortalSignins\n| where TimeGenerated >= ago(lookBack)\n| where not(Identity matches regex isGUID)\n| summarize by UserId, lu_UserDisplayName = UserDisplayName, lu_UserPrincipalName = UserPrincipalName;\n// Join resolved names to unresolved list from portal signins\nlet unresolvedNames = failnoSuccess | where Unresolved == true | join kind= inner (\n identityLookup\n) on UserId\n| extend UserDisplayName = lu_UserDisplayName, UserPrincipalName = lu_UserPrincipalName\n| project-away lu_UserDisplayName, lu_UserPrincipalName;\n// Join Signins that had resolved names with list of unresolved that now have a resolved name\nlet u_azPortalSignins = failnoSuccess | where Unresolved == false | union unresolvedNames;\nu_azPortalSignins\n| extend DeviceDetail = todynamic(DeviceDetail), Status = todynamic(DeviceDetail), LocationDetails = todynamic(LocationDetails)\n| extend Status = strcat(ResultType, \": \", ResultDescription), OS = tostring(DeviceDetail.operatingSystem), Browser = tostring(DeviceDetail.browser)\n| extend State = tostring(LocationDetails.state), City = tostring(LocationDetails.city), Region = tostring(LocationDetails.countryOrRegion)\n| extend FullLocation = strcat(Region,'|', State, '|', City) \n| summarize TimeGenerated = make_list(TimeGenerated,100), Status = make_list(Status,100), IPAddresses = make_list(IPAddress,100), IPAddressCount = dcount(IPAddress), FailedLogonCount = count()\nby UserPrincipalName, UserId, UserDisplayName, AppDisplayName, Browser, OS, FullLocation, Type\n| mvexpand TimeGenerated, IPAddresses, Status\n| extend TimeGenerated = todatetime(tostring(TimeGenerated)), IPAddress = tostring(IPAddresses), Status = tostring(Status)\n| project-away IPAddresses\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by UserPrincipalName, UserId, UserDisplayName, Status, FailedLogonCount, IPAddress, IPAddressCount, AppDisplayName, Browser, OS, FullLocation, Type\n| where (IPAddressCount >= threshold_IPAddressCount and FailedLogonCount >= threshold_Failed) or FailedLogonCount >= threshold_FailedwithSingleIP\n| extend timestamp = StartTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P7D",
+ "severity": "Low",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -5416,42 +4137,46 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "PrivilegeEscalation",
- "Persistence"
+ "CredentialAccess"
],
"techniques": [
- "T1098",
- "T1078"
+ "T1110"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "AppDisplayName"
+ "columnName": "Name",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "TargetName"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "TargetUPNSuffix"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -5459,13 +4184,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId5'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId26'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 5",
- "parentId": "[variables('analyticRuleId5')]",
- "contentId": "[variables('_analyticRulecontentId5')]",
+ "description": "Azure Active Directory Analytics Rule 26",
+ "parentId": "[variables('analyticRuleId26')]",
+ "contentId": "[variables('_analyticRulecontentId26')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion5')]",
+ "version": "[variables('analyticRuleVersion26')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -5490,44 +4215,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId5')]",
+ "contentId": "[variables('_analyticRulecontentId26')]",
"contentKind": "AnalyticsRule",
- "displayName": "Admin promotion after Role Management Application Permission Grant",
- "contentProductId": "[variables('_analyticRulecontentProductId5')]",
- "id": "[variables('_analyticRulecontentProductId5')]",
- "version": "[variables('analyticRuleVersion5')]"
+ "displayName": "Failed login attempts to Azure Portal",
+ "contentProductId": "[variables('_analyticRulecontentProductId26')]",
+ "id": "[variables('_analyticRulecontentProductId26')]",
+ "version": "[variables('analyticRuleVersion26')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName6')]",
+ "name": "[variables('analyticRuleTemplateSpecName27')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AnomalousUserAppSigninLocationIncrease-detection_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "FirstAppOrServicePrincipalCredential_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion6')]",
+ "contentVersion": "[variables('analyticRuleVersion27')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId6')]",
+ "name": "[variables('analyticRulecontentId27')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This query over Azure Active Directory sign-in considers all user sign-ins for each Azure Active\nDirectory application and picks out the most anomalous change in location profile for a user within an\nindividual application",
- "displayName": "Anomalous sign-in location by user account and authenticating application",
+ "description": "This will alert when an admin or app owner account adds a new credential to an Application or Service Principal where there was no previous verify KeyCredential associated.\nIf a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\nAdditional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "First access credential added to Application or Service Principal where no credential was present",
"enabled": false,
- "query": "// Adjust this figure to adjust how sensitive this detection is\nlet sensitivity = 2.5;\nlet AuthEvents = materialize(\nunion isfuzzy=True SigninLogs, AADNonInteractiveUserSignInLogs\n| where TimeGenerated > ago(7d)\n| where ResultType == 0\n| extend LocationDetails = LocationDetails_dynamic\n| extend Location = strcat(LocationDetails.countryOrRegion, \"-\", LocationDetails.state,\"-\", LocationDetails.city)\n| where Location != \"--\");\nAuthEvents\n| summarize dcount(Location) by AppDisplayName, AppId, UserPrincipalName, UserId, bin(startofday(TimeGenerated), 1d)\n| where dcount_Location > 2\n| summarize CountOfLocations = make_list(dcount_Location, 10000), TimeStamp = make_list(TimeGenerated, 10000) by AppId, UserId\n| extend (Anomalies, Score, Baseline) = series_decompose_anomalies(CountOfLocations, sensitivity, -1, 'linefit')\n| mv-expand CountOfLocations to typeof(double), TimeStamp to typeof(datetime), Anomalies to typeof(double), Score to typeof(double), Baseline to typeof(long)\n| where Anomalies > 0\n| join kind=inner( AuthEvents | extend TimeStamp = startofday(TimeGenerated)) on UserId, AppId\n| extend SignInDetails = bag_pack(\"TimeGenerated\", TimeGenerated, \"Location\", Location, \"Source\", IPAddress, \"Device\", DeviceDetail_dynamic)\n| summarize SignInDetailsSet=make_set(SignInDetails, 1000) by UserId, UserPrincipalName, CountOfLocations, TimeStamp, AppId, AppDisplayName\n| extend Name = split(UserPrincipalName, \"@\")[0], UPNSuffix = split(UserPrincipalName, \"@\")[1]\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P7D",
- "severity": "Medium",
+ "query": "AuditLogs\n| where OperationName has (\"Certificates and secrets management\")\n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"Application\"\n | extend targetDisplayName = tostring(TargetResource.displayName),\n targetId = tostring(TargetResource.id),\n targetType = tostring(TargetResource.type),\n keyEvents = TargetResource.modifiedProperties\n )\n| mv-apply Property = keyEvents on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend new_value_set = parse_json(tostring(Property.newValue)),\n old_value_set = parse_json(tostring(Property.oldValue))\n )\n| where old_value_set == \"[]\" \n| mv-expand new_value_set\n| parse new_value_set with * \"KeyIdentifier=\" keyIdentifier:string \",KeyType=\" keyType:string \",KeyUsage=\" keyUsage:string \",DisplayName=\" keyDisplayName:string \"]\" *\n| where keyUsage =~ \"Verify\"\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| project-away new_value_set, old_value_set\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, InitiatingIpAddress, UserAgent, targetDisplayName, targetId, targetType, keyDisplayName, keyType, keyUsage, keyIdentifier, CorrelationId, TenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "PT1H",
+ "severity": "High",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -5535,65 +4260,63 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess"
+ "DefenseEvasion"
],
"techniques": [
- "T1078"
+ "T1550"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- },
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
{
- "identifier": "AadUserId",
- "columnName": "UserId"
+ "columnName": "InitiatingIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "targetDisplayName",
+ "identifier": "Name"
+ }
+ ],
+ "entityType": "CloudApplication"
}
- ],
- "eventGroupingSettings": {
- "aggregationKind": "SingleAlert"
- },
- "customDetails": {
- "Application": "AppDisplayName"
- },
- "alertDetailsOverride": {
- "alertDisplayNameFormat": "Anomalous sign-in location by {{UserPrincipalName}} to {{AppDisplayName}}",
- "alertDescriptionFormat": "This query over Azure Active Directory sign-in considers all user sign-ins for each Azure Active\nDirectory application and picks out the most anomalous change in location profile for a user within an\nindividual application. This has detected {{UserPrincipalName}} signing into {{AppDisplayName}} from {{CountOfLocations}} \ndifferent locations.\n"
- }
+ ]
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId6'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId27'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 6",
- "parentId": "[variables('analyticRuleId6')]",
- "contentId": "[variables('_analyticRulecontentId6')]",
+ "description": "Azure Active Directory Analytics Rule 27",
+ "parentId": "[variables('analyticRuleId27')]",
+ "contentId": "[variables('_analyticRulecontentId27')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion6')]",
+ "version": "[variables('analyticRuleVersion27')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -5618,43 +4341,43 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId6')]",
+ "contentId": "[variables('_analyticRulecontentId27')]",
"contentKind": "AnalyticsRule",
- "displayName": "Anomalous sign-in location by user account and authenticating application",
- "contentProductId": "[variables('_analyticRulecontentProductId6')]",
- "id": "[variables('_analyticRulecontentProductId6')]",
- "version": "[variables('analyticRuleVersion6')]"
+ "displayName": "First access credential added to Application or Service Principal where no credential was present",
+ "contentProductId": "[variables('_analyticRulecontentProductId27')]",
+ "id": "[variables('_analyticRulecontentProductId27')]",
+ "version": "[variables('analyticRuleVersion27')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName7')]",
+ "name": "[variables('analyticRuleTemplateSpecName28')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AuthenticationMethodsChangedforPrivilegedAccount_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "GuestAccountsAddedinAADGroupsOtherThanTheOnesSpecified_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion7')]",
+ "contentVersion": "[variables('analyticRuleVersion28')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId7')]",
+ "name": "[variables('analyticRulecontentId28')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies authentication methods being changed for a privileged account. This could be an indication of an attacker adding an auth method to the account so they can have continued access.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor-1",
- "displayName": "Authentication Methods Changed for Privileged Account",
+ "description": "Guest Accounts are added in the Organization Tenants to perform various tasks i.e projects execution, support etc.. This detection notifies when guest users are added to Azure AD Groups other than the ones specified and poses a risk to gain access to sensitive apps or data.",
+ "displayName": "Guest accounts added in AAD Groups other than the ones specified",
"enabled": false,
- "query": "let queryperiod = 14d;\nlet queryfrequency = 2h;\nlet security_info_actions = dynamic([\"User registered security info\", \"User changed default security info\", \"User deleted security info\", \"Admin updated security info\", \"User reviewed security info\", \"Admin deleted security info\", \"Admin registered security info\"]);\nlet VIPUsers = (\n IdentityInfo\n | where TimeGenerated > ago(queryperiod)\n | mv-expand AssignedRoles\n | where AssignedRoles contains 'Admin'\n | summarize by AccountUPN);\nAuditLogs\n| where TimeGenerated > ago(queryfrequency)\n| where Category =~ \"UserManagement\"\n| where ActivityDisplayName in (security_info_actions)\n| extend Initiator = tostring(InitiatedBy.user.userPrincipalName)\n| extend IP = tostring(InitiatedBy.user.ipAddress)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = tostring(TargetResource.userPrincipalName)\n )\n| where Target in~ (VIPUsers)\n// Uncomment the line below if you are experiencing high volumes of Target entities. If this is uncommented, the Target column will not be mapped to an entity.\n//| summarize Start=min(TimeGenerated), End=max(TimeGenerated), Actions = make_set(ResultReason, MaxSize=8), Targets=make_set(Target, MaxSize=256) by Initiator, IP, Result\n// Comment out this line below, if line above is used.\n| summarize Start=min(TimeGenerated), End=max(TimeGenerated), Actions = make_set(ResultReason, MaxSize=8) by Initiator, IP, Result, Targets = Target\n| extend InitiatorName = tostring(split(Initiator,'@',0)[0]), \n InitiatorUPNSuffix = tostring(split(Initiator,'@',1)[0]),\n TargetName = iff(tostring(Targets) has \"[\", \"\", tostring(split(Targets,'@',0)[0])), \n TargetUPNSuffix = iff(tostring(Targets) has \"[\", \"\", tostring(split(Targets,'@',1)[0]))\n",
- "queryFrequency": "PT2H",
- "queryPeriod": "P14D",
+ "query": "// OBJECT ID of AAD Groups can be found by navigating to Azure Active Directory then from menu on the left, select Groups and from the list shown of AAD Groups, the Second Column shows the ObjectID of each\nlet GroupIDs = dynamic([\"List with Custom AAD GROUP OBJECT ID 1\",\"Custom AAD GROUP OBJECT ID 2\"]);\nAuditLogs\n| where OperationName in ('Add member to group', 'Add owner to group')\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress \n// Uncomment the following line to filter events where the inviting user was a guest user\n//| where InitiatedBy has_any (\"CUSTOM DOMAIN NAME#\", \"#EXT#\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend InvitedUser = trim(@'\"',tostring(TargetResource.userPrincipalName)),\n Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on \n (\n where Property.displayName =~ \"Group.DisplayName\"\n | extend AADGroup = trim('\"',tostring(Property.newValue))\n )\n| where InvitedUser has_any (\"CUSTOM DOMAIN NAME#\", \"#EXT#\")\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"Group.ObjectID\"\n | extend AADGroupId = trim('\"',tostring(Property.newValue))\n )\n| where AADGroupId !in (GroupIDs)\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P1D",
"severity": "High",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
@@ -5663,53 +4386,53 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "Persistence"
+ "InitialAccess",
+ "Persistence",
+ "Discovery"
],
"techniques": [
- "T1098"
+ "T1078",
+ "T1136",
+ "T1087"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "InitiatorName"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "InitiatorUPNSuffix"
+ "columnName": "InvitedUser",
+ "identifier": "Name"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "TargetName"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "TargetUPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IP"
+ "columnName": "InitiatedByIPAdress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -5717,13 +4440,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId7'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId28'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 7",
- "parentId": "[variables('analyticRuleId7')]",
- "contentId": "[variables('_analyticRulecontentId7')]",
+ "description": "Azure Active Directory Analytics Rule 28",
+ "parentId": "[variables('analyticRuleId28')]",
+ "contentId": "[variables('_analyticRulecontentId28')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion7')]",
+ "version": "[variables('analyticRuleVersion28')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -5748,44 +4471,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId7')]",
+ "contentId": "[variables('_analyticRulecontentId28')]",
"contentKind": "AnalyticsRule",
- "displayName": "Authentication Methods Changed for Privileged Account",
- "contentProductId": "[variables('_analyticRulecontentProductId7')]",
- "id": "[variables('_analyticRulecontentProductId7')]",
- "version": "[variables('analyticRuleVersion7')]"
+ "displayName": "Guest accounts added in AAD Groups other than the ones specified",
+ "contentProductId": "[variables('_analyticRulecontentProductId28')]",
+ "id": "[variables('_analyticRulecontentProductId28')]",
+ "version": "[variables('analyticRuleVersion28')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName8')]",
+ "name": "[variables('analyticRuleTemplateSpecName29')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AzureAADPowerShellAnomaly_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "MailPermissionsAddedToApplication_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion8')]",
+ "contentVersion": "[variables('analyticRuleVersion29')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId8')]",
+ "name": "[variables('analyticRulecontentId29')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This will alert when a user or application signs in using Azure Active Directory PowerShell to access non-Active Directory resources, such as the Azure Key Vault, which may be undesired or unauthorized behavior.\nFor capabilities and expected behavior of the Azure Active Directory PowerShell module, see: https://docs.microsoft.com/powershell/module/azuread/?view=azureadps-2.0.\nFor further information on Azure Active Directory Signin activity reports, see: https://docs.microsoft.com/azure/active-directory/reports-monitoring/concept-sign-ins.",
- "displayName": "Azure Active Directory PowerShell accessing non-AAD resources",
+ "description": "This query look for applications that have been granted (Delegated or App/Role) permissions to Read Mail (Permissions field has Mail.Read) and subsequently has been consented to. This can help identify applications that have been abused to gain access to mailboxes.",
+ "displayName": "Mail.Read Permissions Granted to Application",
"enabled": false,
- "query": "let aadFunc = (tableName:string){\ntable(tableName)\n| where AppId =~ \"1b730954-1685-4b74-9bfd-dac224a7b894\" // AppDisplayName IS Azure Active Directory PowerShell\n| where TokenIssuerType =~ \"AzureAD\"\n| where ResourceIdentity !in (\"00000002-0000-0000-c000-000000000000\", \"00000003-0000-0000-c000-000000000000\") // ResourceDisplayName IS NOT Windows Azure Active Directory OR Microsoft Graph\n| extend Status = todynamic(Status)\n| where Status.errorCode == 0 // Success\n| project-reorder IPAddress, UserAgent, ResourceDisplayName, UserDisplayName, UserId, UserPrincipalName, Type\n| order by TimeGenerated desc\n// New entity mapping\n| extend timestamp = TimeGenerated, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT1H",
- "severity": "Low",
+ "query": "AuditLogs\n| where Category =~ \"ApplicationManagement\"\n| where ActivityDisplayName has_any (\"Add delegated permission grant\",\"Add app role assignment to service principal\") \n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend props = TargetResource.modifiedProperties,\n Type = tostring(TargetResource.type),\n PermissionsAddedTo = tostring(TargetResource.displayName)\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"DelegatedPermissionGrant.Scope\"\n | extend DisplayName = tostring(Property.displayName), Permissions = trim('\"',tostring(Property.newValue))\n )\n| where Permissions has_any (\"Mail.Read\", \"Mail.ReadWrite\")\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName)\n| extend UserIPAddress = tostring(InitiatedBy.user.ipAddress) \n| project-away props, TargetResource*, AdditionalDetail*, Property, InitiatedBy\n| join kind=leftouter(\n AuditLogs\n | where ActivityDisplayName has \"Consent to application\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend AppName = tostring(TargetResource.displayName),\n AppId = tostring(TargetResource.id)\n )\n | project AppName, AppId, CorrelationId) on CorrelationId\n| project-reorder TimeGenerated, OperationName, InitiatingUser, UserIPAddress, UserAgent, PermissionsAddedTo, Permissions, AppName, AppId, CorrelationId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUser,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUser,'@',1)[0])\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P1D",
+ "severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -5793,50 +4516,40 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess"
+ "Persistence"
],
"techniques": [
- "T1078"
+ "T1098"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "AadUserId",
- "columnName": "UserId"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IPAddress"
+ "columnName": "UserIPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -5844,13 +4557,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId8'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId29'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 8",
- "parentId": "[variables('analyticRuleId8')]",
- "contentId": "[variables('_analyticRulecontentId8')]",
+ "description": "Azure Active Directory Analytics Rule 29",
+ "parentId": "[variables('analyticRuleId29')]",
+ "contentId": "[variables('_analyticRulecontentId29')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion8')]",
+ "version": "[variables('analyticRuleVersion29')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -5875,43 +4588,43 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId8')]",
+ "contentId": "[variables('_analyticRulecontentId29')]",
"contentKind": "AnalyticsRule",
- "displayName": "Azure Active Directory PowerShell accessing non-AAD resources",
- "contentProductId": "[variables('_analyticRulecontentProductId8')]",
- "id": "[variables('_analyticRulecontentProductId8')]",
- "version": "[variables('analyticRuleVersion8')]"
+ "displayName": "Mail.Read Permissions Granted to Application",
+ "contentProductId": "[variables('_analyticRulecontentProductId29')]",
+ "id": "[variables('_analyticRulecontentProductId29')]",
+ "version": "[variables('analyticRuleVersion29')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName9')]",
+ "name": "[variables('analyticRuleTemplateSpecName30')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AzureADRoleManagementPermissionGrant_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "MaliciousOAuthApp_O365AttackToolkit_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion9')]",
+ "contentVersion": "[variables('analyticRuleVersion30')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId9')]",
+ "name": "[variables('analyticRulecontentId30')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies when the Microsoft Graph RoleManagement.ReadWrite.Directory (Delegated or Application) permission is granted to a service principal.\nThis permission allows an application to read and manage the role-based access control (RBAC) settings for your company's directory.\nAn adversary could use this permission to add an Azure AD object to an Admin directory role and escalate privileges.\nRef : https://docs.microsoft.com/graph/permissions-reference#role-management-permissions\nRef : https://docs.microsoft.com/graph/api/directoryrole-post-members?view=graph-rest-1.0&tabs=http",
- "displayName": "Azure AD Role Management Permission Grant",
+ "description": "This will alert when a user consents to provide a previously-unknown Azure application with the same OAuth permissions used by the MDSec O365 Attack Toolkit (https://github.com/mdsecactivebreach/o365-attack-toolkit).\nThe default permissions/scope for the MDSec O365 Attack toolkit change sometimes but often include contacts.read, user.read, mail.read, notes.read.all, mailboxsettings.readwrite, files.readwrite.all, mail.send, files.read, and files.read.all.\nConsent to applications with these permissions should be rare, especially as the knownApplications list is expanded, especially as the knownApplications list is expanded. Public contributions to expand this filter are welcome!\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "Suspicious application consent similar to O365 Attack Toolkit",
"enabled": false,
- "query": "AuditLogs\n| where Category =~ \"ApplicationManagement\" and LoggedByService =~ \"Core Directory\" and OperationName in~ (\"Add delegated permission grant\", \"Add app role assignment to service principal\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName in~ (\"AppRole.Value\",\"DelegatedPermissionGrant.Scope\")\n | extend DisplayName = tostring(Property.displayName), PermissionGrant = trim('\"',tostring(Property.newValue))\n )\n| where PermissionGrant has \"RoleManagement.ReadWrite.Directory\"\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"ServicePrincipal.DisplayName\"\n | extend AppDisplayName = trim('\"',tostring(Property.newValue))\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"ServicePrincipal.ObjectID\"\n | extend AppServicePrincipalId = trim('\"',tostring(Property.newValue))\n )\n| extend \n Initiator = iif(isnotempty(InitiatedBy.app), tostring(InitiatedBy.app.displayName), tostring(InitiatedBy.user.userPrincipalName)),\n InitiatorId = iif(isnotempty(InitiatedBy.app), tostring(InitiatedBy.app.servicePrincipalId), tostring(InitiatedBy.user.id))\n| project TimeGenerated, OperationName, Result, PermissionGrant, AppDisplayName, AppServicePrincipalId, Initiator, InitiatorId, InitiatedBy, TargetResources, AdditionalDetails, CorrelationId\n| extend Name = tostring(split(Initiator,'@',0)[0]), UPNSuffix = tostring(split(Initiator,'@',1)[0])\n",
- "queryFrequency": "PT2H",
- "queryPeriod": "PT2H",
+ "query": "let detectionTime = 1d;\nlet joinLookback = 14d;\nlet threshold = 5;\nlet o365_attack_regex = \"contacts.read|user.read|mail.read|notes.read.all|mailboxsettings.readwrite|Files.ReadWrite.All|mail.send|files.read|files.read.all\";\nlet o365_attack = dynamic([\"contacts.read\", \"user.read\", \"mail.read\", \"notes.read.all\", \"mailboxsettings.readwrite\", \"Files.ReadWrite.All\", \"mail.send\", \"files.read\", \"files.read.all\"]);\nAuditLogs\n| where TimeGenerated > ago(detectionTime)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Consent to application\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend AppDisplayName = tostring(TargetResource.displayName),\n AppClientId = tostring(TargetResource.id),\n props = TargetResource.modifiedProperties\n )\n| where AppClientId !in ((externaldata(knownAppClientId:string, knownAppDisplayName:string)[@\"https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/Sample%20Data/Feeds/Microsoft.OAuth.KnownApplications.csv\"] with (format=\"csv\"))) // NOTE: a MATCH from this list will cause the alert to NOT fire - please modify for your environment!\n| mv-apply ConsentFull = props on \n (\n where ConsentFull.displayName =~ \"ConsentAction.Permissions\"\n )\n| parse ConsentFull with * \"ConsentType: \" GrantConsentType \", Scope: \" GrantScope1 \", CreatedDateTime\" * \"]\" *\n| where GrantConsentType != \"AllPrincipals\" // NOTE: we are ignoring if OAuth application was granted to all users via an admin - but admin due diligence should be audited occasionally\n| where ConsentFull has_any (o365_attack) \n| extend GrantScopeCount = countof(tolower(GrantScope1), o365_attack_regex, 'regex')\n| where GrantScopeCount > threshold\n| extend GrantIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| extend GrantInitiatedBy = iff(isnotempty(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend GrantUserAgent = AdditionalDetail.value\n )\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, GrantIpAddress, GrantUserAgent, AppClientId, OperationName, ConsentFull, CorrelationId\n| join kind = leftouter (AuditLogs\n | where TimeGenerated > ago(joinLookback)\n | where LoggedByService =~ \"Core Directory\"\n | where Category =~ \"ApplicationManagement\"\n | where OperationName =~ \"Add service principal\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend props = TargetResource.modifiedProperties,\n AppClientId = tostring(TargetResource.id)\n )\n | mv-apply Property = props on \n (\n where Property.displayName =~ \"AppAddress\" and Property.newValue has \"AddressType\"\n | extend AppReplyURLs = trim('\"',tostring(Property.newValue))\n )\n | distinct AppClientId, tostring(AppReplyURLs)\n) on AppClientId\n| join kind = innerunique (AuditLogs\n | where TimeGenerated > ago(joinLookback)\n | where LoggedByService =~ \"Core Directory\"\n | where Category =~ \"ApplicationManagement\"\n | where OperationName =~ \"Add OAuth2PermissionGrant\" or OperationName =~ \"Add delegated permission grant\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend GrantAuthentication = tostring(TargetResource.displayName)\n )\n | extend GrantOperation = OperationName\n | project GrantAuthentication, GrantOperation, CorrelationId\n ) on CorrelationId\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, AppReplyURLs, GrantIpAddress, GrantUserAgent, AppClientId, GrantAuthentication, OperationName, GrantOperation, CorrelationId, ConsentFull\n| extend timestamp = TimeGenerated, Name = tostring(split(GrantInitiatedBy,'@',0)[0]), UPNSuffix = tostring(split(GrantInitiatedBy,'@',1)[0])\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P14D",
"severity": "High",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
@@ -5920,42 +4633,51 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "Persistence",
- "Impact"
+ "CredentialAccess",
+ "DefenseEvasion"
],
"techniques": [
- "T1098",
- "T1078"
+ "T1528",
+ "T1550"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "GrantIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
},
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "AppDisplayName"
+ "columnName": "AppDisplayName",
+ "identifier": "Name"
}
- ]
+ ],
+ "entityType": "CloudApplication"
}
]
}
@@ -5963,13 +4685,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId9'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId30'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 9",
- "parentId": "[variables('analyticRuleId9')]",
- "contentId": "[variables('_analyticRulecontentId9')]",
+ "description": "Azure Active Directory Analytics Rule 30",
+ "parentId": "[variables('analyticRuleId30')]",
+ "contentId": "[variables('_analyticRulecontentId30')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion9')]",
+ "version": "[variables('analyticRuleVersion30')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -5994,43 +4716,43 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId9')]",
+ "contentId": "[variables('_analyticRulecontentId30')]",
"contentKind": "AnalyticsRule",
- "displayName": "Azure AD Role Management Permission Grant",
- "contentProductId": "[variables('_analyticRulecontentProductId9')]",
- "id": "[variables('_analyticRulecontentProductId9')]",
- "version": "[variables('analyticRuleVersion9')]"
+ "displayName": "Suspicious application consent similar to O365 Attack Toolkit",
+ "contentProductId": "[variables('_analyticRulecontentProductId30')]",
+ "id": "[variables('_analyticRulecontentProductId30')]",
+ "version": "[variables('analyticRuleVersion30')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName10')]",
+ "name": "[variables('analyticRuleTemplateSpecName31')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "AzurePortalSigninfromanotherAzureTenant_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "MaliciousOAuthApp_PwnAuth_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion10')]",
+ "contentVersion": "[variables('analyticRuleVersion31')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId10')]",
+ "name": "[variables('analyticRulecontentId31')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This query looks for successful sign in attempts to the Azure Portal where the user who is signing in from another Azure tenant,\n and the IP address the login attempt is from is an Azure IP. A threat actor who compromises an Azure tenant may look\n to pivot to other tenants leveraging cross-tenant delegated access in this manner.",
- "displayName": "Azure Portal sign in from another Azure Tenant",
+ "description": "This will alert when a user consents to provide a previously-unknown Azure application with the same OAuth permissions used by the FireEye PwnAuth toolkit (https://github.com/fireeye/PwnAuth).\nThe default permissions/scope for the PwnAuth toolkit are user.read, offline_access, mail.readwrite, mail.send, and files.read.all.\nConsent to applications with these permissions should be rare, especially as the knownApplications list is expanded. Public contributions to expand this filter are welcome!\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "Suspicious application consent similar to PwnAuth",
"enabled": false,
- "query": "// Get details of current Azure Ranges (note this URL updates regularly so will need to be manually updated over time)\n// You may find the name of the new JSON here: https://www.microsoft.com/download/details.aspx?id=56519\n// On the downloads page, click the 'details' button, and then replace just the filename in the URL below\nlet azure_ranges = externaldata(changeNumber: string, cloud: string, values: dynamic)\n[\"https://raw.githubusercontent.com/microsoft/mstic/master/PublicFeeds/MSFTIPRanges/ServiceTags_Public.json\"] with(format='multijson')\n| mv-expand values\n| mv-expand values.properties.addressPrefixes\n| mv-expand values_properties_addressPrefixes\n| summarize by tostring(values_properties_addressPrefixes)\n| extend isipv4 = parse_ipv4(values_properties_addressPrefixes)\n| extend isipv6 = parse_ipv6(values_properties_addressPrefixes)\n| extend ip_type = case(isnotnull(isipv4), \"v4\", \"v6\")\n| summarize make_list(values_properties_addressPrefixes) by ip_type\n;\nSigninLogs\n// Limiting to Azure Portal really reduces false positives and helps focus on potential admin activity\n| where ResultType == 0\n| where AppDisplayName =~ \"Azure Portal\"\n| extend isipv4 = parse_ipv4(IPAddress)\n| extend ip_type = case(isnotnull(isipv4), \"v4\", \"v6\")\n // Only get logons where the IP address is in an Azure range\n| join kind=fullouter (azure_ranges) on ip_type\n| extend ipv6_match = ipv6_is_in_any_range(IPAddress, list_values_properties_addressPrefixes)\n| extend ipv4_match = ipv4_is_in_any_range(IPAddress, list_values_properties_addressPrefixes)\n| where ipv4_match or ipv6_match \n// Limit to where the user is external to the tenant\n| where HomeTenantId != ResourceTenantId\n// Further limit it to just access to the current tenant (you can drop this if you wanted to look elsewhere as well but it helps reduce FPs)\n| where ResourceTenantId == AADTenantId\n| summarize FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated), make_set(ResourceDisplayName) by UserPrincipalName, IPAddress, UserAgent, Location, HomeTenantId, ResourceTenantId, UserId\n| extend AccountName = split(UserPrincipalName, \"@\")[0]\n| extend UPNSuffix = split(UserPrincipalName, \"@\")[1]\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT1H",
+ "query": "let detectionTime = 1d;\nlet joinLookback = 14d;\nAuditLogs\n| where TimeGenerated > ago(detectionTime)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Consent to application\"\n| where TargetResources has \"offline\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend AppDisplayName = tostring(TargetResource.displayName),\n AppClientId = tostring(TargetResource.id),\n props = TargetResource.modifiedProperties\n )\n| where AppClientId !in ((externaldata(knownAppClientId:string, knownAppDisplayName:string)[@\"https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/Sample%20Data/Feeds/Microsoft.OAuth.KnownApplications.csv\"] with (format=\"csv\")))\n| mv-apply ConsentFull = props on \n (\n where ConsentFull.displayName =~ \"ConsentAction.Permissions\"\n )\n| parse ConsentFull with * \"ConsentType: \" GrantConsentType \", Scope: \" GrantScope1 \"]\" *\n| where ConsentFull has_all (\"user.read\", \"offline_access\", \"mail.readwrite\", \"mail.send\", \"files.read.all\")\n| where GrantConsentType != \"AllPrincipals\" // NOTE: we are ignoring if OAuth application was granted to all users via an admin - but admin due diligence should be audited occasionally\n| extend GrantIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| extend GrantInitiatedBy = iff(isnotempty(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend GrantUserAgent = AdditionalDetail.value\n )\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, GrantIpAddress, GrantUserAgent, AppClientId, OperationName, ConsentFull, CorrelationId\n| join kind = leftouter (AuditLogs\n| where TimeGenerated > ago(joinLookback)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Add service principal\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend props = TargetResource.modifiedProperties,\n AppClientId = tostring(TargetResource.id)\n )\n | mv-apply Property = props on \n (\n where Property.displayName =~ \"AppAddress\" and Property.newValue has \"AddressType\"\n | extend AppReplyURLs = trim('\"',tostring(Property.newValue))\n )\n| distinct AppClientId, tostring(AppReplyURLs)\n)\non AppClientId\n| join kind = innerunique (AuditLogs\n| where TimeGenerated > ago(joinLookback)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Add OAuth2PermissionGrant\" or OperationName =~ \"Add delegated permission grant\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend GrantAuthentication = tostring(TargetResource.displayName)\n )\n| extend GrantOperation = OperationName\n| project GrantAuthentication, GrantOperation, CorrelationId\n) on CorrelationId\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, AppReplyURLs, GrantIpAddress, GrantUserAgent, AppClientId, GrantAuthentication, OperationName, GrantOperation, CorrelationId, ConsentFull\n| extend timestamp = TimeGenerated, Name = tostring(split(GrantInitiatedBy,'@',0)[0]), UPNSuffix = tostring(split(GrantInitiatedBy,'@',1)[0])\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P14D",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
@@ -6039,62 +4761,56 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "SigninLogs"
- ]
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess"
+ "CredentialAccess",
+ "DefenseEvasion"
],
"techniques": [
- "T1199"
+ "T1528",
+ "T1550"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "AccountName"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- },
- {
- "identifier": "AadUserId",
- "columnName": "UserId"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IPAddress"
+ "columnName": "GrantIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
- ],
- "alertDetailsOverride": {
- "alertDisplayNameFormat": "Azure Portal sign in by {{UserPrincipalName}} from another Azure Tenant with IP Address {{IPAddress}}",
- "alertDescriptionFormat": "This query looks for successful sign in attempts to the Azure Portal where the user who is signing in from another Azure tenant,\nand the IP address the login attempt is from is an Azure IP. A threat actor who compromises an Azure tenant may look\nto pivot to other tenants leveraging cross-tenant delegated access in this manner.\nIn this instance {{UserPrincipalName}} logged in at {{FirstSeen}} from IP Address {{IPAddress}}.\n"
- }
+ ]
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId10'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId31'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 10",
- "parentId": "[variables('analyticRuleId10')]",
- "contentId": "[variables('_analyticRulecontentId10')]",
+ "description": "Azure Active Directory Analytics Rule 31",
+ "parentId": "[variables('analyticRuleId31')]",
+ "contentId": "[variables('_analyticRulecontentId31')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion10')]",
+ "version": "[variables('analyticRuleVersion31')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -6119,43 +4835,43 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId10')]",
+ "contentId": "[variables('_analyticRulecontentId31')]",
"contentKind": "AnalyticsRule",
- "displayName": "Azure Portal sign in from another Azure Tenant",
- "contentProductId": "[variables('_analyticRulecontentProductId10')]",
- "id": "[variables('_analyticRulecontentProductId10')]",
- "version": "[variables('analyticRuleVersion10')]"
+ "displayName": "Suspicious application consent similar to PwnAuth",
+ "contentProductId": "[variables('_analyticRulecontentProductId31')]",
+ "id": "[variables('_analyticRulecontentProductId31')]",
+ "version": "[variables('analyticRuleVersion31')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName11')]",
+ "name": "[variables('analyticRuleTemplateSpecName32')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Brute Force Attack against GitHub Account_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "MFARejectedbyUser_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion11')]",
+ "contentVersion": "[variables('analyticRuleVersion32')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId11')]",
+ "name": "[variables('analyticRulecontentId32')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Attackers who are trying to guess your users' passwords or use brute-force methods to get in. If your organization is using SSO with Azure Active Directory, authentication logs to GitHub.com will be generated. Using the following query can help you identify a sudden increase in failed logon attempt of users.",
- "displayName": "Brute Force Attack against GitHub Account",
+ "description": "Identifies occurances where a user has rejected an MFA prompt. This could be an indicator that a threat actor has compromised the username and password of this user account and is using it to try and log into the account.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#monitoring-for-failed-unusual-sign-ins\nThis query has also been updated to include UEBA logs IdentityInfo and BehaviorAnalytics for contextual information around the results.",
+ "displayName": "MFA Rejected by User",
"enabled": false,
- "query": "let LearningPeriod = 7d;\nlet BinTime = 1h;\nlet RunTime = 1h;\nlet StartTime = 1h; \nlet sensitivity = 2.5;\nlet EndRunTime = StartTime - RunTime;\nlet EndLearningTime = StartTime + LearningPeriod;\nlet aadFunc = (tableName:string){\ntable(tableName) \n| where TimeGenerated between (ago(EndLearningTime) .. ago(EndRunTime))\n| where AppDisplayName =~ \"GitHub.com\"\n| where ResultType != 0\n| make-series FailedLogins = count() on TimeGenerated from ago(LearningPeriod) to ago(EndRunTime) step BinTime by UserPrincipalName, Type\n| extend (Anomalies, Score, Baseline) = series_decompose_anomalies(FailedLogins, sensitivity, -1, 'linefit')\n| mv-expand FailedLogins to typeof(double), TimeGenerated to typeof(datetime), Anomalies to typeof(double), Score to typeof(double), Baseline to typeof(long) \n| where TimeGenerated >= ago(RunTime)\n| where Anomalies > 0 and Baseline > 0\n| join kind=inner (\n table(tableName) \n | where TimeGenerated between (ago(StartTime) .. ago(EndRunTime))\n | where AppDisplayName =~ \"GitHub.com\"\n | where ResultType != 0\n | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), IPAddresses = make_set(IPAddress,100), Locations = make_set(LocationDetails,20), Devices = make_set(DeviceDetail,20) by UserPrincipalName \n ) on UserPrincipalName\n| extend timestamp = TimeGenerated, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
+ "query": "let riskScoreCutoff = 20; //Adjust this based on volume of results\nSigninLogs\n| where ResultType == 500121\n| extend additionalDetails_ = tostring(Status.additionalDetails)\n| extend UserPrincipalName = tolower(UserPrincipalName)\n| where additionalDetails_ =~ \"MFA denied; user declined the authentication\" or additionalDetails_ has \"fraud\"\n| summarize StartTime = min(TimeGenerated), EndTIme = max(TimeGenerated) by UserPrincipalName, UserId, AADTenantId, IPAddress\n| extend Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n| join kind=leftouter (\n IdentityInfo\n | summarize LatestReportTime = arg_max(TimeGenerated, *) by AccountUPN\n | extend BlastRadiusInt = iif(BlastRadius == \"High\", 1, 0)\n | project AccountUPN, Tags, JobTitle, GroupMembership, AssignedRoles, UserType, IsAccountEnabled, BlastRadiusInt\n | summarize\n Tags = make_set(Tags, 1000),\n GroupMembership = make_set(GroupMembership, 1000),\n AssignedRoles = make_set(AssignedRoles, 1000),\n BlastRadiusInt = sum(BlastRadiusInt),\n UserType = make_set(UserType, 1000),\n UserAccountControl = make_set(UserType, 1000)\n by AccountUPN\n | extend UserPrincipalName=tolower(AccountUPN)\n) on UserPrincipalName\n| join kind=leftouter (\n BehaviorAnalytics\n | where ActivityType in (\"FailedLogOn\", \"LogOn\")\n | where isnotempty(SourceIPAddress)\n | project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress\n | project-rename IPAddress = SourceIPAddress\n | summarize\n UsersInsights = make_set(UsersInsights, 1000),\n DevicesInsights = make_set(DevicesInsights, 1000),\n IPInvestigationPriority = sum(InvestigationPriority)\n by IPAddress)\non IPAddress\n| extend UEBARiskScore = BlastRadiusInt + IPInvestigationPriority\n| where UEBARiskScore > riskScoreCutoff\n| sort by UEBARiskScore desc \n",
"queryFrequency": "PT1H",
- "queryPeriod": "P7D",
+ "queryPeriod": "PT1H",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
@@ -6164,37 +4880,56 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"SigninLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
},
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
+ "BehaviorAnalytics"
+ ],
+ "connectorId": "BehaviorAnalytics"
+ },
+ {
+ "dataTypes": [
+ "IdentityInfo"
+ ],
+ "connectorId": "IdentityInfo"
}
],
"tactics": [
- "CredentialAccess"
+ "InitialAccess"
],
"techniques": [
- "T1110"
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
+ },
+ {
+ "columnName": "UserId",
+ "identifier": "AadUserId"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -6202,13 +4937,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId11'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId32'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 11",
- "parentId": "[variables('analyticRuleId11')]",
- "contentId": "[variables('_analyticRulecontentId11')]",
+ "description": "Azure Active Directory Analytics Rule 32",
+ "parentId": "[variables('analyticRuleId32')]",
+ "contentId": "[variables('_analyticRulecontentId32')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion11')]",
+ "version": "[variables('analyticRuleVersion32')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -6233,43 +4968,43 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId11')]",
+ "contentId": "[variables('_analyticRulecontentId32')]",
"contentKind": "AnalyticsRule",
- "displayName": "Brute Force Attack against GitHub Account",
- "contentProductId": "[variables('_analyticRulecontentProductId11')]",
- "id": "[variables('_analyticRulecontentProductId11')]",
- "version": "[variables('analyticRuleVersion11')]"
+ "displayName": "MFA Rejected by User",
+ "contentProductId": "[variables('_analyticRulecontentProductId32')]",
+ "id": "[variables('_analyticRulecontentProductId32')]",
+ "version": "[variables('analyticRuleVersion32')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName12')]",
+ "name": "[variables('analyticRuleTemplateSpecName33')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "BruteForceCloudPC_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "MultipleAdmin_membership_removals_from_NewAdmin_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion12')]",
+ "contentVersion": "[variables('analyticRuleVersion33')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId12')]",
+ "name": "[variables('analyticRulecontentId33')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies evidence of brute force activity against a Windows 365 Cloud PC by highlighting multiple authentication failures and by a successful authentication within a given time window.",
- "displayName": "Brute force attack against a Cloud PC",
+ "description": "This query detects when newly created Global admin removes multiple existing global admins which can be an attempt by adversaries to lock down organization and retain sole access. \n Investigate reasoning and intention of multiple membership removal by new Global admins and take necessary actions accordingly.",
+ "displayName": "Multiple admin membership removals from newly created admin.",
"enabled": false,
- "query": "let authenticationWindow = 20m;\nlet sensitivity = 2.5;\nSigninLogs\n| where AppDisplayName =~ \"Windows Sign In\"\n| extend FailureOrSuccess = iff(ResultType in (\"0\", \"50125\", \"50140\", \"70043\", \"70044\"), \"Success\", \"Failure\")\n| summarize FailureCount = countif(FailureOrSuccess==\"Failure\"), SuccessCount = countif(FailureOrSuccess==\"Success\"), IPAddresses = make_set(IPAddress,1000)\n by bin(TimeGenerated, authenticationWindow), UserDisplayName, UserPrincipalName\n| extend FailureSuccessDiff = FailureCount - SuccessCount\n| where FailureSuccessDiff > 0\n| summarize Diff = make_list(FailureSuccessDiff, 10000), TimeStamp = make_list(TimeGenerated, 10000) by UserDisplayName, UserPrincipalName//, tostring(IPAddresses)\n| extend (Anomalies, Score, Baseline) = series_decompose_anomalies(Diff, sensitivity, -1, 'linefit') \n| mv-expand Diff to typeof(double), TimeStamp to typeof(datetime), Anomalies to typeof(double), Score to typeof(double), Baseline to typeof(long)\n| where Anomalies > 0\n| summarize by UserDisplayName, UserPrincipalName\n| join kind=leftouter (\n SigninLogs\n | where AppDisplayName =~ \"Windows Sign In\"\n | extend OS = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser\n | extend StatusCode = tostring(Status.errorCode), StatusDetails = tostring(Status.additionalDetails)\n | extend State = tostring(LocationDetails.state), City = tostring(LocationDetails.city)\n | summarize StartTime = min(TimeGenerated), \n EndTime = max(TimeGenerated), \n IPAddress = make_set(IPAddress,100), \n OS = make_set(OS,20), \n Browser = make_set(Browser,20), \n City = make_set(City,100), \n ResultType = make_set(ResultType,100)\n by UserDisplayName, UserPrincipalName\n ) on UserDisplayName, UserPrincipalName\n| extend IPAddressFirst = IPAddress[0]\n| extend timestamp = StartTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P1D",
+ "query": "let lookback = 7d; \nlet timeframe = 1h; \nlet GlobalAdminsRemoved = AuditLogs \n| where TimeGenerated > ago(timeframe) \n| where Category =~ \"RoleManagement\" \n| where AADOperationType in (\"Unassign\", \"RemoveEligibleRole\") \n| where ActivityDisplayName has_any (\"Remove member from role\", \"Remove eligible member from role\") \n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = tostring(TargetResource.userPrincipalName),\n props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"Role.DisplayName\"\n | extend RoleName = trim('\"',tostring(Property.oldValue))\n )\n| where RoleName =~ \"Global Administrator\" // Add other Privileged role if applicable \n| extend InitiatingApp = tostring(InitiatedBy.app.displayName) \n| extend Initiator = iif(isnotempty(InitiatingApp), InitiatingApp, tostring(InitiatedBy.user.userPrincipalName)) \n| where Initiator != \"MS-PIM\" // Filtering PIM events \n| summarize RemovedGlobalAdminTime = max(TimeGenerated), TargetAdmins = make_set(Target,100) by OperationName, RoleName, Initiator, Result; \nlet GlobalAdminsAdded = AuditLogs \n| where TimeGenerated > ago(lookback) \n| where Category =~ \"RoleManagement\" \n| where AADOperationType in (\"Assign\", \"AssignEligibleRole\") \n| where ActivityDisplayName has_any (\"Add eligible member to role\", \"Add member to role\") and Result == \"success\" \n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = tostring(TargetResource.userPrincipalName),\n props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"Role.DisplayName\"\n | extend RoleName = trim('\"',tostring(Property.newValue))\n )\n| where RoleName =~ \"Global Administrator\" // Add other Privileged role if applicable \n| extend InitiatingApp = tostring(InitiatedBy.app.displayName) \n| extend Initiator = iif(isnotempty(InitiatingApp), InitiatingApp, tostring(InitiatedBy.user.userPrincipalName)) \n| where Initiator != \"MS-PIM\" // Filtering PIM events \n| summarize AddedGlobalAdminTime = max(TimeGenerated) by OperationName, RoleName, Target, Initiator, Result \n| extend AccountCustomEntity = Target; \nGlobalAdminsAdded \n| join kind= inner GlobalAdminsRemoved on $left.Target == $right.Initiator \n| where AddedGlobalAdminTime < RemovedGlobalAdminTime \n| extend NoofAdminsRemoved = array_length(TargetAdmins) \n| where NoofAdminsRemoved > 1\n| project AddedGlobalAdminTime, Initiator, Target, AccountCustomEntity, RemovedGlobalAdminTime, TargetAdmins, NoofAdminsRemoved\n| extend Name = tostring(split(AccountCustomEntity,'@',0)[0]), UPNSuffix = tostring(split(AccountCustomEntity,'@',1)[0])\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "P7D",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
@@ -6278,40 +5013,31 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "SigninLogs"
- ]
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "CredentialAccess"
+ "Impact"
],
"techniques": [
- "T1110"
+ "T1531"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IPAddressFirst"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
}
]
}
@@ -6319,13 +5045,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId12'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId33'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 12",
- "parentId": "[variables('analyticRuleId12')]",
- "contentId": "[variables('_analyticRulecontentId12')]",
+ "description": "Azure Active Directory Analytics Rule 33",
+ "parentId": "[variables('analyticRuleId33')]",
+ "contentId": "[variables('_analyticRulecontentId33')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion12')]",
+ "version": "[variables('analyticRuleVersion33')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -6350,44 +5076,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId12')]",
+ "contentId": "[variables('_analyticRulecontentId33')]",
"contentKind": "AnalyticsRule",
- "displayName": "Brute force attack against a Cloud PC",
- "contentProductId": "[variables('_analyticRulecontentProductId12')]",
- "id": "[variables('_analyticRulecontentProductId12')]",
- "version": "[variables('analyticRuleVersion12')]"
+ "displayName": "Multiple admin membership removals from newly created admin.",
+ "contentProductId": "[variables('_analyticRulecontentProductId33')]",
+ "id": "[variables('_analyticRulecontentProductId33')]",
+ "version": "[variables('analyticRuleVersion33')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName13')]",
+ "name": "[variables('analyticRuleTemplateSpecName34')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "BulkChangestoPrivilegedAccountPermissions_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "NewAppOrServicePrincipalCredential_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion13')]",
+ "contentVersion": "[variables('analyticRuleVersion34')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId13')]",
+ "name": "[variables('analyticRulecontentId34')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies when changes to multiple users permissions are changed at once. Investigate immediately if not a planned change. This setting could enable an attacker access to Azure subscriptions in your environment.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-identity-management",
- "displayName": "Bulk Changes to Privileged Account Permissions",
+ "description": "This will alert when an admin or app owner account adds a new credential to an Application or Service Principal where a verify KeyCredential was already present for the app.\nIf a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\nAdditional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "New access credential added to Application or Service Principal",
"enabled": false,
- "query": "let AdminRecords = AuditLogs\n| where Category =~ \"RoleManagement\"\n| where ActivityDisplayName has_any (\"Add eligible member to role\", \"Add member to role\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = tostring(TargetResource.userPrincipalName),\n props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"Role.DisplayName\"\n | extend RoleName = trim('\"',tostring(Property.newValue))\n )\n| where RoleName contains \"Admin\";\nAdminRecords\n| summarize dcount(Target) by bin(TimeGenerated, 1h)\n| where dcount_Target > 9\n| join kind=rightsemi (\n AdminRecords\n | extend TimeWindow = bin(TimeGenerated, 1h)\n) on $left.TimeGenerated == $right.TimeWindow\n| extend InitiatedByUser = iff(isnotempty(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.user.userPrincipalName), \"\")\n| extend TargetName = tostring(split(Target,'@',0)[0]), TargetUPNSuffix = tostring(split(Target,'@',1)[0]),\n InitiatedByUserName = tostring(split(InitiatedByUser,'@',0)[0]), InitiatedByUserUPNSuffix = tostring(split(InitiatedByUser,'@',1)[0])\n",
- "queryFrequency": "PT2H",
- "queryPeriod": "PT2H",
- "severity": "High",
+ "query": "AuditLogs\n| where OperationName has_any (\"Add service principal\", \"Certificates and secrets management\") // captures \"Add service principal\", \"Add service principal credentials\", and \"Update application - Certificates and secrets management\" events\n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"Application\"\n | extend targetDisplayName = tostring(TargetResource.displayName),\n targetId = tostring(TargetResource.id),\n targetType = tostring(TargetResource.type),\n keyEvents = TargetResource.modifiedProperties\n )\n| mv-apply Property = keyEvents on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend new_value_set = parse_json(tostring(Property.newValue)),\n old_value_set = parse_json(tostring(Property.oldValue))\n )\n| where old_value_set != \"[]\"\n| extend diff = set_difference(new_value_set, old_value_set)\n| where isnotempty(diff)\n| parse diff with * \"KeyIdentifier=\" keyIdentifier:string \",KeyType=\" keyType:string \",KeyUsage=\" keyUsage:string \",DisplayName=\" keyDisplayName:string \"]\" *\n| where keyUsage =~ \"Verify\"\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n// The below line is currently commented out but Microsoft Sentinel users can modify this query to show only Application or only Service Principal events in their environment\n//| where targetType =~ \"Application\" // or targetType =~ \"ServicePrincipal\"\n| project-away diff, new_value_set, old_value_set\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, InitiatingIpAddress, UserAgent, targetDisplayName, targetId, targetType, keyDisplayName, keyType, keyUsage, keyIdentifier, CorrelationId, TenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "PT1H",
+ "severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -6395,62 +5121,54 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "PrivilegeEscalation"
+ "DefenseEvasion"
],
"techniques": [
- "T1078"
+ "T1550"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "TargetName"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "TargetUPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "InitiatedByUserName"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "InitiatedByUserUPNSuffix"
+ "columnName": "InitiatingIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
- ],
- "customDetails": {
- "TargetUser": "Target",
- "InitiatedByUser": "InitiatedByUser"
- }
+ ]
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId13'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId34'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 13",
- "parentId": "[variables('analyticRuleId13')]",
- "contentId": "[variables('_analyticRulecontentId13')]",
+ "description": "Azure Active Directory Analytics Rule 34",
+ "parentId": "[variables('analyticRuleId34')]",
+ "contentId": "[variables('_analyticRulecontentId34')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion13')]",
+ "version": "[variables('analyticRuleVersion34')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -6475,93 +5193,78 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId13')]",
+ "contentId": "[variables('_analyticRulecontentId34')]",
"contentKind": "AnalyticsRule",
- "displayName": "Bulk Changes to Privileged Account Permissions",
- "contentProductId": "[variables('_analyticRulecontentProductId13')]",
- "id": "[variables('_analyticRulecontentProductId13')]",
- "version": "[variables('analyticRuleVersion13')]"
+ "displayName": "New access credential added to Application or Service Principal",
+ "contentProductId": "[variables('_analyticRulecontentProductId34')]",
+ "id": "[variables('_analyticRulecontentProductId34')]",
+ "version": "[variables('analyticRuleVersion34')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName14')]",
+ "name": "[variables('analyticRuleTemplateSpecName35')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "BypassCondAccessRule_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "NRT_ADFSDomainTrustMods_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion14')]",
+ "contentVersion": "[variables('analyticRuleVersion35')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId14')]",
+ "name": "[variables('analyticRulecontentId35')]",
"apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
+ "kind": "NRT",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies an attempt to Bypass conditional access rule(s) in Azure Active Directory.\nThe ConditionalAccessStatus column value details if there was an attempt to bypass Conditional Access\nor if the Conditional access rule was not satisfied (ConditionalAccessStatus == 1).\nReferences:\nhttps://docs.microsoft.com/azure/active-directory/conditional-access/overview\nhttps://docs.microsoft.com/azure/active-directory/reports-monitoring/concept-sign-ins\nhttps://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\nConditionalAccessStatus == 0 // Success\nConditionalAccessStatus == 1 // Failure\nConditionalAccessStatus == 2 // Not Applied\nConditionalAccessStatus == 3 // unknown",
- "displayName": "Attempt to bypass conditional access rule in Azure AD",
+ "description": "This will alert when a user or application modifies the federation settings on the domain or Update domain authentication from Managed to Federated.\nFor example, this alert will trigger when a new Active Directory Federated Service (ADFS) TrustedRealm object, such as a signing certificate, is added to the domain.\nModification to domain federation settings should be rare. Confirm the added or modified target domain/URL is legitimate administrator behavior.\nTo understand why an authorized user may update settings for a federated domain in Office 365, Azure, or Intune, see: https://docs.microsoft.com/office365/troubleshoot/active-directory/update-federated-domain-office-365.\nFor details on security realms that accept security tokens, see the ADFS Proxy Protocol (MS-ADFSPP) specification: https://docs.microsoft.com/openspecs/windows_protocols/ms-adfspp/e7b9ea73-1980-4318-96a6-da559486664b.\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "NRT Modified domain federation trust settings",
"enabled": false,
- "query": "let threshold = 1; // Modify this threshold value to reduce false positives based on your environment\nlet aadFunc = (tableName:string){\ntable(tableName)\n| where ConditionalAccessStatus == 1 or ConditionalAccessStatus =~ \"failure\"\n| mv-apply CAP = parse_json(ConditionalAccessPolicies) on (\n project ConditionalAccessPoliciesName = CAP.displayName, result = CAP.result\n | where result =~ \"failure\"\n)\n| extend DeviceDetail = todynamic(DeviceDetail), Status = todynamic(Status), LocationDetails = todynamic(LocationDetails)\n| extend OS = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser\n| extend State = tostring(LocationDetails.state), City = tostring(LocationDetails.city), Region = tostring(LocationDetails.countryOrRegion)\n| extend StatusCode = tostring(Status.errorCode), StatusDetails = tostring(Status.additionalDetails)\n| extend Status = strcat(StatusCode, \": \", ResultDescription)\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), Status = make_list(Status,10), StatusDetails = make_list(StatusDetails,50), IPAddresses = make_list(IPAddress,100), IPAddressCount = dcount(IPAddress), CorrelationIds = make_list(CorrelationId,100), ConditionalAccessPoliciesName = make_list(ConditionalAccessPoliciesName,100)\nby UserPrincipalName, AppDisplayName, tostring(Browser), tostring(OS), City, State, Region, Type\n| where IPAddressCount > threshold and StatusDetails !has \"MFA successfully completed\"\n| mv-expand IPAddresses, Status, StatusDetails, CorrelationIds\n| extend Status = strcat(Status, \" \", StatusDetails)\n| summarize IPAddresses = make_set(IPAddresses,100), Status = make_set(Status,10), CorrelationIds = make_set(CorrelationIds,100), ConditionalAccessPoliciesName = make_set(ConditionalAccessPoliciesName,100)\nby StartTime, EndTime, UserPrincipalName, AppDisplayName, tostring(Browser), tostring(OS), City, State, Region, IPAddressCount, Type\n| extend timestamp = StartTime, IPAddresses = tostring(IPAddresses), Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P1D",
- "severity": "Low",
+ "query": "AuditLogs\n| where OperationName =~ \"Set federation settings on domain\" or OperationName =~ \"Set domain authentication\"\n//| where Result =~ \"success\" // commenting out, as it may be interesting to capture failed attempts\n| mv-expand TargetResources\n| extend modifiedProperties = parse_json(TargetResources).modifiedProperties\n| mv-apply Property = modifiedProperties on \n (\n where Property.displayName =~ \"LiveType\"\n | extend targetDisplayName = tostring(Property.displayName),\n NewDomainValue = tostring(Property.newValue)\n )\n| extend Federated = iif(OperationName =~ \"Set domain authentication\", iif(NewDomainValue has \"Federated\", True, False), True)\n| where Federated == True\n| mv-expand AdditionalDetails\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, AADOperationType, targetDisplayName, Result, InitiatingIpAddress, UserAgent, CorrelationId, TenantId, AADTenantId\n| extend Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
+ "severity": "High",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess",
- "Persistence"
- ],
- "techniques": [
- "T1078",
- "T1098"
+ "CredentialAccess"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IPAddresses"
+ "columnName": "InitiatingIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -6569,13 +5272,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId14'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId35'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 14",
- "parentId": "[variables('analyticRuleId14')]",
- "contentId": "[variables('_analyticRulecontentId14')]",
+ "description": "Azure Active Directory Analytics Rule 35",
+ "parentId": "[variables('analyticRuleId35')]",
+ "contentId": "[variables('_analyticRulecontentId35')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion14')]",
+ "version": "[variables('analyticRuleVersion35')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -6600,82 +5303,81 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId14')]",
+ "contentId": "[variables('_analyticRulecontentId35')]",
"contentKind": "AnalyticsRule",
- "displayName": "Attempt to bypass conditional access rule in Azure AD",
- "contentProductId": "[variables('_analyticRulecontentProductId14')]",
- "id": "[variables('_analyticRulecontentProductId14')]",
- "version": "[variables('analyticRuleVersion14')]"
+ "displayName": "NRT Modified domain federation trust settings",
+ "contentProductId": "[variables('_analyticRulecontentProductId35')]",
+ "id": "[variables('_analyticRulecontentProductId35')]",
+ "version": "[variables('analyticRuleVersion35')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName15')]",
+ "name": "[variables('analyticRuleTemplateSpecName36')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "CredentialAddedAfterAdminConsent_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "NRT_AuthenticationMethodsChangedforVIPUsers_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion15')]",
+ "contentVersion": "[variables('analyticRuleVersion36')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId15')]",
+ "name": "[variables('analyticRulecontentId36')]",
"apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
+ "kind": "NRT",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This query will identify instances where Service Principal credentials were added to an application by one user after the application was granted admin consent rights by another user.\n If a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\n Additional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow.\n For further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities",
- "displayName": "Credential added after admin consented to Application",
+ "description": "Identifies authentication methods being changed for a list of VIP users watchlist. This could be an indication of an attacker adding an auth method to the account so they can have continued access.",
+ "displayName": "NRT Authentication Methods Changed for VIP Users",
"enabled": false,
- "query": "let auditLookbackStart = 2d;\nlet auditLookbackEnd = 1d;\nAuditLogs\n| where TimeGenerated >= ago(auditLookbackStart)\n| where OperationName =~ \"Consent to application\" \n| where Result =~ \"success\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend targetResourceName = tostring(TargetResource.displayName),\n targetResourceID = tostring(TargetResource.id),\n targetResourceType = tostring(TargetResource.type),\n targetModifiedProp = TargetResource.modifiedProperties\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"ConsentContext.IsAdminConsent\"\n | extend isAdminConsent = trim(@'\"',tostring(Property.newValue))\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"ConsentAction.Permissions\"\n | extend Consent_Permissions = trim(@'\"',tostring(Property.newValue))\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"TargetId.ServicePrincipalNames\"\n | extend Consent_ServicePrincipalNames = tostring(extract_all(@\"([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\",trim(@'\"',tostring(Property.newValue)))[0])\n )\n| extend Consent_InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend Consent_InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| join ( \nAuditLogs\n| where TimeGenerated >= ago(auditLookbackEnd)\n| where OperationName =~ \"Add service principal credentials\"\n| where Result =~ \"success\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend targetResourceName = tostring(TargetResource.displayName),\n targetResourceID = tostring(TargetResource.id),\n targetModifiedProp = TargetResource.modifiedProperties\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend Credential_KeyDescription = trim(@'\"',tostring(Property.newValue))\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"Included Updated Properties\"\n | extend UpdatedProperties = trim(@'\"',tostring(Property.newValue))\n )\n| mv-apply Property = targetModifiedProp on \n (\n where Property.displayName =~ \"TargetId.ServicePrincipalNames\"\n | extend Credential_ServicePrincipalNames = tostring(extract_all(@\"([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})\",trim(@'\"',tostring(Property.newValue)))[0])\n )\n| extend Credential_InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend Credential_InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n) on targetResourceName, targetResourceID\n| extend TimeConsent = TimeGenerated, TimeCred = TimeGenerated1\n| where TimeConsent < TimeCred \n| project TimeConsent, TimeCred, Consent_InitiatingUserOrApp, Credential_InitiatingUserOrApp, targetResourceName, targetResourceType, isAdminConsent, Consent_ServicePrincipalNames, Credential_ServicePrincipalNames, Consent_Permissions, Credential_KeyDescription, Consent_InitiatingIpAddress, Credential_InitiatingIpAddress\n| extend timestamp = TimeConsent, Name = tostring(split(Credential_InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(Credential_InitiatingUserOrApp,'@',1)[0])\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P2D",
+ "query": "let security_info_actions = dynamic([\"User registered security info\", \"User changed default security info\", \"User deleted security info\", \"Admin updated security info\", \"User reviewed security info\", \"Admin deleted security info\", \"Admin registered security info\"]);\nlet VIPUsers = (_GetWatchlist('VIPUsers') | distinct \"User Principal Name\");\nAuditLogs\n| where Category =~ \"UserManagement\"\n| where ActivityDisplayName in (security_info_actions)\n| extend Initiator = tostring(InitiatedBy.user.userPrincipalName)\n| extend IP = tostring(InitiatedBy.user.ipAddress)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = trim(@'\"',tolower(tostring(TargetResource.userPrincipalName)))\n )\n| where Target in~ (VIPUsers)\n| summarize Start=min(TimeGenerated), End=max(TimeGenerated), Actions = make_set(ResultReason) by Initiator, IP, Result, Target\n| extend Name = tostring(split(Target,'@',0)[0]), UPNSuffix = tostring(split(Target,'@',1)[0])\n",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "CredentialAccess"
+ "Persistence"
+ ],
+ "techniques": [
+ "T1098"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "Consent_InitiatingIpAddress"
+ "columnName": "IP",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -6683,13 +5385,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId15'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId36'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 15",
- "parentId": "[variables('analyticRuleId15')]",
- "contentId": "[variables('_analyticRulecontentId15')]",
+ "description": "Azure Active Directory Analytics Rule 36",
+ "parentId": "[variables('analyticRuleId36')]",
+ "contentId": "[variables('_analyticRulecontentId36')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion15')]",
+ "version": "[variables('analyticRuleVersion36')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -6714,89 +5416,81 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId15')]",
+ "contentId": "[variables('_analyticRulecontentId36')]",
"contentKind": "AnalyticsRule",
- "displayName": "Credential added after admin consented to Application",
- "contentProductId": "[variables('_analyticRulecontentProductId15')]",
- "id": "[variables('_analyticRulecontentProductId15')]",
- "version": "[variables('analyticRuleVersion15')]"
+ "displayName": "NRT Authentication Methods Changed for VIP Users",
+ "contentProductId": "[variables('_analyticRulecontentProductId36')]",
+ "id": "[variables('_analyticRulecontentProductId36')]",
+ "version": "[variables('analyticRuleVersion36')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName16')]",
+ "name": "[variables('analyticRuleTemplateSpecName37')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Cross-tenantAccessSettingsOrganizationAdded_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "nrt_FirstAppOrServicePrincipalCredential_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion16')]",
+ "contentVersion": "[variables('analyticRuleVersion37')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId16')]",
+ "name": "[variables('analyticRulecontentId37')]",
"apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
+ "kind": "NRT",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when an Organization is added other than the list that is supposed to exist from the Azure AD Cross-tenant Access Settings.",
- "displayName": "Cross-tenant Access Settings Organization Added",
+ "description": "This will alert when an admin or app owner account adds a new credential to an Application or Service Principal where there was no previous verify KeyCredential associated.\nIf a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\nAdditional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "NRT First access credential added to Application or Service Principal where no credential was present",
"enabled": false,
- "query": "// Tenants IDs can be found by navigating to Azure Active Directory then from menu on the left, select External Identities, then from menu on the left, select Cross-tenant access settings and from the list shown of Tenants\nlet ExpectedTenantIDs = dynamic([\"List of expected tenant IDs\",\"Tenant ID 2\"]);\nAuditLogs\n| where OperationName has \"Add a partner to cross-tenant access setting\"\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"tenantId\"\n | extend ExtTenantIDAdded = trim('\"',tostring(Property.newValue))\n )\n| where ExtTenantIDAdded !in (ExpectedTenantIDs)\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
- "queryFrequency": "P2D",
- "queryPeriod": "P2D",
+ "query": "AuditLogs\n| where OperationName has_any (\"Add service principal\", \"Certificates and secrets management\")\n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"Application\"\n | extend targetDisplayName = tostring(TargetResource.displayName),\n targetId = tostring(TargetResource.id),\n targetType = tostring(TargetResource.type),\n keyEvents = TargetResource.modifiedProperties\n )\n| mv-apply Property = keyEvents on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend new_value_set = parse_json(tostring(Property.newValue)),\n old_value_set = parse_json(tostring(Property.oldValue))\n )\n| where old_value_set == \"[]\"\n| mv-expand new_value_set\n| parse new_value_set with * \"KeyIdentifier=\" keyIdentifier:string \",KeyType=\" keyType:string \",KeyUsage=\" keyUsage:string \",DisplayName=\" keyDisplayName:string \"]\" *\n| where keyUsage == \"Verify\"\n | mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n//| where targetType =~ \"Application\" // or targetType =~ \"ServicePrincipal\"\n| project-away new_value_set, old_value_set\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, InitiatingIpAddress, UserAgent, targetDisplayName, targetId, targetType, keyDisplayName, keyType, keyUsage, keyIdentifier, CorrelationId, TenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess",
- "Persistence",
- "Discovery"
+ "DefenseEvasion"
],
"techniques": [
- "T1078",
- "T1136",
- "T1087"
+ "T1550"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatedByIPAdress"
+ "columnName": "InitiatingIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -6804,13 +5498,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId16'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId37'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 16",
- "parentId": "[variables('analyticRuleId16')]",
- "contentId": "[variables('_analyticRulecontentId16')]",
+ "description": "Azure Active Directory Analytics Rule 37",
+ "parentId": "[variables('analyticRuleId37')]",
+ "contentId": "[variables('_analyticRulecontentId37')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion16')]",
+ "version": "[variables('analyticRuleVersion37')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -6835,89 +5529,81 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId16')]",
+ "contentId": "[variables('_analyticRulecontentId37')]",
"contentKind": "AnalyticsRule",
- "displayName": "Cross-tenant Access Settings Organization Added",
- "contentProductId": "[variables('_analyticRulecontentProductId16')]",
- "id": "[variables('_analyticRulecontentProductId16')]",
- "version": "[variables('analyticRuleVersion16')]"
+ "displayName": "NRT First access credential added to Application or Service Principal where no credential was present",
+ "contentProductId": "[variables('_analyticRulecontentProductId37')]",
+ "id": "[variables('_analyticRulecontentProductId37')]",
+ "version": "[variables('analyticRuleVersion37')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName17')]",
+ "name": "[variables('analyticRuleTemplateSpecName38')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Cross-tenantAccessSettingsOrganizationDeleted_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "NRT_NewAppOrServicePrincipalCredential_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion17')]",
+ "contentVersion": "[variables('analyticRuleVersion38')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId17')]",
+ "name": "[variables('analyticRulecontentId38')]",
"apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
+ "kind": "NRT",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when an Organization is deleted from the Azure AD Cross-tenant Access Settings.",
- "displayName": "Cross-tenant Access Settings Organization Deleted",
+ "description": "This will alert when an admin or app owner account adds a new credential to an Application or Service Principal where a verify KeyCredential was already present for the app.\nIf a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\nAdditional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "NRT New access credential added to Application or Service Principal",
"enabled": false,
- "query": "AuditLogs\n| where OperationName has \"Delete partner specific cross-tenant access setting\"\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"tenantId\"\n | extend ExtTenantDeleted = trim('\"',tostring(Property.oldValue))\n )\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
- "queryFrequency": "P2D",
- "queryPeriod": "P2D",
+ "query": "AuditLogs\n| where OperationName has_any (\"Add service principal\", \"Certificates and secrets management\") // captures \"Add service principal\", \"Add service principal credentials\", and \"Update application - Certificates and secrets management\" events\n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"Application\"\n | extend targetDisplayName = tostring(TargetResource.displayName),\n targetId = tostring(TargetResource.id),\n targetType = tostring(TargetResource.type),\n keyEvents = TargetResource.modifiedProperties\n )\n| mv-apply Property = keyEvents on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend new_value_set = parse_json(tostring(Property.newValue)),\n old_value_set = parse_json(tostring(Property.oldValue))\n )\n| where old_value_set != \"[]\"\n| extend diff = set_difference(new_value_set, old_value_set)\n| where diff != \"[]\"\n| parse diff with * \"KeyIdentifier=\" keyIdentifier:string \",KeyType=\" keyType:string \",KeyUsage=\" keyUsage:string \",DisplayName=\" keyDisplayName:string \"]\" *\n| where keyUsage =~ \"Verify\"\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n// The below line is currently commented out but Microsoft Sentinel users can modify this query to show only Application or only Service Principal events in their environment\n//| where targetType =~ \"Application\" // or targetType =~ \"ServicePrincipal\"\n| project-away diff, new_value_set, old_value_set\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, InitiatingIpAddress, UserAgent, targetDisplayName, targetId, targetType, keyDisplayName, keyType, keyUsage, keyIdentifier, CorrelationId, TenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess",
- "Persistence",
- "Discovery"
+ "DefenseEvasion"
],
"techniques": [
- "T1078",
- "T1136",
- "T1087"
+ "T1550"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatedByIPAdress"
+ "columnName": "InitiatingIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -6925,13 +5611,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId17'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId38'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 17",
- "parentId": "[variables('analyticRuleId17')]",
- "contentId": "[variables('_analyticRulecontentId17')]",
+ "description": "Azure Active Directory Analytics Rule 38",
+ "parentId": "[variables('analyticRuleId38')]",
+ "contentId": "[variables('_analyticRulecontentId38')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion17')]",
+ "version": "[variables('analyticRuleVersion38')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -6956,89 +5642,94 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId17')]",
+ "contentId": "[variables('_analyticRulecontentId38')]",
"contentKind": "AnalyticsRule",
- "displayName": "Cross-tenant Access Settings Organization Deleted",
- "contentProductId": "[variables('_analyticRulecontentProductId17')]",
- "id": "[variables('_analyticRulecontentProductId17')]",
- "version": "[variables('analyticRuleVersion17')]"
+ "displayName": "NRT New access credential added to Application or Service Principal",
+ "contentProductId": "[variables('_analyticRulecontentProductId38')]",
+ "id": "[variables('_analyticRulecontentProductId38')]",
+ "version": "[variables('analyticRuleVersion38')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName18')]",
+ "name": "[variables('analyticRuleTemplateSpecName39')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Cross-tenantAccessSettingsOrganizationInboundCollaborationSettingsChanged_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "NRT_PIMElevationRequestRejected_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion18')]",
+ "contentVersion": "[variables('analyticRuleVersion39')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId18')]",
+ "name": "[variables('analyticRulecontentId39')]",
"apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
+ "kind": "NRT",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when Organization Inbound Collaboration Settings are changed for \"Users & Groups\" and for \"Applications\".",
- "displayName": "Cross-tenant Access Settings Organization Inbound Collaboration Settings Changed",
+ "description": "Identifies when a user is rejected for a privileged role elevation via PIM. Monitor rejections for indicators of attacker compromise of the requesting account.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-identity-management",
+ "displayName": "NRT PIM Elevation Request Rejected",
"enabled": false,
- "query": "//In User & Groups and in Applications, the following \"AccessType\" values in columns PremodifiedInboundSettings and ModifiedInboundSettings are interpreted accordingly:\n// When Access Type in premodified inbound settings value was 1 that means that the initial access was allowed. When Access Type in premodified inbound settings value was 2 that means that the initial access was blocked. \n// When Access Type in modified inbound settings value is 1 that means that now access is allowed. When Access Type in modified inbound settings value is 2 that means that now access is blocked. \nAuditLogs\n| where OperationName has \"Update a partner cross-tenant access setting\"\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"b2bCollaborationInbound\"\n | extend PremodifiedInboundSettings = trim('\"',tostring(Property.oldValue)),\n ModifiedInboundSettings = trim(@'\"',tostring(Property.newValue))\n )\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| where PremodifiedInboundSettings != ModifiedInboundSettings\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
- "queryFrequency": "P2D",
- "queryPeriod": "P2D",
- "severity": "Medium",
+ "query": "AuditLogs\n| where ActivityDisplayName =~'Add member to role completed (PIM activation)'\n| where Result =~ \"failure\"\n| mv-apply ResourceItem = TargetResources on \n (\n where ResourceItem.type =~ \"Role\"\n | extend Role = trim(@'\"',tostring(ResourceItem.displayName))\n )\n| mv-apply ResourceItem = TargetResources on \n (\n where ResourceItem.type =~ \"User\"\n | extend User = trim(@'\"',tostring(ResourceItem.userPrincipalName))\n )\n| project-reorder TimeGenerated, User, Role, OperationName, Result, ResultDescription\n| where isnotempty(InitiatedBy.user)\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName), InitiatingIpAddress = tostring(InitiatedBy.user.ipAddress)\n| extend InitiatingName = tostring(split(InitiatingUser,'@',0)[0]), InitiatingUPNSuffix = tostring(split(InitiatingUser,'@',1)[0])\n| extend UserName = tostring(split(User,'@',0)[0]), UserUPNSuffix = tostring(split(User,'@',1)[0])\n",
+ "severity": "High",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess",
- "Persistence",
- "Discovery"
+ "Persistence"
],
"techniques": [
- "T1078",
- "T1136",
- "T1087"
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "InitiatingName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "InitiatingUPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "UserName",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UserUPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatedByIPAdress"
+ "columnName": "InitiatingIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -7046,13 +5737,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId18'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId39'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 18",
- "parentId": "[variables('analyticRuleId18')]",
- "contentId": "[variables('_analyticRulecontentId18')]",
+ "description": "Azure Active Directory Analytics Rule 39",
+ "parentId": "[variables('analyticRuleId39')]",
+ "contentId": "[variables('_analyticRulecontentId39')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion18')]",
+ "version": "[variables('analyticRuleVersion39')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -7077,89 +5768,81 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId18')]",
+ "contentId": "[variables('_analyticRulecontentId39')]",
"contentKind": "AnalyticsRule",
- "displayName": "Cross-tenant Access Settings Organization Inbound Collaboration Settings Changed",
- "contentProductId": "[variables('_analyticRulecontentProductId18')]",
- "id": "[variables('_analyticRulecontentProductId18')]",
- "version": "[variables('analyticRuleVersion18')]"
+ "displayName": "NRT PIM Elevation Request Rejected",
+ "contentProductId": "[variables('_analyticRulecontentProductId39')]",
+ "id": "[variables('_analyticRulecontentProductId39')]",
+ "version": "[variables('analyticRuleVersion39')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName19')]",
+ "name": "[variables('analyticRuleTemplateSpecName40')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Cross-tenantAccessSettingsOrganizationInboundDirectSettingsChanged_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "NRT_PrivlegedRoleAssignedOutsidePIM_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion19')]",
+ "contentVersion": "[variables('analyticRuleVersion40')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId19')]",
+ "name": "[variables('analyticRulecontentId40')]",
"apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
+ "kind": "NRT",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when Organization Inbound Direct Settings are changed for \"Users & Groups\" and for \"Applications\".",
- "displayName": "Cross-tenant Access Settings Organization Inbound Direct Settings Changed",
+ "description": "Identifies a privileged role being assigned to a user outside of PIM\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor-1",
+ "displayName": "NRT Privileged Role Assigned Outside PIM",
"enabled": false,
- "query": "//In User & Groups and in Applications, the following \"AccessType\" values in columns PremodifiedInboundSettings and ModifiedInboundSettings are interpreted accordingly:\n// When Access Type in premodified inbound settings value was 1 that means that the initial access was allowed. When Access Type in premodified inbound settings value was 2 that means that the initial access was blocked. \n// When Access Type in modified inbound settings value is 1 that means that now access is allowed. When Access Type in modified inbound settings value is 2 that means that now access is blocked. \nAuditLogs\n| where OperationName has \"Update a partner cross-tenant access setting\"\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"b2bDirectConnectInbound\"\n | extend PremodifiedInboundSettings = trim('\"',tostring(Property.oldValue)),\n ModifiedInboundSettings = trim(@'\"',tostring(Property.newValue))\n )\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| where PremodifiedInboundSettings != ModifiedInboundSettings\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
- "queryFrequency": "P2D",
- "queryPeriod": "P2D",
- "severity": "Medium",
+ "query": "AuditLogs\n| where Category =~ \"RoleManagement\"\n| where OperationName has \"Add member to role outside of PIM\"\n or (LoggedByService =~ \"Core Directory\" and OperationName =~ \"Add member to role\" and Identity != \"MS-PIM\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend UserPrincipalName = tostring(TargetResource.userPrincipalName)\n )\n| extend IpAddress = tostring(InitiatedBy.user.ipAddress), Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
+ "severity": "Low",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess",
- "Persistence",
- "Discovery"
+ "PrivilegeEscalation"
],
"techniques": [
- "T1078",
- "T1136",
- "T1087"
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatedByIPAdress"
+ "columnName": "IpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -7167,13 +5850,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId19'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId40'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 19",
- "parentId": "[variables('analyticRuleId19')]",
- "contentId": "[variables('_analyticRulecontentId19')]",
+ "description": "Azure Active Directory Analytics Rule 40",
+ "parentId": "[variables('analyticRuleId40')]",
+ "contentId": "[variables('_analyticRulecontentId40')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion19')]",
+ "version": "[variables('analyticRuleVersion40')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -7198,89 +5881,87 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId19')]",
+ "contentId": "[variables('_analyticRulecontentId40')]",
"contentKind": "AnalyticsRule",
- "displayName": "Cross-tenant Access Settings Organization Inbound Direct Settings Changed",
- "contentProductId": "[variables('_analyticRulecontentProductId19')]",
- "id": "[variables('_analyticRulecontentProductId19')]",
- "version": "[variables('analyticRuleVersion19')]"
+ "displayName": "NRT Privileged Role Assigned Outside PIM",
+ "contentProductId": "[variables('_analyticRulecontentProductId40')]",
+ "id": "[variables('_analyticRulecontentProductId40')]",
+ "version": "[variables('analyticRuleVersion40')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName20')]",
+ "name": "[variables('analyticRuleTemplateSpecName41')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Cross-tenantAccessSettingsOrganizationOutboundCollaborationSettingsChanged_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "NRT_UseraddedtoPrivilgedGroups_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion20')]",
+ "contentVersion": "[variables('analyticRuleVersion41')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId20')]",
+ "name": "[variables('analyticRulecontentId41')]",
"apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
+ "kind": "NRT",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when Organization Outbound Collaboration Settings are changed for \"Users & Groups\" and for \"Applications\".",
- "displayName": "Cross-tenant Access Settings Organization Outbound Collaboration Settings Changed",
+ "description": "This will alert when a user is added to any of the Privileged Groups.\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.\nFor Administrator role permissions in Azure Active Directory please see https://docs.microsoft.com/azure/active-directory/users-groups-roles/directory-assign-admin-roles",
+ "displayName": "NRT User added to Azure Active Directory Privileged Groups",
"enabled": false,
- "query": "//In User & Groups and in Applications, the following \"AccessType\" values in columns PremodifiedOutboundSettings and ModifiedOutboundSettings are interpreted accordingly:\n// When Access Type in premodified outbound settings value was 1 that means that the initial access was allowed. When Access Type in premodified outbound settings value was 2 that means that the initial access was blocked. \n// When Access Type in modified outbound settings value is 1 that means that now access is allowed. When Access Type in modified outbound settings value is 2 that means that now access is blocked. \nAuditLogs\n| where OperationName has \"Update a partner cross-tenant access setting\"\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"b2bCollaborationOutbound\"\n | extend PremodifiedOutboundSettings = trim('\"',tostring(Property.oldValue)),\n ModifiedOutboundSettings = trim(@'\"',tostring(Property.newValue))\n )\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| where PremodifiedOutboundSettings != ModifiedOutboundSettings\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
- "queryFrequency": "P2D",
- "queryPeriod": "P2D",
+ "query": "let OperationList = dynamic([\"Add member to role\",\"Add member to role in PIM requested (permanent)\"]);\nlet PrivilegedGroups = dynamic([\"UserAccountAdmins\",\"PrivilegedRoleAdmins\",\"TenantAdmins\"]);\nAuditLogs\n//| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"RoleManagement\"\n| where OperationName in~ (OperationList)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend TargetUserPrincipalName = tostring(TargetResource.userPrincipalName),\n modProps = TargetResource.modifiedProperties\n )\n| mv-apply Property = modProps on \n (\n where Property.displayName =~ \"Role.WellKnownObjectName\"\n | extend DisplayName = trim('\"',tostring(Property.displayName)),\n GroupName = trim('\"',tostring(Property.newValue))\n )\n| extend AppId = InitiatedBy.app.appId,\n InitiatedByDisplayName = case(isnotempty(InitiatedBy.app.displayName), InitiatedBy.app.displayName, isnotempty(InitiatedBy.user.displayName), InitiatedBy.user.displayName, \"not available\"),\n ServicePrincipalId = tostring(InitiatedBy.app.servicePrincipalId),\n ServicePrincipalName = tostring(InitiatedBy.app.servicePrincipalName),\n UserId = InitiatedBy.user.id,\n UserIPAddress = InitiatedBy.user.ipAddress,\n UserRoles = InitiatedBy.user.roles,\n UserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)\n| where GroupName in~ (PrivilegedGroups)\n// If you don't want to alert for operations from PIM, remove below filtering for MS-PIM.\n//| where InitiatedByDisplayName != \"MS-PIM\"\n| project TimeGenerated, AADOperationType, Category, OperationName, AADTenantId, AppId, InitiatedByDisplayName, ServicePrincipalId, ServicePrincipalName, DisplayName, GroupName, UserId, UserIPAddress, UserRoles, UserPrincipalName, TargetUserPrincipalName\n| extend AccountCustomEntity = case(isnotempty(ServicePrincipalName), ServicePrincipalName, \n isnotempty(UserPrincipalName), UserPrincipalName, \n \"\")\n| extend AccountName = tostring(split(AccountCustomEntity,'@',0)[0]), AccountUPNSuffix = tostring(split(AccountCustomEntity,'@',1)[0])\n| extend TargetName = tostring(split(TargetUserPrincipalName,'@',0)[0]), TargetUPNSuffix = tostring(split(TargetUserPrincipalName,'@',1)[0])\n",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess",
"Persistence",
- "Discovery"
+ "PrivilegeEscalation"
],
"techniques": [
- "T1078",
- "T1136",
- "T1087"
+ "T1098",
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "AccountName",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "AccountUPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatedByIPAdress"
+ "columnName": "TargetName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "TargetUPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
}
]
}
@@ -7288,13 +5969,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId20'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId41'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 20",
- "parentId": "[variables('analyticRuleId20')]",
- "contentId": "[variables('_analyticRulecontentId20')]",
+ "description": "Azure Active Directory Analytics Rule 41",
+ "parentId": "[variables('analyticRuleId41')]",
+ "contentId": "[variables('_analyticRulecontentId41')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion20')]",
+ "version": "[variables('analyticRuleVersion41')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -7319,44 +6000,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId20')]",
+ "contentId": "[variables('_analyticRulecontentId41')]",
"contentKind": "AnalyticsRule",
- "displayName": "Cross-tenant Access Settings Organization Outbound Collaboration Settings Changed",
- "contentProductId": "[variables('_analyticRulecontentProductId20')]",
- "id": "[variables('_analyticRulecontentProductId20')]",
- "version": "[variables('analyticRuleVersion20')]"
+ "displayName": "NRT User added to Azure Active Directory Privileged Groups",
+ "contentProductId": "[variables('_analyticRulecontentProductId41')]",
+ "id": "[variables('_analyticRulecontentProductId41')]",
+ "version": "[variables('analyticRuleVersion41')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName21')]",
+ "name": "[variables('analyticRuleTemplateSpecName42')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Cross-tenantAccessSettingsOrganizationOutboundDirectSettingsChanged_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "PIMElevationRequestRejected_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion21')]",
+ "contentVersion": "[variables('analyticRuleVersion42')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId21')]",
+ "name": "[variables('analyticRulecontentId42')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Organizations are added in the Cross-tenant Access Settings to control communication inbound or outbound for users and applications. This detection notifies when Organization Outbound Direct Settings are changed for \"Users & Groups\" and for \"Applications\".",
- "displayName": "Cross-tenant Access Settings Organization Outbound Direct Settings Changed",
- "enabled": false,
- "query": "//In User & Groups and in Applications, the following \"AccessType\" values in columns PremodifiedOutboundSettings and ModifiedOutboundSettings are interpreted accordingly:\n// When Access Type in premodified outbound settings value was 1 that means that the initial access was allowed. When Access Type in premodified outbound settings value was 2 that means that the initial access was blocked. \n// When Access Type in modified outbound settings value is 1 that means that now access is allowed. When Access Type in modified outbound settings value is 2 that means that now access is blocked. \nAuditLogs\n| where OperationName has \"Update a partner cross-tenant access setting\"\n| mv-apply TargetResource = TargetResources on\n (\n where TargetResource.type =~ \"Policy\"\n | extend Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"b2bDirectConnectOutbound\"\n | extend PremodifiedOutboundSettings = trim('\"',tostring(Property.oldValue)),\n ModifiedOutboundSettings = trim(@'\"',tostring(Property.newValue))\n )\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress\n| where PremodifiedOutboundSettings != ModifiedOutboundSettings\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
- "queryFrequency": "P2D",
- "queryPeriod": "P2D",
- "severity": "Medium",
+ "description": "Identifies when a user is rejected for a privileged role elevation via PIM. Monitor rejections for indicators of attacker compromise of the requesting account.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-identity-management",
+ "displayName": "PIM Elevation Request Rejected",
+ "enabled": false,
+ "query": "AuditLogs\n| where (ActivityDisplayName =~'Add member to role completed (PIM activation)' and Result =~ \"failure\") or ActivityDisplayName =~'Add member to role request denied (PIM activation)'\n| mv-apply ResourceItem = TargetResources on \n (\n where ResourceItem.type =~ \"Role\"\n | extend Role = trim(@'\"',tostring(ResourceItem.displayName))\n )\n| mv-apply ResourceItem = TargetResources on \n (\n where ResourceItem.type =~ \"User\"\n | extend User = trim(@'\"',tostring(ResourceItem.userPrincipalName))\n )\n| project-reorder TimeGenerated, User, Role, OperationName, Result, ResultDescription\n| where isnotempty(InitiatedBy.user)\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName), InitiatingIpAddress = tostring(InitiatedBy.user.ipAddress)\n| extend InitiatingName = tostring(split(InitiatingUser,'@',0)[0]), InitiatingUPNSuffix = tostring(split(InitiatingUser,'@',1)[0])\n| extend UserName = tostring(split(User,'@',0)[0]), UserUPNSuffix = tostring(split(User,'@',1)[0])\n",
+ "queryFrequency": "PT2H",
+ "queryPeriod": "PT2H",
+ "severity": "High",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -7364,44 +6045,53 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess",
- "Persistence",
- "Discovery"
+ "Persistence"
],
"techniques": [
- "T1078",
- "T1136",
- "T1087"
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "InitiatingName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "InitiatingUPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "UserName",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UserUPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatedByIPAdress"
+ "columnName": "InitiatingIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -7409,13 +6099,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId21'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId42'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 21",
- "parentId": "[variables('analyticRuleId21')]",
- "contentId": "[variables('_analyticRulecontentId21')]",
+ "description": "Azure Active Directory Analytics Rule 42",
+ "parentId": "[variables('analyticRuleId42')]",
+ "contentId": "[variables('_analyticRulecontentId42')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion21')]",
+ "version": "[variables('analyticRuleVersion42')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -7440,44 +6130,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId21')]",
+ "contentId": "[variables('_analyticRulecontentId42')]",
"contentKind": "AnalyticsRule",
- "displayName": "Cross-tenant Access Settings Organization Outbound Direct Settings Changed",
- "contentProductId": "[variables('_analyticRulecontentProductId21')]",
- "id": "[variables('_analyticRulecontentProductId21')]",
- "version": "[variables('analyticRuleVersion21')]"
+ "displayName": "PIM Elevation Request Rejected",
+ "contentProductId": "[variables('_analyticRulecontentProductId42')]",
+ "id": "[variables('_analyticRulecontentProductId42')]",
+ "version": "[variables('analyticRuleVersion42')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName22')]",
+ "name": "[variables('analyticRuleTemplateSpecName43')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "DisabledAccountSigninsAcrossManyApplications_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "PrivilegedAccountsSigninFailureSpikes_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion22')]",
+ "contentVersion": "[variables('analyticRuleVersion43')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId22')]",
+ "name": "[variables('analyticRulecontentId43')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies failed attempts to sign in to disabled accounts across multiple Azure Applications.\nDefault threshold for Azure Applications attempted to sign in to is 3.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\n50057 - User account is disabled. The account has been disabled by an administrator.",
- "displayName": "Attempts to sign in to disabled accounts",
+ "description": " Identifies spike in failed sign-ins from Privileged accounts. Privileged accounts list can be based on IdentityInfo UEBA table.\nSpike is determined based on Time series anomaly which will look at historical baseline values.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor",
+ "displayName": "Privileged Accounts - Sign in Failure Spikes",
"enabled": false,
- "query": "let threshold = 3;\nlet aadFunc = (tableName:string){\ntable(tableName)\n| where ResultType == \"50057\"\n| where ResultDescription =~ \"User account is disabled. The account has been disabled by an administrator.\"\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), applicationCount = dcount(AppDisplayName),\napplicationSet = make_set(AppDisplayName), count() by UserPrincipalName, IPAddress, Type\n| where applicationCount >= threshold\n| extend timestamp = StartTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
+ "query": "let starttime = 14d;\nlet timeframe = 1d;\nlet scorethreshold = 3;\nlet baselinethreshold = 5;\nlet aadFunc = (tableName:string){\n IdentityInfo\n | where TimeGenerated > ago(starttime)\n | summarize arg_max(TimeGenerated, *) by AccountUPN\n | mv-expand AssignedRoles\n | where AssignedRoles contains 'Admin'\n | summarize Roles = make_list(AssignedRoles) by AccountUPN = tolower(AccountUPN)\n | join kind=inner (\n table(tableName)\n | where TimeGenerated between (startofday(ago(starttime))..startofday(now()))\n | where ResultType != 0\n | extend UserPrincipalName = tolower(UserPrincipalName)\n ) on $left.AccountUPN == $right.UserPrincipalName\n | extend timestamp = TimeGenerated, AccountCustomEntity = UserPrincipalName, Roles = tostring(Roles)\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nlet allSignins = union isfuzzy=true aadSignin, aadNonInt;\nlet TimeSeriesAlerts = \n allSignins\n | make-series HourlyCount=count() on TimeGenerated from startofday(ago(starttime)) to startofday(now()) step 1h by UserPrincipalName, Roles\n | extend (anomalies, score, baseline) = series_decompose_anomalies(HourlyCount, scorethreshold, -1, 'linefit')\n | mv-expand HourlyCount to typeof(double), TimeGenerated to typeof(datetime), anomalies to typeof(double), score to typeof(double), baseline to typeof(long)\n // Filtering low count events per baselinethreshold\n | where anomalies > 0 and baseline > baselinethreshold\n | extend AnomalyHour = TimeGenerated\n | project UserPrincipalName, Roles, AnomalyHour, TimeGenerated, HourlyCount, baseline, anomalies, score;\n// Filter the alerts for specified timeframe\nTimeSeriesAlerts\n| where TimeGenerated > startofday(ago(timeframe))\n| join kind=inner ( \n allSignins\n | where TimeGenerated > startofday(ago(timeframe))\n // create a new column and round to hour\n | extend DateHour = bin(TimeGenerated, 1h)\n | summarize PartialFailedSignins = count(), LatestAnomalyTime = arg_max(TimeGenerated, *) by bin(TimeGenerated, 1h), OperationName, Category, ResultType, ResultDescription, UserPrincipalName, Roles, UserDisplayName, AppDisplayName, ClientAppUsed, IPAddress, ResourceDisplayName\n) on UserPrincipalName, $left.AnomalyHour == $right.DateHour\n| project LatestAnomalyTime, OperationName, Category, UserPrincipalName, Roles = todynamic(Roles), UserDisplayName, ResultType, ResultDescription, AppDisplayName, ClientAppUsed, UserAgent, IPAddress, Location, AuthenticationRequirement, ConditionalAccessStatus, ResourceDisplayName, PartialFailedSignins, TotalFailedSignins = HourlyCount, baseline, anomalies, score\n| extend timestamp = LatestAnomalyTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
"queryFrequency": "P1D",
- "queryPeriod": "P1D",
- "severity": "Medium",
+ "queryPeriod": "P14D",
+ "severity": "High",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -7485,16 +6175,16 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"SigninLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
},
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AADNonInteractiveUserSignInLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
@@ -7505,26 +6195,26 @@
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IPAddress"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -7532,13 +6222,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId22'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId43'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 22",
- "parentId": "[variables('analyticRuleId22')]",
- "contentId": "[variables('_analyticRulecontentId22')]",
+ "description": "Azure Active Directory Analytics Rule 43",
+ "parentId": "[variables('analyticRuleId43')]",
+ "contentId": "[variables('_analyticRulecontentId43')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion22')]",
+ "version": "[variables('analyticRuleVersion43')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -7563,44 +6253,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId22')]",
+ "contentId": "[variables('_analyticRulecontentId43')]",
"contentKind": "AnalyticsRule",
- "displayName": "Attempts to sign in to disabled accounts",
- "contentProductId": "[variables('_analyticRulecontentProductId22')]",
- "id": "[variables('_analyticRulecontentProductId22')]",
- "version": "[variables('analyticRuleVersion22')]"
+ "displayName": "Privileged Accounts - Sign in Failure Spikes",
+ "contentProductId": "[variables('_analyticRulecontentProductId43')]",
+ "id": "[variables('_analyticRulecontentProductId43')]",
+ "version": "[variables('analyticRuleVersion43')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName23')]",
+ "name": "[variables('analyticRuleTemplateSpecName44')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "DistribPassCrackAttempt_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "PrivlegedRoleAssignedOutsidePIM_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion23')]",
+ "contentVersion": "[variables('analyticRuleVersion44')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId23')]",
+ "name": "[variables('analyticRulecontentId44')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies distributed password cracking attempts from the Azure Active Directory SigninLogs.\nThe query looks for unusually high number of failed password attempts coming from multiple locations for a user account.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\n50053 Account is locked because the user tried to sign in too many times with an incorrect user ID or password.\n50055 Invalid password, entered expired password.\n50056 Invalid or null password - Password does not exist in store for this user.\n50126 Invalid username or password, or invalid on-premises username or password.",
- "displayName": "Distributed Password cracking attempts in AzureAD",
+ "description": "Identifies a privileged role being assigned to a user outside of PIM\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor-1",
+ "displayName": "Privileged Role Assigned Outside PIM",
"enabled": false,
- "query": "let s_threshold = 30;\nlet l_threshold = 3;\nlet aadFunc = (tableName:string){\ntable(tableName)\n| where OperationName =~ \"Sign-in activity\"\n// Error codes that we want to look at as they are related to the use of incorrect password.\n| where ResultType in (\"50126\", \"50053\" , \"50055\", \"50056\")\n| extend DeviceDetail = todynamic(DeviceDetail), Status = todynamic(DeviceDetail), LocationDetails = todynamic(LocationDetails)\n| extend OS = DeviceDetail.operatingSystem, Browser = DeviceDetail.browser\n| extend StatusCode = tostring(Status.errorCode), StatusDetails = tostring(Status.additionalDetails)\n| extend LocationString = strcat(tostring(LocationDetails.countryOrRegion), \"/\", tostring(LocationDetails.state), \"/\", tostring(LocationDetails.city))\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), LocationCount=dcount(LocationString), Location = make_set(LocationString,100),\nIPAddress = make_set(IPAddress,100), IPAddressCount = dcount(IPAddress), AppDisplayName = make_set(AppDisplayName,100), ResultDescription = make_set(ResultDescription,50),\nBrowser = make_set(Browser,20), OS = make_set(OS,20), SigninCount = count() by UserPrincipalName, Type\n// Setting a generic threshold - Can be different for different environment\n| where SigninCount > s_threshold and LocationCount >= l_threshold\n| extend Location = tostring(Location), IPAddress = tostring(IPAddress), AppDisplayName = tostring(AppDisplayName), ResultDescription = tostring(ResultDescription), Browser = tostring(Browser), OS = tostring(OS)\n| extend timestamp = StartTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
+ "query": "AuditLogs\n| where Category =~ \"RoleManagement\"\n| where OperationName has \"Add member to role outside of PIM\"\n or (LoggedByService =~ \"Core Directory\" and OperationName =~ \"Add member to role\" and Identity != \"MS-PIM\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend UserPrincipalName = tostring(TargetResource.userPrincipalName)\n )\n| extend IpAddress = tostring(InitiatedBy.user.ipAddress), Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
"queryFrequency": "P1D",
"queryPeriod": "P1D",
- "severity": "Medium",
+ "severity": "Low",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -7608,46 +6298,40 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "CredentialAccess"
+ "PrivilegeEscalation"
],
"techniques": [
- "T1110"
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IPAddress"
+ "columnName": "IpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -7655,13 +6339,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId23'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId44'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 23",
- "parentId": "[variables('analyticRuleId23')]",
- "contentId": "[variables('_analyticRulecontentId23')]",
+ "description": "Azure Active Directory Analytics Rule 44",
+ "parentId": "[variables('analyticRuleId44')]",
+ "contentId": "[variables('_analyticRulecontentId44')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion23')]",
+ "version": "[variables('analyticRuleVersion44')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -7686,100 +6370,96 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId23')]",
+ "contentId": "[variables('_analyticRulecontentId44')]",
"contentKind": "AnalyticsRule",
- "displayName": "Distributed Password cracking attempts in AzureAD",
- "contentProductId": "[variables('_analyticRulecontentProductId23')]",
- "id": "[variables('_analyticRulecontentProductId23')]",
- "version": "[variables('analyticRuleVersion23')]"
+ "displayName": "Privileged Role Assigned Outside PIM",
+ "contentProductId": "[variables('_analyticRulecontentProductId44')]",
+ "id": "[variables('_analyticRulecontentProductId44')]",
+ "version": "[variables('analyticRuleVersion44')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName24')]",
+ "name": "[variables('analyticRuleTemplateSpecName45')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "ExplicitMFADeny_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "RareApplicationConsent_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion24')]",
+ "contentVersion": "[variables('analyticRuleVersion45')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId24')]",
+ "name": "[variables('analyticRulecontentId45')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "User explicitly denies MFA push, indicating that login was not expected and the account's password may be compromised.",
- "displayName": "Explicit MFA Deny",
+ "description": "This will alert when the \"Consent to application\" operation occurs by a user that has not done this operation before or rarely does this.\nThis could indicate that permissions to access the listed Azure App were provided to a malicious actor.\nConsent to application, Add service principal and Add OAuth2PermissionGrant should typically be rare events.\nThis may help detect the Oauth2 attack that can be initiated by this publicly available tool - https://github.com/fireeye/PwnAuth\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "Rare application consent",
"enabled": false,
- "query": "let aadFunc = (tableName:string){\ntable(tableName)\n| where ResultType == 500121\n| where Status has \"MFA Denied; user declined the authentication\" or Status has \"MFA denied; Phone App Reported Fraud\"\n| extend Type = Type\n| extend timestamp = TimeGenerated, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
+ "query": "let current = 1d;\nlet auditLookback = 7d;\n// Setting threshold to 3 as a default, change as needed.\n// Any operation that has been initiated by a user or app more than 3 times in the past 7 days will be excluded\nlet threshold = 3;\n// Gather initial data from lookback period, excluding current, adjust current to more than a single day if no results\nlet AuditTrail = AuditLogs | where TimeGenerated >= ago(auditLookback) and TimeGenerated < ago(current)\n// 2 other operations that can be part of malicious activity in this situation are\n// \"Add OAuth2PermissionGrant\" and \"Add service principal\", extend the filter below to capture these too\n| where OperationName has \"Consent to application\"\n| extend InitiatedBy = iff(isnotempty(tostring(InitiatedBy.user.userPrincipalName)),\n tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend TargetResourceName = tolower(tostring(TargetResource.displayName))\n )\n| summarize max(TimeGenerated), OperationCount = count() by OperationName, InitiatedBy, TargetResourceName\n// only including operations initiated by a user or app that is above the threshold so we produce only rare and has not occurred in last 7 days\n| where OperationCount > threshold;\n// Gather current period of audit data\nlet RecentConsent = AuditLogs | where TimeGenerated >= ago(current)\n| where OperationName has \"Consent to application\"\n| extend IpAddress = case(\n isnotempty(tostring(InitiatedBy.user.ipAddress)) and tostring(InitiatedBy.user.ipAddress) != 'null', tostring(InitiatedBy.user.ipAddress),\n isnotempty(tostring(InitiatedBy.app.ipAddress)) and tostring(InitiatedBy.app.ipAddress) != 'null', tostring(InitiatedBy.app.ipAddress),\n 'Not Available')\n| extend InitiatedBy = iff(isnotempty(tostring(InitiatedBy.user.userPrincipalName)),\n tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend TargetResourceName = tolower(tostring(TargetResource.displayName)),\n props = TargetResource.modifiedProperties\n )\n| parse props with * \"ConsentType: \" ConsentType \"]\" *\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| project TimeGenerated, InitiatedBy, IpAddress, TargetResourceName, Category, OperationName, ConsentType, UserAgent, CorrelationId, Type;\n// Exclude previously seen audit activity for \"Consent to application\" that was seen in the lookback period\n// First for rare InitiatedBy\nlet RareConsentBy = RecentConsent | join kind= leftanti AuditTrail on OperationName, InitiatedBy\n| extend Reason = \"Previously unseen user consenting\";\n// Second for rare TargetResourceName\nlet RareConsentApp = RecentConsent | join kind= leftanti AuditTrail on OperationName, TargetResourceName\n| extend Reason = \"Previously unseen app granted consent\";\nRareConsentBy | union RareConsentApp\n| summarize Reason = make_set(Reason,100) by TimeGenerated, InitiatedBy, IpAddress, TargetResourceName, Category, OperationName, ConsentType, UserAgent, CorrelationId, Type\n| extend timestamp = TimeGenerated, Name = tolower(tostring(split(InitiatedBy,'@',0)[0])), UPNSuffix = tolower(tostring(split(InitiatedBy,'@',1)[0]))\n",
"queryFrequency": "P1D",
- "queryPeriod": "P1D",
+ "queryPeriod": "P7D",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
+ "triggerThreshold": 3,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "CredentialAccess"
+ "Persistence",
+ "PrivilegeEscalation"
],
"techniques": [
- "T1110"
+ "T1136",
+ "T1068"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IPAddress"
+ "columnName": "TargetResourceName",
+ "identifier": "Name"
}
- ]
+ ],
+ "entityType": "CloudApplication"
},
{
- "entityType": "URL",
"fieldMappings": [
{
- "identifier": "Url",
- "columnName": "ClientAppUsed"
+ "columnName": "IpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -7787,13 +6467,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId24'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId45'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 24",
- "parentId": "[variables('analyticRuleId24')]",
- "contentId": "[variables('_analyticRulecontentId24')]",
+ "description": "Azure Active Directory Analytics Rule 45",
+ "parentId": "[variables('analyticRuleId45')]",
+ "contentId": "[variables('_analyticRulecontentId45')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion24')]",
+ "version": "[variables('analyticRuleVersion45')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -7818,41 +6498,41 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId24')]",
+ "contentId": "[variables('_analyticRulecontentId45')]",
"contentKind": "AnalyticsRule",
- "displayName": "Explicit MFA Deny",
- "contentProductId": "[variables('_analyticRulecontentProductId24')]",
- "id": "[variables('_analyticRulecontentProductId24')]",
- "version": "[variables('analyticRuleVersion24')]"
+ "displayName": "Rare application consent",
+ "contentProductId": "[variables('_analyticRulecontentProductId45')]",
+ "id": "[variables('_analyticRulecontentProductId45')]",
+ "version": "[variables('analyticRuleVersion45')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName25')]",
+ "name": "[variables('analyticRuleTemplateSpecName46')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "ExchangeFullAccessGrantedToApp_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "SeamlessSSOPasswordSpray_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion25')]",
+ "contentVersion": "[variables('analyticRuleVersion46')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId25')]",
+ "name": "[variables('analyticRulecontentId46')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This detection looks for the full_access_as_app permission being granted to an OAuth application with Admin Consent.\nThis permission provide access to all Exchange mailboxes via the EWS API can could be exploited to access sensitive data \nby being added to a compromised application. The application granted this permission should be reviewed to ensure that it \nis absolutely necessary for the applications function.\nRef: https://learn.microsoft.com/graph/auth-limit-mailbox-access",
- "displayName": "full_access_as_app Granted To Application",
+ "description": "This query detects when there is a spike in Azure AD Seamless SSO errors. They may not be caused by a Password Spray attack, but the cause of the errors might need to be investigated.\nAzure AD only logs the requests that matched existing accounts, thus there might have been unlogged requests for non-existing accounts.",
+ "displayName": "Password spray attack against Azure AD Seamless SSO",
"enabled": false,
- "query": "AuditLogs\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Consent to application\"\n| where TargetResources has \"full_access_as_app\"\n| mv-expand TargetResources\n| extend OAuthAppName = TargetResources.displayName\n| extend ModifiedProperties = TargetResources.modifiedProperties \n| mv-apply Property = ModifiedProperties on \n (\n where Property.displayName =~ \"ConsentContext.isAdminConsent\"\n | extend AdminConsent = tostring(Property.newValue)\n )\n| mv-apply Property = ModifiedProperties on \n (\n where Property.displayName =~ \"ConsentAction.Permissions\"\n | extend Permissions = tostring(Property.newValue)\n )\n| mv-apply Property = ModifiedProperties on \n (\n where Property.displayName =~ \"TargetId.ServicePrincipalNames\"\n | extend AppId = tostring(Property.newValue)\n )\n| mv-expand AdditionalDetails\n| extend GrantUserAgent = tostring(iff(AdditionalDetails.key =~ \"User-Agent\", AdditionalDetails.value, \"\"))\n| parse Permissions with * \"ConsentType: \" GrantConsentType \", Scope: \" GrantScope1 \",\" *\n| where GrantScope1 =~ \"full_access_as_app\"\n| extend GrantIpAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))\n| extend GrantInitiatedBy = tostring(iff(isnotempty(InitiatedBy.user.userPrincipalName),InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName))\n| project-reorder TimeGenerated, OAuthAppName, AppId, AdminConsent, Permissions, GrantIpAddress, GrantInitiatedBy, GrantUserAgent, GrantScope1, GrantConsentType\n| extend Name = split(GrantInitiatedBy, \"@\")[0], UPNSuffix = split(GrantInitiatedBy, \"@\")[1]\n",
+ "query": "let account_threshold = 5;\nAADNonInteractiveUserSignInLogs\n//| where ResultType == \"81016\"\n| where ResultType startswith \"81\"\n| summarize DistinctAccounts = dcount(UserPrincipalName), DistinctAddresses = make_set(IPAddress,100) by ResultType\n| where DistinctAccounts > account_threshold\n| mv-expand IPAddress = DistinctAddresses\n| extend IPAddress = tostring(IPAddress)\n| join kind=leftouter (union isfuzzy=true SigninLogs, AADNonInteractiveUserSignInLogs) on IPAddress\n| summarize\n StartTime = min(TimeGenerated),\n EndTime = max(TimeGenerated),\n UserPrincipalName = make_set(UserPrincipalName,100),\n UserAgent = make_set(UserAgent,100),\n ResultDescription = take_any(ResultDescription),\n ResultSignature = take_any(ResultSignature)\n by IPAddress, Type, ResultType\n| project Type, StartTime, EndTime, IPAddress, ResultType, ResultDescription, ResultSignature, UserPrincipalName, UserAgent = iff(array_length(UserAgent) == 1, UserAgent[0], UserAgent)\n| extend Name = tostring(split(UserPrincipalName[0],'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName[0],'@',1)[0])\n",
"queryFrequency": "PT1H",
"queryPeriod": "PT1H",
"severity": "Medium",
@@ -7863,63 +6543,54 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "DefenseEvasion"
+ "CredentialAccess"
],
"techniques": [
- "T1550"
+ "T1110"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "GrantIpAddress"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
- ],
- "customDetails": {
- "UserAgent": "GrantUserAgent",
- "OAuthAppId": "AppId",
- "OAuthApplication": "OAuthAppName"
- },
- "alertDetailsOverride": {
- "alertDisplayNameFormat": "User {{GrantInitiatedBy}} granted full_access_as_app to {{OAuthAppName}}",
- "alertDescriptionFormat": "This detection looks for the full_access_as_app permission being granted to an OAuth application with Admin Consent.\nThis permission provide access to all Exchange mailboxes via the EWS API can could be exploited to access sensitive data \nby being added to a compromised application. The application granted this permission should be reviewed to ensure that it \nis absolutely necessary for the applications function.\nIn this case {{GrantInitiatedBy}} granted full_access_as_app to {{OAuthAppName}} from {{GrantIpAddress}}\nRef: https://learn.microsoft.com/graph/auth-limit-mailbox-access\n"
- }
+ ]
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId25'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId46'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 25",
- "parentId": "[variables('analyticRuleId25')]",
- "contentId": "[variables('_analyticRulecontentId25')]",
+ "description": "Azure Active Directory Analytics Rule 46",
+ "parentId": "[variables('analyticRuleId46')]",
+ "contentId": "[variables('_analyticRulecontentId46')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion25')]",
+ "version": "[variables('analyticRuleVersion46')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -7944,44 +6615,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId25')]",
+ "contentId": "[variables('_analyticRulecontentId46')]",
"contentKind": "AnalyticsRule",
- "displayName": "full_access_as_app Granted To Application",
- "contentProductId": "[variables('_analyticRulecontentProductId25')]",
- "id": "[variables('_analyticRulecontentProductId25')]",
- "version": "[variables('analyticRuleVersion25')]"
+ "displayName": "Password spray attack against Azure AD Seamless SSO",
+ "contentProductId": "[variables('_analyticRulecontentProductId46')]",
+ "id": "[variables('_analyticRulecontentProductId46')]",
+ "version": "[variables('analyticRuleVersion46')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName26')]",
+ "name": "[variables('analyticRuleTemplateSpecName47')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "FailedLogonToAzurePortal_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Sign-in Burst from Multiple Locations_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion26')]",
+ "contentVersion": "[variables('analyticRuleVersion47')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId26')]",
+ "name": "[variables('analyticRulecontentId47')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies failed login attempts in the Azure Active Directory SigninLogs to the Azure Portal. Many failed logon\nattempts or some failed logon attempts from multiple IPs could indicate a potential brute force attack.\nThe following are excluded due to success and non-failure results:\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\n0 - successful logon\n50125 - Sign-in was interrupted due to a password reset or password registration entry.\n50140 - This error occurred due to 'Keep me signed in' interrupt when the user was signing-in.",
- "displayName": "Failed login attempts to Azure Portal",
+ "description": "This detection triggers when there is a Signin burst from multiple locations in GitHub (AAD SSO).\n This detection is based on configurable threshold which can be prone to false positives. To view the anomaly based equivalent of thie detection, please see here https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Azure%20Active%20Directory/Analytic%20Rules/AnomalousUserAppSigninLocationIncrease-detection.yaml. ",
+ "displayName": "GitHub Signin Burst from Multiple Locations",
"enabled": false,
- "query": "let timeRange = 1d;\nlet lookBack = 7d;\nlet threshold_Failed = 5;\nlet threshold_FailedwithSingleIP = 20;\nlet threshold_IPAddressCount = 2;\nlet isGUID = \"[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}\";\nlet aadFunc = (tableName:string){\nlet azPortalSignins = materialize(table(tableName)\n| where TimeGenerated >= ago(lookBack)\n// Azure Portal only\n| where AppDisplayName =~ \"Azure Portal\")\n;\nlet successPortalSignins = azPortalSignins\n| where TimeGenerated >= ago(timeRange)\n// Azure Portal only and exclude non-failure Result Types\n| where ResultType in (\"0\", \"50125\", \"50140\")\n// Tagging identities not resolved to friendly names\n//| extend Unresolved = iff(Identity matches regex isGUID, true, false)\n| distinct TimeGenerated, UserPrincipalName\n;\nlet failPortalSignins = azPortalSignins\n| where TimeGenerated >= ago(timeRange)\n// Azure Portal only and exclude non-failure Result Types\n| where ResultType !in (\"0\", \"50125\", \"50140\", \"70044\", \"70043\")\n// Tagging identities not resolved to friendly names\n| extend Unresolved = iff(Identity matches regex isGUID, true, false)\n;\n// Verify there is no success for the same connection attempt after the fail\nlet failnoSuccess = failPortalSignins | join kind= leftouter (\n successPortalSignins\n) on UserPrincipalName\n| where TimeGenerated > TimeGenerated1 or isempty(TimeGenerated1)\n| project-away TimeGenerated1, UserPrincipalName1\n;\n// Lookup up resolved identities from last 7 days\nlet identityLookup = azPortalSignins\n| where TimeGenerated >= ago(lookBack)\n| where not(Identity matches regex isGUID)\n| summarize by UserId, lu_UserDisplayName = UserDisplayName, lu_UserPrincipalName = UserPrincipalName;\n// Join resolved names to unresolved list from portal signins\nlet unresolvedNames = failnoSuccess | where Unresolved == true | join kind= inner (\n identityLookup\n) on UserId\n| extend UserDisplayName = lu_UserDisplayName, UserPrincipalName = lu_UserPrincipalName\n| project-away lu_UserDisplayName, lu_UserPrincipalName;\n// Join Signins that had resolved names with list of unresolved that now have a resolved name\nlet u_azPortalSignins = failnoSuccess | where Unresolved == false | union unresolvedNames;\nu_azPortalSignins\n| extend DeviceDetail = todynamic(DeviceDetail), Status = todynamic(DeviceDetail), LocationDetails = todynamic(LocationDetails)\n| extend Status = strcat(ResultType, \": \", ResultDescription), OS = tostring(DeviceDetail.operatingSystem), Browser = tostring(DeviceDetail.browser)\n| extend State = tostring(LocationDetails.state), City = tostring(LocationDetails.city), Region = tostring(LocationDetails.countryOrRegion)\n| extend FullLocation = strcat(Region,'|', State, '|', City) \n| summarize TimeGenerated = make_list(TimeGenerated,100), Status = make_list(Status,100), IPAddresses = make_list(IPAddress,100), IPAddressCount = dcount(IPAddress), FailedLogonCount = count()\nby UserPrincipalName, UserId, UserDisplayName, AppDisplayName, Browser, OS, FullLocation, Type\n| mvexpand TimeGenerated, IPAddresses, Status\n| extend TimeGenerated = todatetime(tostring(TimeGenerated)), IPAddress = tostring(IPAddresses), Status = tostring(Status)\n| project-away IPAddresses\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by UserPrincipalName, UserId, UserDisplayName, Status, FailedLogonCount, IPAddress, IPAddressCount, AppDisplayName, Browser, OS, FullLocation, Type\n| where (IPAddressCount >= threshold_IPAddressCount and FailedLogonCount >= threshold_Failed) or FailedLogonCount >= threshold_FailedwithSingleIP\n| extend timestamp = StartTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P7D",
- "severity": "Low",
+ "query": "let locationThreshold = 1;\nlet aadFunc = (tableName:string){\ntable(tableName)\n| where AppDisplayName =~ \"GitHub.com\"\n| where ResultType == 0\n| summarize CountOfLocations = dcount(Location), Locations = make_set(Location,100), BurstStartTime = min(TimeGenerated), BurstEndTime = max(TimeGenerated) by UserPrincipalName, Type\n| where CountOfLocations > locationThreshold\n| extend timestamp = BurstStartTime\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n| extend Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "PT1H",
+ "severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -7989,16 +6660,16 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"SigninLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
},
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AADNonInteractiveUserSignInLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
@@ -8009,26 +6680,17 @@
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IPAddress"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
}
]
}
@@ -8036,13 +6698,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId26'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId47'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 26",
- "parentId": "[variables('analyticRuleId26')]",
- "contentId": "[variables('_analyticRulecontentId26')]",
+ "description": "Azure Active Directory Analytics Rule 47",
+ "parentId": "[variables('analyticRuleId47')]",
+ "contentId": "[variables('_analyticRulecontentId47')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion26')]",
+ "version": "[variables('analyticRuleVersion47')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -8067,44 +6729,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId26')]",
+ "contentId": "[variables('_analyticRulecontentId47')]",
"contentKind": "AnalyticsRule",
- "displayName": "Failed login attempts to Azure Portal",
- "contentProductId": "[variables('_analyticRulecontentProductId26')]",
- "id": "[variables('_analyticRulecontentProductId26')]",
- "version": "[variables('analyticRuleVersion26')]"
+ "displayName": "GitHub Signin Burst from Multiple Locations",
+ "contentProductId": "[variables('_analyticRulecontentProductId47')]",
+ "id": "[variables('_analyticRulecontentProductId47')]",
+ "version": "[variables('analyticRuleVersion47')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName27')]",
+ "name": "[variables('analyticRuleTemplateSpecName48')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "FirstAppOrServicePrincipalCredential_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "SigninAttemptsByIPviaDisabledAccounts_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion27')]",
+ "contentVersion": "[variables('analyticRuleVersion48')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId27')]",
+ "name": "[variables('analyticRulecontentId48')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This will alert when an admin or app owner account adds a new credential to an Application or Service Principal where there was no previous verify KeyCredential associated.\nIf a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\nAdditional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "First access credential added to Application or Service Principal where no credential was present",
+ "description": "Identifies IPs with failed attempts to sign in to one or more disabled accounts using the IP through which successful signins from other accounts have happened.\nThis could indicate an attacker who obtained credentials for a list of accounts and is attempting to login with those accounts, some of which may have already been disabled.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\n50057 - User account is disabled. The account has been disabled by an administrator.\nThis query has also been updated to include UEBA logs IdentityInfo and BehaviorAnalytics for contextual information around the results.",
+ "displayName": "Sign-ins from IPs that attempt sign-ins to disabled accounts",
"enabled": false,
- "query": "AuditLogs\n| where OperationName has (\"Certificates and secrets management\")\n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"Application\"\n | extend targetDisplayName = tostring(TargetResource.displayName),\n targetId = tostring(TargetResource.id),\n targetType = tostring(TargetResource.type),\n keyEvents = TargetResource.modifiedProperties\n )\n| mv-apply Property = keyEvents on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend new_value_set = parse_json(tostring(Property.newValue)),\n old_value_set = parse_json(tostring(Property.oldValue))\n )\n| where old_value_set == \"[]\" \n| mv-expand new_value_set\n| parse new_value_set with * \"KeyIdentifier=\" keyIdentifier:string \",KeyType=\" keyType:string \",KeyUsage=\" keyUsage:string \",DisplayName=\" keyDisplayName:string \"]\" *\n| where keyUsage =~ \"Verify\"\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| project-away new_value_set, old_value_set\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, InitiatingIpAddress, UserAgent, targetDisplayName, targetId, targetType, keyDisplayName, keyType, keyUsage, keyIdentifier, CorrelationId, TenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT1H",
- "severity": "High",
+ "query": "let aadFunc = (tableName: string) {\nlet failed_signins = table(tableName)\n| where ResultType == \"50057\"\n| where ResultDescription == \"User account is disabled. The account has been disabled by an administrator.\";\nlet disabled_users = failed_signins | summarize by UserPrincipalName;\ntable(tableName)\n | where ResultType == 0\n | where isnotempty(UserPrincipalName)\n | where UserPrincipalName !in (disabled_users)\n| summarize\n successfulAccountsTargettedCount = dcount(UserPrincipalName),\n successfulAccountSigninSet = make_set(UserPrincipalName, 100),\n successfulApplicationSet = make_set(AppDisplayName, 100)\n by IPAddress, Type\n // Assume IPs associated with sign-ins from 100+ distinct user accounts are safe\n | where successfulAccountsTargettedCount < 50\n | where isnotempty(successfulAccountsTargettedCount)\n | join kind=inner (failed_signins\n| summarize\n StartTime = min(TimeGenerated),\n EndTime = max(TimeGenerated),\n totalDisabledAccountLoginAttempts = count(),\n disabledAccountsTargettedCount = dcount(UserPrincipalName),\n applicationsTargeted = dcount(AppDisplayName),\n disabledAccountSet = make_set(UserPrincipalName, 100),\n disabledApplicationSet = make_set(AppDisplayName, 100)\nby IPAddress, Type\n| order by totalDisabledAccountLoginAttempts desc) on IPAddress\n| project StartTime, EndTime, IPAddress, totalDisabledAccountLoginAttempts, disabledAccountsTargettedCount, disabledAccountSet, disabledApplicationSet, successfulApplicationSet, successfulAccountsTargettedCount, successfulAccountSigninSet, Type\n| order by totalDisabledAccountLoginAttempts};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n| join kind=leftouter (\n BehaviorAnalytics\n | where ActivityType in (\"FailedLogOn\", \"LogOn\")\n | where EventSource =~ \"Azure AD\"\n | project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress, UserPrincipalName\n | project-rename IPAddress = SourceIPAddress\n | summarize\n Users = make_set(UserPrincipalName, 100),\n UsersInsights = make_set(UsersInsights, 100),\n DevicesInsights = make_set(DevicesInsights, 100),\n IPInvestigationPriority = sum(InvestigationPriority)\n by IPAddress\n) on IPAddress\n| extend SFRatio = toreal(toreal(disabledAccountsTargettedCount)/toreal(successfulAccountsTargettedCount))\n| where SFRatio >= 0.5\n| sort by IPInvestigationPriority desc\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P1D",
+ "severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -8112,49 +6774,41 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "BehaviorAnalytics"
+ ],
+ "connectorId": "BehaviorAnalytics"
}
],
"tactics": [
- "DefenseEvasion"
+ "InitialAccess",
+ "Persistence"
],
"techniques": [
- "T1550"
+ "T1078",
+ "T1098"
],
"entityMappings": [
{
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "InitiatingIpAddress"
- }
- ]
- },
- {
- "entityType": "CloudApplication",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "targetDisplayName"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -8162,13 +6816,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId27'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId48'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 27",
- "parentId": "[variables('analyticRuleId27')]",
- "contentId": "[variables('_analyticRulecontentId27')]",
+ "description": "Azure Active Directory Analytics Rule 48",
+ "parentId": "[variables('analyticRuleId48')]",
+ "contentId": "[variables('_analyticRulecontentId48')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion27')]",
+ "version": "[variables('analyticRuleVersion48')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -8193,44 +6847,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId27')]",
+ "contentId": "[variables('_analyticRulecontentId48')]",
"contentKind": "AnalyticsRule",
- "displayName": "First access credential added to Application or Service Principal where no credential was present",
- "contentProductId": "[variables('_analyticRulecontentProductId27')]",
- "id": "[variables('_analyticRulecontentProductId27')]",
- "version": "[variables('analyticRuleVersion27')]"
+ "displayName": "Sign-ins from IPs that attempt sign-ins to disabled accounts",
+ "contentProductId": "[variables('_analyticRulecontentProductId48')]",
+ "id": "[variables('_analyticRulecontentProductId48')]",
+ "version": "[variables('analyticRuleVersion48')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName28')]",
+ "name": "[variables('analyticRuleTemplateSpecName49')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "GuestAccountsAddedinAADGroupsOtherThanTheOnesSpecified_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "SigninBruteForce-AzurePortal_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion28')]",
+ "contentVersion": "[variables('analyticRuleVersion49')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId28')]",
+ "name": "[variables('analyticRulecontentId49')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Guest Accounts are added in the Organization Tenants to perform various tasks i.e projects execution, support etc.. This detection notifies when guest users are added to Azure AD Groups other than the ones specified and poses a risk to gain access to sensitive apps or data.",
- "displayName": "Guest accounts added in AAD Groups other than the ones specified",
+ "description": "Identifies evidence of brute force activity against Azure Portal by highlighting multiple authentication failures and by a successful authentication within a given time window. \nDefault Failure count is 10 and default Time Window is 20 minutes.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes.",
+ "displayName": "Brute force attack against Azure Portal",
"enabled": false,
- "query": "// OBJECT ID of AAD Groups can be found by navigating to Azure Active Directory then from menu on the left, select Groups and from the list shown of AAD Groups, the Second Column shows the ObjectID of each\nlet GroupIDs = dynamic([\"List with Custom AAD GROUP OBJECT ID 1\",\"Custom AAD GROUP OBJECT ID 2\"]);\nAuditLogs\n| where OperationName in ('Add member to group', 'Add owner to group')\n| extend InitiatedByActionUserInformation = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n| extend InitiatedByIPAdress = InitiatedBy.user.ipAddress \n// Uncomment the following line to filter events where the inviting user was a guest user\n//| where InitiatedBy has_any (\"CUSTOM DOMAIN NAME#\", \"#EXT#\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend InvitedUser = trim(@'\"',tostring(TargetResource.userPrincipalName)),\n Properties = TargetResource.modifiedProperties\n )\n| mv-apply Property = Properties on \n (\n where Property.displayName =~ \"Group.DisplayName\"\n | extend AADGroup = trim('\"',tostring(Property.newValue))\n )\n| where InvitedUser has_any (\"CUSTOM DOMAIN NAME#\", \"#EXT#\")\n| mv-apply Property = Properties on\n (\n where Property.displayName =~ \"Group.ObjectID\"\n | extend AADGroupId = trim('\"',tostring(Property.newValue))\n )\n| where AADGroupId !in (GroupIDs)\n| extend Name = tostring(split(InitiatedByActionUserInformation,'@',0)[0]), UPNSuffix = tostring(split(InitiatedByActionUserInformation,'@',1)[0])\n",
+ "query": "let timeRange = 24h;\nlet failureCountThreshold = 10;\nlet authenticationWindow = 20m;\nlet aadFunc = (tableName:string){\n table(tableName)\n| where AppDisplayName has \"Azure Portal\"\n| extend\n DeviceDetail = todynamic(DeviceDetail),\n //Status = todynamic(Status),\n LocationDetails = todynamic(LocationDetails)\n| extend\n OS = tostring(DeviceDetail.operatingSystem),\n Browser = tostring(DeviceDetail.browser),\n //StatusCode = tostring(Status.errorCode),\n //StatusDetails = tostring(Status.additionalDetails),\n State = tostring(LocationDetails.state),\n City = tostring(LocationDetails.city),\n Region = tostring(LocationDetails.countryOrRegion)\n// Split out failure versus non-failure types\n| extend FailureOrSuccess = iff(ResultType in (\"0\", \"50125\", \"50140\", \"70043\", \"70044\"), \"Success\", \"Failure\") \n// sort for sessionizing - by UserPrincipalName and time of the authentication outcome\n| sort by UserPrincipalName asc, TimeGenerated asc\n// sessionize into failure groupings until either the account changes or there is a success\n| extend SessionStartedUtc = row_window_session(TimeGenerated, timeRange, authenticationWindow, UserPrincipalName != prev(UserPrincipalName) or prev(FailureOrSuccess) == \"Success\")\n// bin outcomes based on authenticationWindow\n| summarize FailureOrSuccessCount = count() by FailureOrSuccess, UserId, UserDisplayName, AppDisplayName, IPAddress, Browser, OS, State, City, Region, Type, CorrelationId, bin(TimeGenerated, authenticationWindow), ResultType, UserPrincipalName,SessionStartedUtc\n// count the failures in each session\n| summarize FailureCountBeforeSuccess=sumif(FailureOrSuccessCount, FailureOrSuccess == \"Failure\"), StartTime=min(TimeGenerated), EndTime=max(TimeGenerated), makelist(FailureOrSuccess), IPAddress = make_set(IPAddress,15), make_set(Browser,15), make_set(City,15), make_set(State,15), make_set(Region,15), make_set(ResultType,15) by SessionStartedUtc, UserPrincipalName, CorrelationId, AppDisplayName, UserId, Type\n// the session must not start with a success, and must end with one\n| where array_index_of(list_FailureOrSuccess, \"Success\") != 0\n| where array_index_of(list_FailureOrSuccess, \"Success\") == array_length(list_FailureOrSuccess) - 1\n| project-away SessionStartedUtc, list_FailureOrSuccess\n// where the number of failures before the success is above the threshold \n| where FailureCountBeforeSuccess >= failureCountThreshold \n// expand out ip for entity assignment\n| mv-expand IPAddress\n| extend IPAddress = tostring(IPAddress)\n| extend timestamp = StartTime \n};\n let aadSignin = aadFunc(\"SigninLogs\");\n let aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\n union isfuzzy=true aadSignin, aadNonInt\n | extend Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
"queryFrequency": "P1D",
"queryPeriod": "P1D",
- "severity": "High",
+ "severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -8238,53 +6892,46 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess",
- "Persistence",
- "Discovery"
+ "CredentialAccess"
],
"techniques": [
- "T1078",
- "T1136",
- "T1087"
+ "T1110"
],
"entityMappings": [
{
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "InvitedUser"
- }
- ]
- },
- {
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatedByIPAdress"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -8292,13 +6939,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId28'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId49'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 28",
- "parentId": "[variables('analyticRuleId28')]",
- "contentId": "[variables('_analyticRulecontentId28')]",
+ "description": "Azure Active Directory Analytics Rule 49",
+ "parentId": "[variables('analyticRuleId49')]",
+ "contentId": "[variables('_analyticRulecontentId49')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion28')]",
+ "version": "[variables('analyticRuleVersion49')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -8323,43 +6970,43 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId28')]",
+ "contentId": "[variables('_analyticRulecontentId49')]",
"contentKind": "AnalyticsRule",
- "displayName": "Guest accounts added in AAD Groups other than the ones specified",
- "contentProductId": "[variables('_analyticRulecontentProductId28')]",
- "id": "[variables('_analyticRulecontentProductId28')]",
- "version": "[variables('analyticRuleVersion28')]"
+ "displayName": "Brute force attack against Azure Portal",
+ "contentProductId": "[variables('_analyticRulecontentProductId49')]",
+ "id": "[variables('_analyticRulecontentProductId49')]",
+ "version": "[variables('analyticRuleVersion49')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName29')]",
+ "name": "[variables('analyticRuleTemplateSpecName50')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "MailPermissionsAddedToApplication_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "SigninPasswordSpray_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion29')]",
+ "contentVersion": "[variables('analyticRuleVersion50')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId29')]",
+ "name": "[variables('analyticRulecontentId50')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This query look for applications that have been granted (Delegated or App/Role) permissions to Read Mail (Permissions field has Mail.Read) and subsequently has been consented to. This can help identify applications that have been abused to gain access to mailboxes.",
- "displayName": "Mail.Read Permissions Granted to Application",
+ "description": "Identifies evidence of password spray activity against Azure AD applications by looking for failures from multiple accounts from the same\nIP address within a time window. If the number of accounts breaches the threshold just once, all failures from the IP address within the time range\nare bought into the result. Details on whether there were successful authentications by the IP address within the time window are also included.\nThis can be an indicator that an attack was successful.\nThe default failure acccount threshold is 5, Default time window for failures is 20m and default look back window is 3 days\nNote: Due to the number of possible accounts involved in a password spray it is not possible to map identities to a custom entity.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes.",
+ "displayName": "Password spray attack against Azure AD application",
"enabled": false,
- "query": "AuditLogs\n| where Category =~ \"ApplicationManagement\"\n| where ActivityDisplayName has_any (\"Add delegated permission grant\",\"Add app role assignment to service principal\") \n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend props = TargetResource.modifiedProperties,\n Type = tostring(TargetResource.type),\n PermissionsAddedTo = tostring(TargetResource.displayName)\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"DelegatedPermissionGrant.Scope\"\n | extend DisplayName = tostring(Property.displayName), Permissions = trim('\"',tostring(Property.newValue))\n )\n| where Permissions has_any (\"Mail.Read\", \"Mail.ReadWrite\")\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName)\n| extend UserIPAddress = tostring(InitiatedBy.user.ipAddress) \n| project-away props, TargetResource*, AdditionalDetail*, Property, InitiatedBy\n| join kind=leftouter(\n AuditLogs\n | where ActivityDisplayName has \"Consent to application\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend AppName = tostring(TargetResource.displayName),\n AppId = tostring(TargetResource.id)\n )\n | project AppName, AppId, CorrelationId) on CorrelationId\n| project-reorder TimeGenerated, OperationName, InitiatingUser, UserIPAddress, UserAgent, PermissionsAddedTo, Permissions, AppName, AppId, CorrelationId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUser,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUser,'@',1)[0])\n",
+ "query": "let timeRange = 3d;\nlet lookBack = 7d;\nlet authenticationWindow = 20m;\nlet authenticationThreshold = 5;\nlet isGUID = \"[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}\";\nlet failureCodes = dynamic([50053, 50126, 50055]); // invalid password, account is locked - too many sign ins, expired password\nlet successCodes = dynamic([0, 50055, 50057, 50155, 50105, 50133, 50005, 50076, 50079, 50173, 50158, 50072, 50074, 53003, 53000, 53001, 50129]);\n// Lookup up resolved identities from last 7 days\nlet aadFunc = (tableName:string){\nlet identityLookup = table(tableName)\n| where TimeGenerated >= ago(lookBack)\n| where not(Identity matches regex isGUID)\n| where isnotempty(UserId)\n| summarize by UserId, lu_UserDisplayName = UserDisplayName, lu_UserPrincipalName = UserPrincipalName, Type;\n// collect window threshold breaches\ntable(tableName)\n| where TimeGenerated > ago(timeRange)\n| where ResultType in(failureCodes)\n| summarize FailedPrincipalCount = dcount(UserPrincipalName) by bin(TimeGenerated, authenticationWindow), IPAddress, AppDisplayName, Type\n| where FailedPrincipalCount >= authenticationThreshold\n| summarize WindowThresholdBreaches = count() by IPAddress, Type\n| join kind= inner (\n// where we breached a threshold, join the details back on all failure data\ntable(tableName)\n| where TimeGenerated > ago(timeRange)\n| where ResultType in(failureCodes)\n| extend LocationDetails = todynamic(LocationDetails)\n| extend FullLocation = strcat(LocationDetails.countryOrRegion,'|', LocationDetails.state, '|', LocationDetails.city)\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), make_set(ClientAppUsed,20), make_set(FullLocation,20), FailureCount = count() by IPAddress, AppDisplayName, UserPrincipalName, UserDisplayName, Identity, UserId, Type\n// lookup any unresolved identities\n| extend UnresolvedUserId = iff(Identity matches regex isGUID, UserId, \"\")\n| join kind= leftouter (\n identityLookup\n) on $left.UnresolvedUserId==$right.UserId\n| extend UserDisplayName=iff(isempty(lu_UserDisplayName), UserDisplayName, lu_UserDisplayName)\n| extend UserPrincipalName=iff(isempty(lu_UserPrincipalName), UserPrincipalName, lu_UserPrincipalName)\n| summarize StartTime = min(StartTime), EndTime = max(EndTime), make_set(UserPrincipalName,20), make_set(UserDisplayName,20), make_set(set_ClientAppUsed,20), make_set(set_FullLocation,20), make_list(FailureCount,20) by IPAddress, AppDisplayName, Type\n| extend FailedPrincipalCount = array_length(set_UserPrincipalName)\n) on IPAddress\n| project IPAddress, StartTime, EndTime, TargetedApplication=AppDisplayName, FailedPrincipalCount, UserPrincipalNames=set_UserPrincipalName, UserDisplayNames=set_UserDisplayName, ClientAppsUsed=set_set_ClientAppUsed, Locations=set_set_FullLocation, FailureCountByPrincipal=list_FailureCount, WindowThresholdBreaches, Type\n| join kind= inner (\ntable(tableName) // get data on success vs. failure history for each IP\n| where TimeGenerated > ago(timeRange)\n| where ResultType in(successCodes) or ResultType in(failureCodes) // success or failure types\n| summarize GlobalSuccessPrincipalCount = dcountif(UserPrincipalName, (ResultType in (successCodes))), ResultTypeSuccesses = make_set_if(ResultType, (ResultType in (successCodes))), GlobalFailPrincipalCount = dcountif(UserPrincipalName, (ResultType in (failureCodes))), ResultTypeFailures = make_set_if(ResultType, (ResultType in (failureCodes))) by IPAddress, Type\n| where GlobalFailPrincipalCount > GlobalSuccessPrincipalCount // where the number of failed principals is greater than success - eliminates FPs from IPs who authenticate successfully alot and as a side effect have alot of failures\n) on IPAddress\n| project-away IPAddress1\n| extend timestamp=StartTime\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
"queryFrequency": "P1D",
- "queryPeriod": "P1D",
+ "queryPeriod": "P7D",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
@@ -8368,40 +7015,33 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "Persistence"
+ "CredentialAccess"
],
"techniques": [
- "T1098"
+ "T1110"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "UserIPAddress"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -8409,13 +7049,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId29'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId50'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 29",
- "parentId": "[variables('analyticRuleId29')]",
- "contentId": "[variables('_analyticRulecontentId29')]",
+ "description": "Azure Active Directory Analytics Rule 50",
+ "parentId": "[variables('analyticRuleId50')]",
+ "contentId": "[variables('_analyticRulecontentId50')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion29')]",
+ "version": "[variables('analyticRuleVersion50')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -8440,44 +7080,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId29')]",
+ "contentId": "[variables('_analyticRulecontentId50')]",
"contentKind": "AnalyticsRule",
- "displayName": "Mail.Read Permissions Granted to Application",
- "contentProductId": "[variables('_analyticRulecontentProductId29')]",
- "id": "[variables('_analyticRulecontentProductId29')]",
- "version": "[variables('analyticRuleVersion29')]"
+ "displayName": "Password spray attack against Azure AD application",
+ "contentProductId": "[variables('_analyticRulecontentProductId50')]",
+ "id": "[variables('_analyticRulecontentProductId50')]",
+ "version": "[variables('analyticRuleVersion50')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName30')]",
+ "name": "[variables('analyticRuleTemplateSpecName51')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "MaliciousOAuthApp_O365AttackToolkit_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "SuccessThenFail_DiffIP_SameUserandApp_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion30')]",
+ "contentVersion": "[variables('analyticRuleVersion51')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId30')]",
+ "name": "[variables('analyticRulecontentId51')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This will alert when a user consents to provide a previously-unknown Azure application with the same OAuth permissions used by the MDSec O365 Attack Toolkit (https://github.com/mdsecactivebreach/o365-attack-toolkit).\nThe default permissions/scope for the MDSec O365 Attack toolkit change sometimes but often include contacts.read, user.read, mail.read, notes.read.all, mailboxsettings.readwrite, files.readwrite.all, mail.send, files.read, and files.read.all.\nConsent to applications with these permissions should be rare, especially as the knownApplications list is expanded, especially as the knownApplications list is expanded. Public contributions to expand this filter are welcome!\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "Suspicious application consent similar to O365 Attack Toolkit",
+ "description": "Identifies when a user account successfully logs onto an Azure App from one IP and within 10 mins failed to logon to the same App via a different IP (may indicate a malicious attempt at password guessing with known account). UEBA added for context.",
+ "displayName": "Successful logon from IP and failure from a different IP",
"enabled": false,
- "query": "let detectionTime = 1d;\nlet joinLookback = 14d;\nlet threshold = 5;\nlet o365_attack_regex = \"contacts.read|user.read|mail.read|notes.read.all|mailboxsettings.readwrite|Files.ReadWrite.All|mail.send|files.read|files.read.all\";\nlet o365_attack = dynamic([\"contacts.read\", \"user.read\", \"mail.read\", \"notes.read.all\", \"mailboxsettings.readwrite\", \"Files.ReadWrite.All\", \"mail.send\", \"files.read\", \"files.read.all\"]);\nAuditLogs\n| where TimeGenerated > ago(detectionTime)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Consent to application\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend AppDisplayName = tostring(TargetResource.displayName),\n AppClientId = tostring(TargetResource.id),\n props = TargetResource.modifiedProperties\n )\n| where AppClientId !in ((externaldata(knownAppClientId:string, knownAppDisplayName:string)[@\"https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/Sample%20Data/Feeds/Microsoft.OAuth.KnownApplications.csv\"] with (format=\"csv\"))) // NOTE: a MATCH from this list will cause the alert to NOT fire - please modify for your environment!\n| mv-apply ConsentFull = props on \n (\n where ConsentFull.displayName =~ \"ConsentAction.Permissions\"\n )\n| parse ConsentFull with * \"ConsentType: \" GrantConsentType \", Scope: \" GrantScope1 \", CreatedDateTime\" * \"]\" *\n| where GrantConsentType != \"AllPrincipals\" // NOTE: we are ignoring if OAuth application was granted to all users via an admin - but admin due diligence should be audited occasionally\n| where ConsentFull has_any (o365_attack) \n| extend GrantScopeCount = countof(tolower(GrantScope1), o365_attack_regex, 'regex')\n| where GrantScopeCount > threshold\n| extend GrantIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| extend GrantInitiatedBy = iff(isnotempty(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend GrantUserAgent = AdditionalDetail.value\n )\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, GrantIpAddress, GrantUserAgent, AppClientId, OperationName, ConsentFull, CorrelationId\n| join kind = leftouter (AuditLogs\n | where TimeGenerated > ago(joinLookback)\n | where LoggedByService =~ \"Core Directory\"\n | where Category =~ \"ApplicationManagement\"\n | where OperationName =~ \"Add service principal\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend props = TargetResource.modifiedProperties,\n AppClientId = tostring(TargetResource.id)\n )\n | mv-apply Property = props on \n (\n where Property.displayName =~ \"AppAddress\" and Property.newValue has \"AddressType\"\n | extend AppReplyURLs = trim('\"',tostring(Property.newValue))\n )\n | distinct AppClientId, tostring(AppReplyURLs)\n) on AppClientId\n| join kind = innerunique (AuditLogs\n | where TimeGenerated > ago(joinLookback)\n | where LoggedByService =~ \"Core Directory\"\n | where Category =~ \"ApplicationManagement\"\n | where OperationName =~ \"Add OAuth2PermissionGrant\" or OperationName =~ \"Add delegated permission grant\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend GrantAuthentication = tostring(TargetResource.displayName)\n )\n | extend GrantOperation = OperationName\n | project GrantAuthentication, GrantOperation, CorrelationId\n ) on CorrelationId\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, AppReplyURLs, GrantIpAddress, GrantUserAgent, AppClientId, GrantAuthentication, OperationName, GrantOperation, CorrelationId, ConsentFull\n| extend timestamp = TimeGenerated, Name = tostring(split(GrantInitiatedBy,'@',0)[0]), UPNSuffix = tostring(split(GrantInitiatedBy,'@',1)[0])\n",
+ "query": "let riskScoreCutoff = 20; //Adjust this based on volume of results\nlet logonDiff = 10m; let aadFunc = (tableName:string){ table(tableName)\n| where ResultType == \"0\"\n| where AppDisplayName !in (\"Office 365 Exchange Online\", \"Skype for Business Online\") // To remove false-positives, add more Apps to this array\n// ---------- Fix for SuccessBlock to also consider IPv6\n| extend SuccessIPv6Block = strcat(split(IPAddress, \":\")[0], \":\", split(IPAddress, \":\")[1], \":\", split(IPAddress, \":\")[2], \":\", split(IPAddress, \":\")[3])\n| extend SuccessIPv4Block = strcat(split(IPAddress, \".\")[0], \".\", split(IPAddress, \".\")[1])\n// ------------------\n| project SuccessLogonTime = TimeGenerated, UserPrincipalName, SuccessIPAddress = IPAddress, SuccessLocation = Location, AppDisplayName, SuccessIPBlock = iff(IPAddress contains \":\", strcat(split(IPAddress, \":\")[0], \":\", split(IPAddress, \":\")[1]), strcat(split(IPAddress, \".\")[0], \".\", split(IPAddress, \".\")[1])), Type\n| join kind= inner (\n table(tableName)\n | where ResultType !in (\"0\", \"50140\")\n | where ResultDescription !~ \"Other\"\n | where AppDisplayName !in (\"Office 365 Exchange Online\", \"Skype for Business Online\")\n | project FailedLogonTime = TimeGenerated, UserPrincipalName, FailedIPAddress = IPAddress, FailedLocation = Location, AppDisplayName, ResultType, ResultDescription, Type \n) on UserPrincipalName, AppDisplayName\n| where SuccessLogonTime < FailedLogonTime and FailedLogonTime - SuccessLogonTime <= logonDiff and FailedIPAddress !startswith SuccessIPBlock\n| summarize FailedLogonTime = max(FailedLogonTime), SuccessLogonTime = max(SuccessLogonTime) by UserPrincipalName, SuccessIPAddress, SuccessLocation, AppDisplayName, FailedIPAddress, FailedLocation, ResultType, ResultDescription, Type\n| extend timestamp = SuccessLogonTime\n| extend UserPrincipalName = tolower(UserPrincipalName)};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n| extend Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n// UEBA context below - make sure you have these 2 datatypes, otherwise the query will not work. If so, comment all that is below.\n| join kind=leftouter (\n IdentityInfo\n | summarize LatestReportTime = arg_max(TimeGenerated, *) by AccountUPN\n | extend BlastRadiusInt = iif(BlastRadius == \"High\", 1, 0)\n | project AccountUPN, Tags, JobTitle, GroupMembership, AssignedRoles, UserType, IsAccountEnabled, BlastRadiusInt\n | summarize\n Tags = make_set(Tags, 1000),\n GroupMembership = make_set(GroupMembership, 1000),\n AssignedRoles = make_set(AssignedRoles, 1000),\n BlastRadiusInt = sum(BlastRadiusInt),\n UserType = make_set(UserType, 1000),\n UserAccountControl = make_set(UserType, 1000)\n by AccountUPN\n | extend UserPrincipalName=tolower(AccountUPN)\n) on UserPrincipalName\n| join kind=leftouter (\n BehaviorAnalytics\n | where ActivityType in (\"FailedLogOn\", \"LogOn\")\n | where isnotempty(SourceIPAddress)\n | project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress\n | project-rename FailedIPAddress = SourceIPAddress\n | summarize\n UsersInsights = make_set(UsersInsights, 1000),\n DevicesInsights = make_set(DevicesInsights, 1000),\n IPInvestigationPriority = sum(InvestigationPriority)\n by FailedIPAddress)\non FailedIPAddress\n| extend UEBARiskScore = BlastRadiusInt + IPInvestigationPriority\n| where UEBARiskScore > riskScoreCutoff\n| sort by UEBARiskScore desc \n",
"queryFrequency": "P1D",
- "queryPeriod": "P14D",
- "severity": "High",
+ "queryPeriod": "P1D",
+ "severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -8485,51 +7125,69 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "BehaviorAnalytics"
+ ],
+ "connectorId": "BehaviorAnalytics"
+ },
+ {
+ "dataTypes": [
+ "IdentityInfo"
+ ],
+ "connectorId": "IdentityInfo"
}
],
"tactics": [
"CredentialAccess",
- "DefenseEvasion"
+ "InitialAccess"
],
"techniques": [
- "T1528",
- "T1550"
+ "T1110",
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "GrantIpAddress"
+ "columnName": "SuccessIPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
},
{
- "entityType": "CloudApplication",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "AppDisplayName"
+ "columnName": "FailedIPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -8537,13 +7195,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId30'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId51'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 30",
- "parentId": "[variables('analyticRuleId30')]",
- "contentId": "[variables('_analyticRulecontentId30')]",
+ "description": "Azure Active Directory Analytics Rule 51",
+ "parentId": "[variables('analyticRuleId51')]",
+ "contentId": "[variables('_analyticRulecontentId51')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion30')]",
+ "version": "[variables('analyticRuleVersion51')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -8568,43 +7226,43 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId30')]",
+ "contentId": "[variables('_analyticRulecontentId51')]",
"contentKind": "AnalyticsRule",
- "displayName": "Suspicious application consent similar to O365 Attack Toolkit",
- "contentProductId": "[variables('_analyticRulecontentProductId30')]",
- "id": "[variables('_analyticRulecontentProductId30')]",
- "version": "[variables('analyticRuleVersion30')]"
+ "displayName": "Successful logon from IP and failure from a different IP",
+ "contentProductId": "[variables('_analyticRulecontentProductId51')]",
+ "id": "[variables('_analyticRulecontentProductId51')]",
+ "version": "[variables('analyticRuleVersion51')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName31')]",
+ "name": "[variables('analyticRuleTemplateSpecName52')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "MaliciousOAuthApp_PwnAuth_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "SuspiciousAADJoinedDeviceUpdate_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion31')]",
+ "contentVersion": "[variables('analyticRuleVersion52')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId31')]",
+ "name": "[variables('analyticRulecontentId52')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
- "properties": {
- "description": "This will alert when a user consents to provide a previously-unknown Azure application with the same OAuth permissions used by the FireEye PwnAuth toolkit (https://github.com/fireeye/PwnAuth).\nThe default permissions/scope for the PwnAuth toolkit are user.read, offline_access, mail.readwrite, mail.send, and files.read.all.\nConsent to applications with these permissions should be rare, especially as the knownApplications list is expanded. Public contributions to expand this filter are welcome!\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "Suspicious application consent similar to PwnAuth",
+ "properties": {
+ "description": "This query looks for suspicious updates to an Azure AD joined device where the device name is changed and the device falls out of compliance.\nThis could occur when a threat actor updates the details of an Autopilot provisioned device using a stolen device ticket, in order to access certificates and keys.\nRef: https://dirkjanm.io/assets/raw/Insomnihack%20Breaking%20and%20fixing%20Azure%20AD%20device%20identity%20security.pdf",
+ "displayName": "Suspicious AAD Joined Device Update",
"enabled": false,
- "query": "let detectionTime = 1d;\nlet joinLookback = 14d;\nAuditLogs\n| where TimeGenerated > ago(detectionTime)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Consent to application\"\n| where TargetResources has \"offline\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend AppDisplayName = tostring(TargetResource.displayName),\n AppClientId = tostring(TargetResource.id),\n props = TargetResource.modifiedProperties\n )\n| where AppClientId !in ((externaldata(knownAppClientId:string, knownAppDisplayName:string)[@\"https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/Sample%20Data/Feeds/Microsoft.OAuth.KnownApplications.csv\"] with (format=\"csv\")))\n| mv-apply ConsentFull = props on \n (\n where ConsentFull.displayName =~ \"ConsentAction.Permissions\"\n )\n| parse ConsentFull with * \"ConsentType: \" GrantConsentType \", Scope: \" GrantScope1 \"]\" *\n| where ConsentFull has_all (\"user.read\", \"offline_access\", \"mail.readwrite\", \"mail.send\", \"files.read.all\")\n| where GrantConsentType != \"AllPrincipals\" // NOTE: we are ignoring if OAuth application was granted to all users via an admin - but admin due diligence should be audited occasionally\n| extend GrantIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| extend GrantInitiatedBy = iff(isnotempty(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend GrantUserAgent = AdditionalDetail.value\n )\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, GrantIpAddress, GrantUserAgent, AppClientId, OperationName, ConsentFull, CorrelationId\n| join kind = leftouter (AuditLogs\n| where TimeGenerated > ago(joinLookback)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Add service principal\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend props = TargetResource.modifiedProperties,\n AppClientId = tostring(TargetResource.id)\n )\n | mv-apply Property = props on \n (\n where Property.displayName =~ \"AppAddress\" and Property.newValue has \"AddressType\"\n | extend AppReplyURLs = trim('\"',tostring(Property.newValue))\n )\n| distinct AppClientId, tostring(AppReplyURLs)\n)\non AppClientId\n| join kind = innerunique (AuditLogs\n| where TimeGenerated > ago(joinLookback)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Add OAuth2PermissionGrant\" or OperationName =~ \"Add delegated permission grant\"\n | mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend GrantAuthentication = tostring(TargetResource.displayName)\n )\n| extend GrantOperation = OperationName\n| project GrantAuthentication, GrantOperation, CorrelationId\n) on CorrelationId\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, AppReplyURLs, GrantIpAddress, GrantUserAgent, AppClientId, GrantAuthentication, OperationName, GrantOperation, CorrelationId, ConsentFull\n| extend timestamp = TimeGenerated, Name = tostring(split(GrantInitiatedBy,'@',0)[0]), UPNSuffix = tostring(split(GrantInitiatedBy,'@',1)[0])\n",
+ "query": "AuditLogs\n| where OperationName =~ \"Update device\"\n| mv-apply TargetResource=TargetResources on (\n where TargetResource.type =~ \"Device\"\n | extend ModifiedProperties = TargetResource.modifiedProperties\n | extend DeviceId = TargetResource.id)\n| mv-apply Prop=ModifiedProperties on ( \n where Prop.displayName =~ \"CloudDisplayName\"\n | extend OldName = Prop.oldValue \n | extend NewName = Prop.newValue)\n| mv-apply Prop=ModifiedProperties on ( \n where Prop.displayName =~ \"IsCompliant\"\n | extend OldComplianceState = Prop.oldValue \n | extend NewComplianceState = Prop.newValue)\n| mv-apply Prop=ModifiedProperties on ( \n where Prop.displayName =~ \"TargetId.DeviceTrustType\"\n | extend OldTrustType = Prop.oldValue \n | extend NewTrustType = Prop.newValue)\n| mv-apply Prop=ModifiedProperties on ( \n where Prop.displayName =~ \"Included Updated Properties\" \n | extend UpdatedProperties = Prop.newValue)\n| extend OldDeviceName = tostring(parse_json(tostring(OldName))[0])\n| extend NewDeviceName = tostring(parse_json(tostring(NewName))[0])\n| extend OldComplianceState = tostring(parse_json(tostring(OldComplianceState))[0])\n| extend NewComplianceState = tostring(parse_json(tostring(NewComplianceState))[0])\n| extend InitiatedByUser = tostring(iff(isnotempty(InitiatedBy.user.userPrincipalName),InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName))\n| extend UpdatedPropertiesCount = array_length(split(UpdatedProperties, ','))\n| where OldDeviceName != NewDeviceName\n| where OldComplianceState =~ 'true' and NewComplianceState =~ 'false'\n// Most common is transferring from AAD Registered to AAD Joined - we just want AAD Joined devices\n| where NewTrustType == '\"AzureAd\"' and OldTrustType != '\"Workplace\"'\n// We can modify this value to tune FPs - more properties changed about the device beyond its name the more suspicious it could be\n| where UpdatedPropertiesCount > 1\n| project-reorder TimeGenerated, DeviceId, NewDeviceName, OldDeviceName, NewComplianceState, InitiatedByUser, AADOperationType, OldTrustType, NewTrustType, UpdatedProperties, UpdatedPropertiesCount\n",
"queryFrequency": "P1D",
- "queryPeriod": "P14D",
+ "queryPeriod": "P1D",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
@@ -8613,56 +7271,72 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "CredentialAccess",
- "DefenseEvasion"
+ "CredentialAccess"
],
"techniques": [
- "T1528",
- "T1550"
+ "T1528"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
- },
+ "columnName": "NewDeviceName",
+ "identifier": "HostName"
+ }
+ ],
+ "entityType": "Host"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "OldDeviceName",
+ "identifier": "HostName"
+ }
+ ],
+ "entityType": "Host"
+ },
+ {
+ "fieldMappings": [
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "DeviceId",
+ "identifier": "AzureID"
}
- ]
+ ],
+ "entityType": "Host"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "GrantIpAddress"
+ "columnName": "InitiatedByUser",
+ "identifier": "AadUserId"
}
- ]
+ ],
+ "entityType": "Account"
}
- ]
+ ],
+ "alertDetailsOverride": {
+ "alertDescriptionFormat": "This query looks for suspicious updates to an Azure AD joined device where the device name is changed and the device falls out of compliance.\nIn this case {{OldDeviceName}} was renamed to {{NewDeviceName}} and {{UpdatedPropertiesCount}} properties were changed.\nThis could occur when a threat actor steals a Device ticket from an Autopilot provisioned device and uses it to AAD Join a new device.\nRef: https://dirkjanm.io/assets/raw/Insomnihack%20Breaking%20and%20fixing%20Azure%20AD%20device%20identity%20security.pdf\n",
+ "alertDisplayNameFormat": "Suspicious AAD Joined Device Update {{OldDeviceName}} renamed to {{NewDeviceName}} and {{UpdatedPropertiesCount}} properties changed"
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId31'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId52'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 31",
- "parentId": "[variables('analyticRuleId31')]",
- "contentId": "[variables('_analyticRulecontentId31')]",
+ "description": "Azure Active Directory Analytics Rule 52",
+ "parentId": "[variables('analyticRuleId52')]",
+ "contentId": "[variables('_analyticRulecontentId52')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion31')]",
+ "version": "[variables('analyticRuleVersion52')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -8687,44 +7361,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId31')]",
+ "contentId": "[variables('_analyticRulecontentId52')]",
"contentKind": "AnalyticsRule",
- "displayName": "Suspicious application consent similar to PwnAuth",
- "contentProductId": "[variables('_analyticRulecontentProductId31')]",
- "id": "[variables('_analyticRulecontentProductId31')]",
- "version": "[variables('analyticRuleVersion31')]"
+ "displayName": "Suspicious AAD Joined Device Update",
+ "contentProductId": "[variables('_analyticRulecontentProductId52')]",
+ "id": "[variables('_analyticRulecontentProductId52')]",
+ "version": "[variables('analyticRuleVersion52')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName32')]",
+ "name": "[variables('analyticRuleTemplateSpecName53')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "MFARejectedbyUser_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "SuspiciousOAuthApp_OfflineAccess_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion32')]",
+ "contentVersion": "[variables('analyticRuleVersion53')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId32')]",
+ "name": "[variables('analyticRulecontentId53')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies occurances where a user has rejected an MFA prompt. This could be an indicator that a threat actor has compromised the username and password of this user account and is using it to try and log into the account.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#monitoring-for-failed-unusual-sign-ins\nThis query has also been updated to include UEBA logs IdentityInfo and BehaviorAnalytics for contextual information around the results.",
- "displayName": "MFA Rejected by User",
+ "description": "This will alert when a user consents to provide a previously-unknown Azure application with offline access via OAuth.\nOffline access will provide the Azure App with access to the listed resources without requiring two-factor authentication.\nConsent to applications with offline access and read capabilities should be rare, especially as the knownApplications list is expanded. Public contributions to expand this filter are welcome!\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
+ "displayName": "Suspicious application consent for offline access",
"enabled": false,
- "query": "let riskScoreCutoff = 20; //Adjust this based on volume of results\nSigninLogs\n| where ResultType == 500121\n| extend additionalDetails_ = tostring(Status.additionalDetails)\n| extend UserPrincipalName = tolower(UserPrincipalName)\n| where additionalDetails_ =~ \"MFA denied; user declined the authentication\" or additionalDetails_ has \"fraud\"\n| summarize StartTime = min(TimeGenerated), EndTIme = max(TimeGenerated) by UserPrincipalName, UserId, AADTenantId, IPAddress\n| extend Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n| join kind=leftouter (\n IdentityInfo\n | summarize LatestReportTime = arg_max(TimeGenerated, *) by AccountUPN\n | extend BlastRadiusInt = iif(BlastRadius == \"High\", 1, 0)\n | project AccountUPN, Tags, JobTitle, GroupMembership, AssignedRoles, UserType, IsAccountEnabled, BlastRadiusInt\n | summarize\n Tags = make_set(Tags, 1000),\n GroupMembership = make_set(GroupMembership, 1000),\n AssignedRoles = make_set(AssignedRoles, 1000),\n BlastRadiusInt = sum(BlastRadiusInt),\n UserType = make_set(UserType, 1000),\n UserAccountControl = make_set(UserType, 1000)\n by AccountUPN\n | extend UserPrincipalName=tolower(AccountUPN)\n) on UserPrincipalName\n| join kind=leftouter (\n BehaviorAnalytics\n | where ActivityType in (\"FailedLogOn\", \"LogOn\")\n | where isnotempty(SourceIPAddress)\n | project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress\n | project-rename IPAddress = SourceIPAddress\n | summarize\n UsersInsights = make_set(UsersInsights, 1000),\n DevicesInsights = make_set(DevicesInsights, 1000),\n IPInvestigationPriority = sum(InvestigationPriority)\n by IPAddress)\non IPAddress\n| extend UEBARiskScore = BlastRadiusInt + IPInvestigationPriority\n| where UEBARiskScore > riskScoreCutoff\n| sort by UEBARiskScore desc \n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT1H",
- "severity": "Medium",
+ "query": "let detectionTime = 1d;\nlet joinLookback = 14d;\nAuditLogs\n| where TimeGenerated > ago(detectionTime)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Consent to application\"\n| where TargetResources has \"offline\"\n| mv-apply TargetResource=TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend ModifiedProperties = TargetResource.modifiedProperties,\n AppDisplayName = tostring(TargetResource.displayName),\n AppClientId = tolower(tostring(TargetResource.id))\n )\n| where AppClientId !in ((externaldata(knownAppClientId:string, knownAppDisplayName:string)[@\"https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/Sample%20Data/Feeds/Microsoft.OAuth.KnownApplications.csv\"] with (format=\"csv\")))\n| mv-apply Properties=ModifiedProperties on \n (\n where Properties.displayName =~ \"ConsentAction.Permissions\"\n | extend ConsentFull = tostring(Properties.newValue)\n | extend ConsentFull = trim(@'\"',tostring(ConsentFull))\n )\n| parse ConsentFull with * \"ConsentType: \" GrantConsentType \", Scope: \" GrantScope1 \"]\" *\n| where ConsentFull has \"offline_access\" and ConsentFull has_any (\"Files.Read\", \"Mail.Read\", \"Notes.Read\", \"ChannelMessage.Read\", \"Chat.Read\", \"TeamsActivity.Read\", \"Group.Read\", \"EWS.AccessAsUser.All\", \"EAS.AccessAsUser.All\")\n| where GrantConsentType != \"AllPrincipals\" // NOTE: we are ignoring if OAuth application was granted to all users via an admin - but admin due diligence should be audited occasionally\n| extend GrantIpAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))\n| extend GrantInitiatedBy = tostring(iff(isnotempty(InitiatedBy.user.userPrincipalName),InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName))\n| extend GrantUserAgent = tostring(iff(AdditionalDetails[0].key =~ \"User-Agent\", AdditionalDetails[0].value, \"\"))\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, GrantIpAddress, GrantUserAgent, AppClientId, OperationName, ConsentFull, CorrelationId\n| join kind = leftouter (AuditLogs\n| where TimeGenerated > ago(joinLookback)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Add service principal\"\n| mv-apply TargetResource=TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend ModifiedProperties = TargetResource.modifiedProperties,\n AppClientId = tolower(TargetResource.id)\n )\n| mv-apply ModifiedProperties=TargetResource.modifiedProperties on \n (\n where ModifiedProperties.displayName =~ \"AppAddress\" and ModifiedProperties.newValue has \"AddressType\"\n | extend AppReplyURLs = ModifiedProperties.newValue\n )\n | distinct AppClientId, tostring(AppReplyURLs)\n)\non AppClientId\n| join kind = innerunique (AuditLogs\n| where TimeGenerated > ago(joinLookback)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Add OAuth2PermissionGrant\" or OperationName =~ \"Add delegated permission grant\"\n | mv-apply TargetResource=TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend GrantAuthentication = tostring(TargetResource.displayName)\n )\n| extend GrantOperation = OperationName\n| project GrantAuthentication, GrantOperation, CorrelationId\n) on CorrelationId\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, AppReplyURLs, GrantIpAddress, GrantUserAgent, AppClientId, GrantAuthentication, OperationName, GrantOperation, CorrelationId, ConsentFull\n| extend timestamp = TimeGenerated, Name = tostring(split(GrantInitiatedBy,'@',0)[0]), UPNSuffix = tostring(split(GrantInitiatedBy,'@',1)[0])\n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P14D",
+ "severity": "Low",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -8732,56 +7406,40 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "BehaviorAnalytics",
- "dataTypes": [
- "BehaviorAnalytics"
- ]
- },
- {
- "connectorId": "IdentityInfo",
"dataTypes": [
- "IdentityInfo"
- ]
+ "AuditLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "InitialAccess"
+ "CredentialAccess"
],
"techniques": [
- "T1078"
+ "T1528"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "AadUserId",
- "columnName": "UserId"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IPAddress"
+ "columnName": "GrantIpAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -8789,13 +7447,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId32'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId53'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 32",
- "parentId": "[variables('analyticRuleId32')]",
- "contentId": "[variables('_analyticRulecontentId32')]",
+ "description": "Azure Active Directory Analytics Rule 53",
+ "parentId": "[variables('analyticRuleId53')]",
+ "contentId": "[variables('_analyticRulecontentId53')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion32')]",
+ "version": "[variables('analyticRuleVersion53')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -8820,44 +7478,44 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId32')]",
+ "contentId": "[variables('_analyticRulecontentId53')]",
"contentKind": "AnalyticsRule",
- "displayName": "MFA Rejected by User",
- "contentProductId": "[variables('_analyticRulecontentProductId32')]",
- "id": "[variables('_analyticRulecontentProductId32')]",
- "version": "[variables('analyticRuleVersion32')]"
+ "displayName": "Suspicious application consent for offline access",
+ "contentProductId": "[variables('_analyticRulecontentProductId53')]",
+ "id": "[variables('_analyticRulecontentProductId53')]",
+ "version": "[variables('analyticRuleVersion53')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName33')]",
+ "name": "[variables('analyticRuleTemplateSpecName54')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "MultipleAdmin_membership_removals_from_NewAdmin_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "SuspiciousServicePrincipalcreationactivity_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion33')]",
+ "contentVersion": "[variables('analyticRuleVersion54')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId33')]",
+ "name": "[variables('analyticRulecontentId54')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This query detects when newly created Global admin removes multiple existing global admins which can be an attempt by adversaries to lock down organization and retain sole access. \n Investigate reasoning and intention of multiple membership removal by new Global admins and take necessary actions accordingly.",
- "displayName": "Multiple admin membership removals from newly created admin.",
+ "description": "This alert will detect creation of an SPN, permissions granted, credentials created, activity and deletion of the SPN in a time frame (default 10 minutes)",
+ "displayName": "Suspicious Service Principal creation activity",
"enabled": false,
- "query": "let lookback = 7d; \nlet timeframe = 1h; \nlet GlobalAdminsRemoved = AuditLogs \n| where TimeGenerated > ago(timeframe) \n| where Category =~ \"RoleManagement\" \n| where AADOperationType in (\"Unassign\", \"RemoveEligibleRole\") \n| where ActivityDisplayName has_any (\"Remove member from role\", \"Remove eligible member from role\") \n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = tostring(TargetResource.userPrincipalName),\n props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"Role.DisplayName\"\n | extend RoleName = trim('\"',tostring(Property.oldValue))\n )\n| where RoleName =~ \"Global Administrator\" // Add other Privileged role if applicable \n| extend InitiatingApp = tostring(InitiatedBy.app.displayName) \n| extend Initiator = iif(isnotempty(InitiatingApp), InitiatingApp, tostring(InitiatedBy.user.userPrincipalName)) \n| where Initiator != \"MS-PIM\" // Filtering PIM events \n| summarize RemovedGlobalAdminTime = max(TimeGenerated), TargetAdmins = make_set(Target,100) by OperationName, RoleName, Initiator, Result; \nlet GlobalAdminsAdded = AuditLogs \n| where TimeGenerated > ago(lookback) \n| where Category =~ \"RoleManagement\" \n| where AADOperationType in (\"Assign\", \"AssignEligibleRole\") \n| where ActivityDisplayName has_any (\"Add eligible member to role\", \"Add member to role\") and Result == \"success\" \n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = tostring(TargetResource.userPrincipalName),\n props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"Role.DisplayName\"\n | extend RoleName = trim('\"',tostring(Property.newValue))\n )\n| where RoleName =~ \"Global Administrator\" // Add other Privileged role if applicable \n| extend InitiatingApp = tostring(InitiatedBy.app.displayName) \n| extend Initiator = iif(isnotempty(InitiatingApp), InitiatingApp, tostring(InitiatedBy.user.userPrincipalName)) \n| where Initiator != \"MS-PIM\" // Filtering PIM events \n| summarize AddedGlobalAdminTime = max(TimeGenerated) by OperationName, RoleName, Target, Initiator, Result \n| extend AccountCustomEntity = Target; \nGlobalAdminsAdded \n| join kind= inner GlobalAdminsRemoved on $left.Target == $right.Initiator \n| where AddedGlobalAdminTime < RemovedGlobalAdminTime \n| extend NoofAdminsRemoved = array_length(TargetAdmins) \n| where NoofAdminsRemoved > 1\n| project AddedGlobalAdminTime, Initiator, Target, AccountCustomEntity, RemovedGlobalAdminTime, TargetAdmins, NoofAdminsRemoved\n| extend Name = tostring(split(AccountCustomEntity,'@',0)[0]), UPNSuffix = tostring(split(AccountCustomEntity,'@',1)[0])\n",
+ "query": "let queryfrequency = 1h;\nlet wait_for_deletion = 10m;\nlet account_created =\n AuditLogs \n | where ActivityDisplayName == \"Add service principal\"\n | where Result == \"success\"\n | extend AppID = tostring(AdditionalDetails[1].value)\n | extend creationTime = ActivityDateTime\n | extend userPrincipalName_creator = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)\n | extend ipAddress_creator = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress);\nlet account_activity =\n AADServicePrincipalSignInLogs\n | extend Activities = pack(\"ActivityTime\", TimeGenerated ,\"IpAddress\", IPAddress, \"ResourceDisplayName\", ResourceDisplayName)\n | extend AppID = AppId\n | summarize make_list(Activities) by AppID;\nlet account_deleted =\n AuditLogs \n | where OperationName == \"Remove service principal\"\n | where Result == \"success\"\n | extend AppID = tostring(AdditionalDetails[1].value)\n | extend deletionTime = ActivityDateTime\n | extend userPrincipalName_deleter = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)\n | extend ipAddress_deleter = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress);\nlet account_credentials =\n AuditLogs\n | where OperationName has_all (\"Update application\", \"Certificates and secrets management\")\n | where Result == \"success\"\n | extend AppID = tostring(AdditionalDetails[1].value)\n | extend credentialCreationTime = ActivityDateTime;\nlet roles_assigned =\n AuditLogs\n | where ActivityDisplayName == \"Add app role assignment to service principal\"\n | extend AppID = tostring(TargetResources[1].displayName)\n | extend AssignedRole = iff(tostring(parse_json(tostring(TargetResources[0].modifiedProperties))[1].displayName)==\"AppRole.Value\", tostring(parse_json(tostring(parse_json(tostring(TargetResources[0].modifiedProperties))[1].newValue))),\"\")\n | extend AssignedRoles = pack(\"Role\", AssignedRole)\n | summarize make_list(AssignedRoles) by AppID;\naccount_created\n| where TimeGenerated between (ago(wait_for_deletion+queryfrequency)..ago(wait_for_deletion))\n| join kind= inner (account_activity) on AppID\n| join kind= inner (account_deleted) on AppID\n| join kind= inner (account_credentials) on AppID\n| join kind= inner (roles_assigned) on AppID\n| where deletionTime - creationTime between (time(0s)..wait_for_deletion)\n| extend AliveTime = deletionTime - creationTime\n| project AADTenantId, AppID, creationTime, deletionTime, userPrincipalName_creator, userPrincipalName_deleter, ipAddress_creator, ipAddress_deleter, list_Activities, list_AssignedRoles, AliveTime\n",
"queryFrequency": "PT1H",
- "queryPeriod": "P7D",
- "severity": "Medium",
+ "queryPeriod": "PT70M",
+ "severity": "Low",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
"triggerOperator": "GreaterThan",
@@ -8865,31 +7523,58 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "AuditLogs",
+ "AADServicePrincipalSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "Impact"
+ "CredentialAccess",
+ "PrivilegeEscalation",
+ "InitialAccess"
],
"techniques": [
- "T1531"
+ "T1078",
+ "T1528"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
- },
+ "columnName": "userPrincipalName_creator",
+ "identifier": "FullName"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "userPrincipalName_deleter",
+ "identifier": "FullName"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "ipAddress_creator",
+ "identifier": "Address"
+ }
+ ],
+ "entityType": "IP"
+ },
+ {
+ "fieldMappings": [
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "ipAddress_deleter",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -8897,13 +7582,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId33'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId54'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 33",
- "parentId": "[variables('analyticRuleId33')]",
- "contentId": "[variables('_analyticRulecontentId33')]",
+ "description": "Azure Active Directory Analytics Rule 54",
+ "parentId": "[variables('analyticRuleId54')]",
+ "contentId": "[variables('_analyticRulecontentId54')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion33')]",
+ "version": "[variables('analyticRuleVersion54')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -8928,43 +7613,43 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId33')]",
+ "contentId": "[variables('_analyticRulecontentId54')]",
"contentKind": "AnalyticsRule",
- "displayName": "Multiple admin membership removals from newly created admin.",
- "contentProductId": "[variables('_analyticRulecontentProductId33')]",
- "id": "[variables('_analyticRulecontentProductId33')]",
- "version": "[variables('analyticRuleVersion33')]"
+ "displayName": "Suspicious Service Principal creation activity",
+ "contentProductId": "[variables('_analyticRulecontentProductId54')]",
+ "id": "[variables('_analyticRulecontentProductId54')]",
+ "version": "[variables('analyticRuleVersion54')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName34')]",
+ "name": "[variables('analyticRuleTemplateSpecName55')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "NewAppOrServicePrincipalCredential_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "UnusualGuestActivity_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion34')]",
+ "contentVersion": "[variables('analyticRuleVersion55')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId34')]",
+ "name": "[variables('analyticRulecontentId55')]",
"apiVersion": "2022-04-01-preview",
"kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This will alert when an admin or app owner account adds a new credential to an Application or Service Principal where a verify KeyCredential was already present for the app.\nIf a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\nAdditional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "New access credential added to Application or Service Principal",
+ "description": "By default guests have capability to invite more external guest users, guests also can do suspicious Azure AD enumeration. This detection look at guests\nusers, who have been invited or have invited recently, who also are logging via various PowerShell CLI.\nRef : 'https://danielchronlund.com/2021/11/18/scary-azure-ad-tenant-enumeration-using-regular-b2b-guest-accounts/",
+ "displayName": "External guest invitation followed by Azure AD PowerShell signin",
"enabled": false,
- "query": "AuditLogs\n| where OperationName has_any (\"Add service principal\", \"Certificates and secrets management\") // captures \"Add service principal\", \"Add service principal credentials\", and \"Update application - Certificates and secrets management\" events\n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"Application\"\n | extend targetDisplayName = tostring(TargetResource.displayName),\n targetId = tostring(TargetResource.id),\n targetType = tostring(TargetResource.type),\n keyEvents = TargetResource.modifiedProperties\n )\n| mv-apply Property = keyEvents on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend new_value_set = parse_json(tostring(Property.newValue)),\n old_value_set = parse_json(tostring(Property.oldValue))\n )\n| where old_value_set != \"[]\"\n| extend diff = set_difference(new_value_set, old_value_set)\n| where isnotempty(diff)\n| parse diff with * \"KeyIdentifier=\" keyIdentifier:string \",KeyType=\" keyType:string \",KeyUsage=\" keyUsage:string \",DisplayName=\" keyDisplayName:string \"]\" *\n| where keyUsage =~ \"Verify\"\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n// The below line is currently commented out but Microsoft Sentinel users can modify this query to show only Application or only Service Principal events in their environment\n//| where targetType =~ \"Application\" // or targetType =~ \"ServicePrincipal\"\n| project-away diff, new_value_set, old_value_set\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, InitiatingIpAddress, UserAgent, targetDisplayName, targetId, targetType, keyDisplayName, keyType, keyUsage, keyIdentifier, CorrelationId, TenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
+ "query": "let queryfrequency = 1h;\nlet queryperiod = 1d;\nAuditLogs\n| where TimeGenerated > ago(queryperiod)\n| where OperationName in (\"Invite external user\", \"Bulk invite users - started (bulk)\", \"Invite external user with reset invitation status\")\n| extend InitiatedBy = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n// Uncomment the following line to filter events where the inviting user was a guest user\n//| where InitiatedBy has_any (\"live.com#\", \"#EXT#\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend InvitedUser = tostring(TargetResource.userPrincipalName)\n )\n| mv-expand UserToCompare = pack_array(InitiatedBy, InvitedUser) to typeof(string)\n| where UserToCompare has_any (\"live.com#\", \"#EXT#\")\n| extend\n parsedUser = replace_string(tolower(iff(UserToCompare startswith \"live.com#\", tostring(split(UserToCompare, \"#\")[1]), tostring(split(UserToCompare, \"#EXT#\")[0]))), \"@\", \"_\"),\n InvitationTime = TimeGenerated\n| join (\n (union isfuzzy=true SigninLogs, AADNonInteractiveUserSignInLogs)\n | where TimeGenerated > ago(queryfrequency)\n | where UserType != \"Member\"\n | where AppId has_any // This web may contain a list of these apps: https://msshells.net/\n (\"1b730954-1685-4b74-9bfd-dac224a7b894\",// Azure Active Directory PowerShell\n \"04b07795-8ddb-461a-bbee-02f9e1bf7b46\",// Microsoft Azure CLI\n \"1950a258-227b-4e31-a9cf-717495945fc2\",// Microsoft Azure PowerShell\n \"a0c73c16-a7e3-4564-9a95-2bdf47383716\",// Microsoft Exchange Online Remote PowerShell\n \"fb78d390-0c51-40cd-8e17-fdbfab77341b\",// Microsoft Exchange REST API Based Powershell\n \"d1ddf0e4-d672-4dae-b554-9d5bdfd93547\",// Microsoft Intune PowerShell\n \"9bc3ab49-b65d-410a-85ad-de819febfddc\",// Microsoft SharePoint Online Management Shell\n \"12128f48-ec9e-42f0-b203-ea49fb6af367\",// MS Teams Powershell Cmdlets\n \"23d8f6bd-1eb0-4cc2-a08c-7bf525c67bcd\",// Power BI PowerShell\n \"31359c7f-bd7e-475c-86db-fdb8c937548e\",// PnP Management Shell\n \"90f610bf-206d-4950-b61d-37fa6fd1b224\",// Aadrm Admin Powershell\n \"14d82eec-204b-4c2f-b7e8-296a70dab67e\" // Microsoft Graph PowerShell\n )\n | summarize arg_min(TimeGenerated, *) by UserPrincipalName\n | extend\n parsedUser = replace_string(UserPrincipalName, \"@\", \"_\"),\n SigninTime = TimeGenerated\n )\n on parsedUser\n| project InvitationTime, InitiatedBy, OperationName, InvitedUser, SigninTime, SigninCategory = Category1, SigninUserPrincipalName = UserPrincipalName, IPAddress, AppDisplayName, ResourceDisplayName, UserAgent, InvitationAdditionalDetails = AdditionalDetails, InvitationTargetResources = TargetResources\n| extend InvitedUserName = tostring(split(InvitedUser,'@',0)[0]), InvitedUserUPNSuffix = tostring(split(InvitedUser,'@',1)[0]), \n InitiatedByName = tostring(split(InitiatedBy,'@',0)[0]), InitiatedByUPNSuffix = tostring(split(InitiatedBy,'@',1)[0])\n",
"queryFrequency": "PT1H",
- "queryPeriod": "PT1H",
+ "queryPeriod": "P1D",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
@@ -8973,40 +7658,63 @@
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "DefenseEvasion"
+ "InitialAccess",
+ "Persistence",
+ "Discovery"
],
"techniques": [
- "T1550"
+ "T1078",
+ "T1136",
+ "T1087"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "InvitedUserName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "InvitedUserUPNSuffix",
+ "identifier": "UPNSuffix"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatedByName",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "InitiatedByUPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatingIpAddress"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -9014,13 +7722,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId34'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId55'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 34",
- "parentId": "[variables('analyticRuleId34')]",
- "contentId": "[variables('_analyticRulecontentId34')]",
+ "description": "Azure Active Directory Analytics Rule 55",
+ "parentId": "[variables('analyticRuleId55')]",
+ "contentId": "[variables('_analyticRulecontentId55')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion34')]",
+ "version": "[variables('analyticRuleVersion55')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -9045,78 +7753,103 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId34')]",
+ "contentId": "[variables('_analyticRulecontentId55')]",
"contentKind": "AnalyticsRule",
- "displayName": "New access credential added to Application or Service Principal",
- "contentProductId": "[variables('_analyticRulecontentProductId34')]",
- "id": "[variables('_analyticRulecontentProductId34')]",
- "version": "[variables('analyticRuleVersion34')]"
+ "displayName": "External guest invitation followed by Azure AD PowerShell signin",
+ "contentProductId": "[variables('_analyticRulecontentProductId55')]",
+ "id": "[variables('_analyticRulecontentProductId55')]",
+ "version": "[variables('analyticRuleVersion55')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName35')]",
+ "name": "[variables('analyticRuleTemplateSpecName56')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "NRT_ADFSDomainTrustMods_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "UserAccounts-CABlockedSigninSpikes_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion35')]",
+ "contentVersion": "[variables('analyticRuleVersion56')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId35')]",
+ "name": "[variables('analyticRulecontentId56')]",
"apiVersion": "2022-04-01-preview",
- "kind": "NRT",
+ "kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This will alert when a user or application modifies the federation settings on the domain or Update domain authentication from Managed to Federated.\nFor example, this alert will trigger when a new Active Directory Federated Service (ADFS) TrustedRealm object, such as a signing certificate, is added to the domain.\nModification to domain federation settings should be rare. Confirm the added or modified target domain/URL is legitimate administrator behavior.\nTo understand why an authorized user may update settings for a federated domain in Office 365, Azure, or Intune, see: https://docs.microsoft.com/office365/troubleshoot/active-directory/update-federated-domain-office-365.\nFor details on security realms that accept security tokens, see the ADFS Proxy Protocol (MS-ADFSPP) specification: https://docs.microsoft.com/openspecs/windows_protocols/ms-adfspp/e7b9ea73-1980-4318-96a6-da559486664b.\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "NRT Modified domain federation trust settings",
+ "description": " Identifies spike in failed sign-ins from user accounts due to conditional access policied.\nSpike is determined based on Time series anomaly which will look at historical baseline values.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#monitoring-for-failed-unusual-sign-ins\nThis query has also been updated to include UEBA logs IdentityInfo and BehaviorAnalytics for contextual information around the results.",
+ "displayName": "User Accounts - Sign in Failure due to CA Spikes",
"enabled": false,
- "query": "AuditLogs\n| where OperationName =~ \"Set federation settings on domain\" or OperationName =~ \"Set domain authentication\"\n//| where Result =~ \"success\" // commenting out, as it may be interesting to capture failed attempts\n| mv-expand TargetResources\n| extend modifiedProperties = parse_json(TargetResources).modifiedProperties\n| mv-apply Property = modifiedProperties on \n (\n where Property.displayName =~ \"LiveType\"\n | extend targetDisplayName = tostring(Property.displayName),\n NewDomainValue = tostring(Property.newValue)\n )\n| extend Federated = iif(OperationName =~ \"Set domain authentication\", iif(NewDomainValue has \"Federated\", True, False), True)\n| where Federated == True\n| mv-expand AdditionalDetails\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, AADOperationType, targetDisplayName, Result, InitiatingIpAddress, UserAgent, CorrelationId, TenantId, AADTenantId\n| extend Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
- "severity": "High",
+ "query": "let riskScoreCutoff = 20; //Adjust this based on volume of results\nlet starttime = 14d;\nlet timeframe = 1d;\nlet scorethreshold = 3;\nlet baselinethreshold = 50;\nlet aadFunc = (tableName:string){\n // Failed Signins attempts with reasoning related to conditional access policies.\n table(tableName)\n | where TimeGenerated between (startofday(ago(starttime))..startofday(now()))\n | where ResultDescription has_any (\"conditional access\", \"CA\") or ResultType in (50005, 50131, 53000, 53001, 53002, 52003, 70044)\n | extend UserPrincipalName = tolower(UserPrincipalName)\n | extend timestamp = TimeGenerated, AccountCustomEntity = UserPrincipalName\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nlet allSignins = union isfuzzy=true aadSignin, aadNonInt;\nlet TimeSeriesAlerts = \nallSignins\n| make-series DailyCount=count() on TimeGenerated from startofday(ago(starttime)) to startofday(now()) step 1d by UserPrincipalName\n| extend (anomalies, score, baseline) = series_decompose_anomalies(DailyCount, scorethreshold, -1, 'linefit')\n| mv-expand DailyCount to typeof(double), TimeGenerated to typeof(datetime), anomalies to typeof(double), score to typeof(double), baseline to typeof(long)\n// Filtering low count events per baselinethreshold\n| where anomalies > 0 and baseline > baselinethreshold\n| extend AnomalyHour = TimeGenerated\n| project UserPrincipalName, AnomalyHour, TimeGenerated, DailyCount, baseline, anomalies, score;\n// Filter the alerts for specified timeframe\nTimeSeriesAlerts\n| where TimeGenerated > startofday(ago(timeframe))\n| join kind=inner ( \n allSignins\n | where TimeGenerated > startofday(ago(timeframe))\n // create a new column and round to hour\n | extend DateHour = bin(TimeGenerated, 1h)\n | summarize PartialFailedSignins = count(), LatestAnomalyTime = arg_max(TimeGenerated, *) by bin(TimeGenerated, 1h), OperationName, Category, ResultType, ResultDescription, UserPrincipalName, UserDisplayName, AppDisplayName, ClientAppUsed, IPAddress, ResourceDisplayName\n) on UserPrincipalName, $left.AnomalyHour == $right.DateHour\n| project LatestAnomalyTime, OperationName, Category, UserPrincipalName, UserDisplayName, ResultType, ResultDescription, AppDisplayName, ClientAppUsed, UserAgent, IPAddress, Location, AuthenticationRequirement, ConditionalAccessStatus, ResourceDisplayName, PartialFailedSignins, TotalFailedSignins = DailyCount, baseline, anomalies, score\n| extend timestamp = LatestAnomalyTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n| extend UserPrincipalName = tolower(UserPrincipalName)\n| join kind=leftouter (\n IdentityInfo\n | summarize LatestReportTime = arg_max(TimeGenerated, *) by AccountUPN\n | extend BlastRadiusInt = iif(BlastRadius == \"High\", 1, 0)\n | project AccountUPN, Tags, JobTitle, GroupMembership, AssignedRoles, UserType, IsAccountEnabled, BlastRadiusInt\n | summarize\n Tags = make_set(Tags, 1000),\n GroupMembership = make_set(GroupMembership, 1000),\n AssignedRoles = make_set(AssignedRoles, 1000),\n BlastRadiusInt = sum(BlastRadiusInt),\n UserType = make_set(UserType, 1000),\n UserAccountControl = make_set(UserType, 1000)\n by AccountUPN\n | extend UserPrincipalName=tolower(AccountUPN)\n) on UserPrincipalName\n| join kind=leftouter (\n BehaviorAnalytics\n | where ActivityType in (\"FailedLogOn\", \"LogOn\")\n | where isnotempty(SourceIPAddress)\n | project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress\n | project-rename IPAddress = SourceIPAddress\n | summarize\n UsersInsights = make_set(UsersInsights, 1000),\n DevicesInsights = make_set(DevicesInsights, 1000),\n IPInvestigationPriority = sum(InvestigationPriority)\n by IPAddress)\non IPAddress\n| extend UEBARiskScore = BlastRadiusInt + IPInvestigationPriority\n| where UEBARiskScore > riskScoreCutoff\n| sort by UEBARiskScore desc \n",
+ "queryFrequency": "P1D",
+ "queryPeriod": "P14D",
+ "severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
- "AuditLogs"
- ]
+ "SigninLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "AADNonInteractiveUserSignInLogs"
+ ],
+ "connectorId": "AzureActiveDirectory"
+ },
+ {
+ "dataTypes": [
+ "BehaviorAnalytics"
+ ],
+ "connectorId": "BehaviorAnalytics"
+ },
+ {
+ "dataTypes": [
+ "IdentityInfo"
+ ],
+ "connectorId": "IdentityInfo"
}
],
"tactics": [
- "CredentialAccess"
+ "InitialAccess"
+ ],
+ "techniques": [
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "Name",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatingIpAddress"
+ "columnName": "IPAddress",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
}
]
}
@@ -9124,13 +7857,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId35'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId56'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 35",
- "parentId": "[variables('analyticRuleId35')]",
- "contentId": "[variables('_analyticRulecontentId35')]",
+ "description": "Azure Active Directory Analytics Rule 56",
+ "parentId": "[variables('analyticRuleId56')]",
+ "contentId": "[variables('_analyticRulecontentId56')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion35')]",
+ "version": "[variables('analyticRuleVersion56')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -9155,81 +7888,91 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId35')]",
+ "contentId": "[variables('_analyticRulecontentId56')]",
"contentKind": "AnalyticsRule",
- "displayName": "NRT Modified domain federation trust settings",
- "contentProductId": "[variables('_analyticRulecontentProductId35')]",
- "id": "[variables('_analyticRulecontentProductId35')]",
- "version": "[variables('analyticRuleVersion35')]"
+ "displayName": "User Accounts - Sign in Failure due to CA Spikes",
+ "contentProductId": "[variables('_analyticRulecontentProductId56')]",
+ "id": "[variables('_analyticRulecontentProductId56')]",
+ "version": "[variables('analyticRuleVersion56')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName36')]",
+ "name": "[variables('analyticRuleTemplateSpecName57')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "NRT_AuthenticationMethodsChangedforVIPUsers_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "UseraddedtoPrivilgedGroups_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion36')]",
+ "contentVersion": "[variables('analyticRuleVersion57')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId36')]",
+ "name": "[variables('analyticRulecontentId57')]",
"apiVersion": "2022-04-01-preview",
- "kind": "NRT",
+ "kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies authentication methods being changed for a list of VIP users watchlist. This could be an indication of an attacker adding an auth method to the account so they can have continued access.",
- "displayName": "NRT Authentication Methods Changed for VIP Users",
+ "description": "This will alert when a user is added to any of the Privileged Groups.\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.\nFor Administrator role permissions in Azure Active Directory please see https://docs.microsoft.com/azure/active-directory/users-groups-roles/directory-assign-admin-roles",
+ "displayName": "User added to Azure Active Directory Privileged Groups",
"enabled": false,
- "query": "let security_info_actions = dynamic([\"User registered security info\", \"User changed default security info\", \"User deleted security info\", \"Admin updated security info\", \"User reviewed security info\", \"Admin deleted security info\", \"Admin registered security info\"]);\nlet VIPUsers = (_GetWatchlist('VIPUsers') | distinct [\"User Principal Name\"]);\nAuditLogs\n| where Category =~ \"UserManagement\"\n| where ActivityDisplayName in (security_info_actions)\n| extend Initiator = tostring(InitiatedBy.user.userPrincipalName)\n| extend IP = tostring(InitiatedBy.user.ipAddress)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend Target = trim(@'\"',tolower(tostring(TargetResource.userPrincipalName)))\n )\n| where Target in~ (VIPUsers)\n| summarize Start=min(TimeGenerated), End=max(TimeGenerated), Actions = make_set(ResultReason) by Initiator, IP, Result, Target\n| extend Name = tostring(split(Target,'@',0)[0]), UPNSuffix = tostring(split(Target,'@',1)[0])\n",
+ "query": "let OperationList = dynamic([\"Add member to role\",\"Add member to role in PIM requested (permanent)\"]);\nlet PrivilegedGroups = dynamic([\"UserAccountAdmins\",\"PrivilegedRoleAdmins\",\"TenantAdmins\"]);\nAuditLogs\n//| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"RoleManagement\"\n| where OperationName in~ (OperationList)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend TargetUserPrincipalName = tostring(TargetResource.userPrincipalName),\n modProps = TargetResource.modifiedProperties\n )\n| mv-apply Property = modProps on \n (\n where Property.displayName =~ \"Role.WellKnownObjectName\"\n | extend DisplayName = trim('\"',tostring(Property.displayName)),\n GroupName = trim('\"',tostring(Property.newValue))\n )\n| extend AppId = InitiatedBy.app.appId,\n InitiatedByDisplayName = case(isnotempty(InitiatedBy.app.displayName), InitiatedBy.app.displayName, isnotempty(InitiatedBy.user.displayName), InitiatedBy.user.displayName, \"not available\"),\n ServicePrincipalId = tostring(InitiatedBy.app.servicePrincipalId),\n ServicePrincipalName = tostring(InitiatedBy.app.servicePrincipalName),\n UserId = InitiatedBy.user.id,\n UserIPAddress = InitiatedBy.user.ipAddress,\n UserRoles = InitiatedBy.user.roles,\n UserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)\n| where GroupName in~ (PrivilegedGroups)\n// If you don't want to alert for operations from PIM, remove below filtering for MS-PIM.\n//| where InitiatedByDisplayName != \"MS-PIM\"\n| project TimeGenerated, AADOperationType, Category, OperationName, AADTenantId, AppId, InitiatedByDisplayName, ServicePrincipalId, ServicePrincipalName, DisplayName, GroupName, UserId, UserIPAddress, UserRoles, UserPrincipalName, TargetUserPrincipalName\n| extend AccountCustomEntity = case(isnotempty(ServicePrincipalName), ServicePrincipalName, \n isnotempty(UserPrincipalName), UserPrincipalName, \n \"\")\n| extend AccountName = tostring(split(AccountCustomEntity,'@',0)[0]), AccountUPNSuffix = tostring(split(AccountCustomEntity,'@',1)[0])\n| extend TargetName = tostring(split(TargetUserPrincipalName,'@',0)[0]), TargetUPNSuffix = tostring(split(TargetUserPrincipalName,'@',1)[0])\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "PT1H",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "Persistence"
+ "Persistence",
+ "PrivilegeEscalation"
],
"techniques": [
- "T1098"
+ "T1098",
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "AccountName",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "AccountUPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "IP"
+ "columnName": "TargetName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "TargetUPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
}
]
}
@@ -9237,13 +7980,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId36'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId57'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 36",
- "parentId": "[variables('analyticRuleId36')]",
- "contentId": "[variables('_analyticRulecontentId36')]",
+ "description": "Azure Active Directory Analytics Rule 57",
+ "parentId": "[variables('analyticRuleId57')]",
+ "contentId": "[variables('_analyticRulecontentId57')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion36')]",
+ "version": "[variables('analyticRuleVersion57')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -9268,81 +8011,89 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId36')]",
+ "contentId": "[variables('_analyticRulecontentId57')]",
"contentKind": "AnalyticsRule",
- "displayName": "NRT Authentication Methods Changed for VIP Users",
- "contentProductId": "[variables('_analyticRulecontentProductId36')]",
- "id": "[variables('_analyticRulecontentProductId36')]",
- "version": "[variables('analyticRuleVersion36')]"
+ "displayName": "User added to Azure Active Directory Privileged Groups",
+ "contentProductId": "[variables('_analyticRulecontentProductId57')]",
+ "id": "[variables('_analyticRulecontentProductId57')]",
+ "version": "[variables('analyticRuleVersion57')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName37')]",
+ "name": "[variables('analyticRuleTemplateSpecName58')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "nrt_FirstAppOrServicePrincipalCredential_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "UserAssignedPrivilegedRole_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion37')]",
+ "contentVersion": "[variables('analyticRuleVersion58')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId37')]",
+ "name": "[variables('analyticRulecontentId58')]",
"apiVersion": "2022-04-01-preview",
- "kind": "NRT",
+ "kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This will alert when an admin or app owner account adds a new credential to an Application or Service Principal where there was no previous verify KeyCredential associated.\nIf a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\nAdditional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "NRT First access credential added to Application or Service Principal where no credential was present",
+ "description": "Identifies when a new privileged role is assigned to a user. Any account eligible for a role is now being given privileged access. If the assignment is unexpected or into a role that isn't the responsibility of the account holder, investigate.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor-1",
+ "displayName": "User Assigned Privileged Role",
"enabled": false,
- "query": "AuditLogs\n| where OperationName has_any (\"Add service principal\", \"Certificates and secrets management\")\n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"Application\"\n | extend targetDisplayName = tostring(TargetResource.displayName),\n targetId = tostring(TargetResource.id),\n targetType = tostring(TargetResource.type),\n keyEvents = TargetResource.modifiedProperties\n )\n| mv-apply Property = keyEvents on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend new_value_set = parse_json(tostring(Property.newValue)),\n old_value_set = parse_json(tostring(Property.oldValue))\n )\n| where old_value_set == \"[]\"\n| mv-expand new_value_set\n| parse new_value_set with * \"KeyIdentifier=\" keyIdentifier:string \",KeyType=\" keyType:string \",KeyUsage=\" keyUsage:string \",DisplayName=\" keyDisplayName:string \"]\" *\n| where keyUsage == \"Verify\"\n | mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n//| where targetType =~ \"Application\" // or targetType =~ \"ServicePrincipal\"\n| project-away new_value_set, old_value_set\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, InitiatingIpAddress, UserAgent, targetDisplayName, targetId, targetType, keyDisplayName, keyType, keyUsage, keyIdentifier, CorrelationId, TenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
- "severity": "Medium",
+ "query": "AuditLogs\n| where Category =~ \"RoleManagement\"\n| where AADOperationType in (\"Assign\", \"AssignEligibleRole\")\n| where ActivityDisplayName has_any (\"Add eligible member to role\", \"Add member to role\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type in~ (\"User\", \"ServicePrincipal\")\n | extend Target = iff(TargetResource.type =~ \"ServicePrincipal\", tostring(TargetResource.displayName), tostring(TargetResource.userPrincipalName)),\n props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"Role.DisplayName\"\n | extend RoleName = trim('\"',tostring(Property.newValue))\n )\n| where RoleName contains \"Admin\"\n| extend InitiatingApp = tostring(InitiatedBy.app.displayName)\n| extend Initiator = iif(isnotempty(InitiatingApp), InitiatingApp, tostring(InitiatedBy.user.userPrincipalName))\n// Uncomment below to not alert for PIM activations\n//| where Initiator != \"MS-PIM\"\n| summarize by bin(TimeGenerated, 1h), OperationName, RoleName, Target, Initiator, Result\n| extend TargetName = tostring(split(Target,'@',0)[0]), TargetUPNSuffix = tostring(split(Target,'@',1)[0]), InitiatorName = tostring(split(Initiator,'@',0)[0]), InitiatorUPNSuffix = tostring(split(Initiator,'@',1)[0])\n",
+ "queryFrequency": "PT2H",
+ "queryPeriod": "PT2H",
+ "severity": "High",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "DefenseEvasion"
+ "Persistence"
],
"techniques": [
- "T1550"
+ "T1078"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "TargetName",
+ "identifier": "Name"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "TargetUPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatingIpAddress"
+ "columnName": "InitiatorName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "InitiatorUPNSuffix",
+ "identifier": "UPNSuffix"
}
- ]
+ ],
+ "entityType": "Account"
}
]
}
@@ -9350,13 +8101,13 @@
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId37'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId58'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 37",
- "parentId": "[variables('analyticRuleId37')]",
- "contentId": "[variables('_analyticRulecontentId37')]",
+ "description": "Azure Active Directory Analytics Rule 58",
+ "parentId": "[variables('analyticRuleId58')]",
+ "contentId": "[variables('_analyticRulecontentId58')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion37')]",
+ "version": "[variables('analyticRuleVersion58')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -9381,95 +8132,119 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId37')]",
+ "contentId": "[variables('_analyticRulecontentId58')]",
"contentKind": "AnalyticsRule",
- "displayName": "NRT First access credential added to Application or Service Principal where no credential was present",
- "contentProductId": "[variables('_analyticRulecontentProductId37')]",
- "id": "[variables('_analyticRulecontentProductId37')]",
- "version": "[variables('analyticRuleVersion37')]"
+ "displayName": "User Assigned Privileged Role",
+ "contentProductId": "[variables('_analyticRulecontentProductId58')]",
+ "id": "[variables('_analyticRulecontentProductId58')]",
+ "version": "[variables('analyticRuleVersion58')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName38')]",
+ "name": "[variables('analyticRuleTemplateSpecName59')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "NRT_NewAppOrServicePrincipalCredential_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "NewOnmicrosoftDomainAdded_AnalyticalRules Analytics Rule with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion38')]",
+ "contentVersion": "[variables('analyticRuleVersion59')]",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId38')]",
+ "name": "[variables('analyticRulecontentId59')]",
"apiVersion": "2022-04-01-preview",
- "kind": "NRT",
+ "kind": "Scheduled",
"location": "[parameters('workspace-location')]",
"properties": {
- "description": "This will alert when an admin or app owner account adds a new credential to an Application or Service Principal where a verify KeyCredential was already present for the app.\nIf a threat actor obtains access to an account with sufficient privileges and adds the alternate authentication material triggering this event, the threat actor can now authenticate as the Application or Service Principal using this credential.\nAdditional information on OAuth Credential Grants can be found in RFC 6749 Section 4.4 or https://docs.microsoft.com/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "NRT New access credential added to Application or Service Principal",
+ "description": "This detection looks for new onmicrosoft domains being added to a tenant. \nAn attacker who compromises a tenant may register a new onmicrosoft domain in order to masquerade as a service provider for launching phishing campaigns.\nDomain additions are not a common occurrence and users should validate that the domain was added by a legitimate user, with a legitimate purpose.",
+ "displayName": "New onmicrosoft domain added to tenant",
"enabled": false,
- "query": "AuditLogs\n| where OperationName has_any (\"Add service principal\", \"Certificates and secrets management\") // captures \"Add service principal\", \"Add service principal credentials\", and \"Update application - Certificates and secrets management\" events\n| where Result =~ \"success\"\n| where tostring(InitiatedBy.user.userPrincipalName) has \"@\" or tostring(InitiatedBy.app.displayName) has \"@\"\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"Application\"\n | extend targetDisplayName = tostring(TargetResource.displayName),\n targetId = tostring(TargetResource.id),\n targetType = tostring(TargetResource.type),\n keyEvents = TargetResource.modifiedProperties\n )\n| mv-apply Property = keyEvents on \n (\n where Property.displayName =~ \"KeyDescription\"\n | extend new_value_set = parse_json(tostring(Property.newValue)),\n old_value_set = parse_json(tostring(Property.oldValue))\n )\n| where old_value_set != \"[]\"\n| extend diff = set_difference(new_value_set, old_value_set)\n| where diff != \"[]\"\n| parse diff with * \"KeyIdentifier=\" keyIdentifier:string \",KeyType=\" keyType:string \",KeyUsage=\" keyUsage:string \",DisplayName=\" keyDisplayName:string \"]\" *\n| where keyUsage =~ \"Verify\"\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| extend InitiatingUserOrApp = iff(isnotempty(InitiatedBy.user.userPrincipalName),tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| extend InitiatingIpAddress = iff(isnotempty(InitiatedBy.user.ipAddress), tostring(InitiatedBy.user.ipAddress), tostring(InitiatedBy.app.ipAddress))\n// The below line is currently commented out but Microsoft Sentinel users can modify this query to show only Application or only Service Principal events in their environment\n//| where targetType =~ \"Application\" // or targetType =~ \"ServicePrincipal\"\n| project-away diff, new_value_set, old_value_set\n| project-reorder TimeGenerated, OperationName, InitiatingUserOrApp, InitiatingIpAddress, UserAgent, targetDisplayName, targetId, targetType, keyDisplayName, keyType, keyUsage, keyIdentifier, CorrelationId, TenantId\n| extend timestamp = TimeGenerated, Name = tostring(split(InitiatingUserOrApp,'@',0)[0]), UPNSuffix = tostring(split(InitiatingUserOrApp,'@',1)[0])\n",
+ "query": "AuditLogs\n| where AADOperationType == \"Add\"\n| where Result == \"success\"\n| where OperationName in (\"Add verified domain\", \"Add unverified domain\")\n| extend InitiatedBy = parse_json(InitiatedBy)\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName)\n| extend InitiatingIp = tostring(InitiatedBy.user.ipAddress)\n| extend InitiatingApp = tostring(InitiatedBy.app.displayName)\n| extend InitiatingSPID = tostring(InitiatedBy.app.servicePrincipalId)\n| extend DomainAdded = tostring(TargetResources[0].displayName)\n| where DomainAdded has \"onmicrosoft\"\n| extend ActionInitiatedBy = case(isnotempty(InitiatingUser), InitiatingUser, strcat(InitiatingApp, \" - \", InitiatingSPID))\n| extend UserName = split(InitiatingUser, \"@\")[0]\n| extend UPNSuffix = split(InitiatingUser, \"@\")[1]\n| project-reorder TimeGenerated, OperationName, DomainAdded, ActionInitiatedBy, InitiatingIp\n",
+ "queryFrequency": "PT1H",
+ "queryPeriod": "PT1H",
"severity": "Medium",
"suppressionDuration": "PT1H",
"suppressionEnabled": false,
+ "triggerOperator": "GreaterThan",
+ "triggerThreshold": 0,
"status": "Available",
"requiredDataConnectors": [
{
- "connectorId": "AzureActiveDirectory",
"dataTypes": [
"AuditLogs"
- ]
+ ],
+ "connectorId": "AzureActiveDirectory"
}
],
"tactics": [
- "DefenseEvasion"
+ "ResourceDevelopment"
],
"techniques": [
- "T1550"
+ "T1585"
],
"entityMappings": [
{
- "entityType": "Account",
"fieldMappings": [
{
- "identifier": "Name",
- "columnName": "Name"
+ "columnName": "UserName",
+ "identifier": "Name"
+ },
+ {
+ "columnName": "UPNSuffix",
+ "identifier": "UPNSuffix"
},
{
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "columnName": "InitiatingSPID",
+ "identifier": "AadUserId"
+ }
+ ],
+ "entityType": "Account"
+ },
+ {
+ "fieldMappings": [
+ {
+ "columnName": "InitiatingIp",
+ "identifier": "Address"
}
- ]
+ ],
+ "entityType": "IP"
},
{
- "entityType": "IP",
"fieldMappings": [
{
- "identifier": "Address",
- "columnName": "InitiatingIpAddress"
+ "columnName": "DomainAdded",
+ "identifier": "DomainName"
}
- ]
+ ],
+ "entityType": "DNS"
}
- ]
+ ],
+ "eventGroupingSettings": {
+ "aggregationKind": "SingleAlert"
+ },
+ "alertDetailsOverride": {
+ "alertDescriptionFormat": "This detection looks for new onmicrosoft domains being added to a tenant. An attacker who compromises a tenant may register a new onmicrosoft domain in order to masquerade as a service provider for launching phishing accounts. Domain additions are not a common occurrence and users should validate that {{ActionInitiatedBy}} added {{DomainAdded}} with a legitimate purpose.",
+ "alertDisplayNameFormat": "{{DomainAdded}} added to tenant by {{ActionInitiatedBy}}"
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId38'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId59'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 38",
- "parentId": "[variables('analyticRuleId38')]",
- "contentId": "[variables('_analyticRulecontentId38')]",
+ "description": "Azure Active Directory Analytics Rule 59",
+ "parentId": "[variables('analyticRuleId59')]",
+ "contentId": "[variables('_analyticRulecontentId59')]",
"kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion38')]",
+ "version": "[variables('analyticRuleVersion59')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -9494,108 +8269,397 @@
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId38')]",
+ "contentId": "[variables('_analyticRulecontentId59')]",
"contentKind": "AnalyticsRule",
- "displayName": "NRT New access credential added to Application or Service Principal",
- "contentProductId": "[variables('_analyticRulecontentProductId38')]",
- "id": "[variables('_analyticRulecontentProductId38')]",
- "version": "[variables('analyticRuleVersion38')]"
+ "displayName": "New onmicrosoft domain added to tenant",
+ "contentProductId": "[variables('_analyticRulecontentProductId59')]",
+ "id": "[variables('_analyticRulecontentProductId59')]",
+ "version": "[variables('analyticRuleVersion59')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName39')]",
+ "name": "[variables('playbookTemplateSpecName1')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "NRT_PIMElevationRequestRejected_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Block-AADUser-Alert Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion39')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion1')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Block-AADUser-Alert",
+ "type": "string"
+ }
+ },
+ "variables": {
+ "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
+ "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
+ "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
+ "_connection-1": "[[variables('connection-1')]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId39')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "NRT",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('AzureADConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "properties": {
+ "displayName": "[[variables('AzureADConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-1')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('MicrosoftSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
+ "properties": {
+ "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-2')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('Office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "properties": {
+ "displayName": "[[variables('Office365ConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Logic/workflows",
+ "apiVersion": "2017-07-01",
+ "name": "[[parameters('PlaybookName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Block-AADUser_alert",
+ "hidden-SentinelTemplateVersion": "1.1",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]"
+ ],
"properties": {
- "description": "Identifies when a user is rejected for a privileged role elevation via PIM. Monitor rejections for indicators of attacker compromise of the requesting account.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-identity-management",
- "displayName": "NRT PIM Elevation Request Rejected",
- "enabled": false,
- "query": "AuditLogs\n| where ActivityDisplayName =~'Add member to role completed (PIM activation)'\n| where Result =~ \"failure\"\n| mv-apply ResourceItem = TargetResources on \n (\n where ResourceItem.type =~ \"Role\"\n | extend Role = trim(@'\"',tostring(ResourceItem.displayName))\n )\n| mv-apply ResourceItem = TargetResources on \n (\n where ResourceItem.type =~ \"User\"\n | extend User = trim(@'\"',tostring(ResourceItem.userPrincipalName))\n )\n| project-reorder TimeGenerated, User, Role, OperationName, Result, ResultDescription\n| where isnotempty(InitiatedBy.user)\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName), InitiatingIpAddress = tostring(InitiatedBy.user.ipAddress)\n| extend InitiatingName = tostring(split(InitiatingUser,'@',0)[0]), InitiatingUPNSuffix = tostring(split(InitiatingUser,'@',1)[0])\n| extend UserName = tostring(split(User,'@',0)[0]), UserUPNSuffix = tostring(split(User,'@',1)[0])\n",
- "severity": "High",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
+ },
+ "triggers": {
+ "Microsoft_Sentinel_alert": {
+ "type": "ApiConnectionWebhook",
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "path": "/subscribe"
+ }
+ }
+ },
+ "actions": {
+ "Alert_-_Get_incident": {
+ "type": "ApiConnection",
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
+ }
+ },
+ "Entities_-_Get_Accounts": {
+ "runAfter": {
+ "Alert_-_Get_incident": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": "@triggerBody()?['Entities']",
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/entities/account"
+ }
+ },
+ "For_each": {
+ "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
+ "actions": {
+ "Condition": {
+ "actions": {
+ "Condition_-_if_user_have_manager": {
+ "actions": {
+ "Add_comment_to_incident_-_with_manager_-_no_admin": {
+ "runAfter": {
+ "Get_user_-_details": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "message": "User @{items('For_each')?['Name']} (UPN - @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}) was disabled in AAD via playbook Block-AADUser. Manager (@{body('Parse_JSON_-_get_user_manager')?['userPrincipalName']}) is notified.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ },
+ "Get_user_-_details": {
+ "type": "ApiConnection",
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuread']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}"
+ }
+ },
+ "Send_an_email_-_to_manager_-_no_admin": {
+ "runAfter": {
+ "Add_comment_to_incident_-_with_manager_-_no_admin": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "Body": "Security notification! This is automated email sent by Microsoft Sentinel Automation!
\n
\nYour direct report @{items('For_each')?['Name']} has been disabled in Azure AD due to the security incident. Can you please notify the user and work with him to reach our support.
\n
\nDirect report details:
\nFirst name: @{body('Get_user_-_details')?['displayName']}
\nSurname: @{body('Get_user_-_details')?['surname']}
\nJob title: @{body('Get_user_-_details')?['jobTitle']}
\nOffice location: @{body('Get_user_-_details')?['officeLocation']}
\nBusiness phone: @{body('Get_user_-_details')?['businessPhones']}
\nMobile phone: @{body('Get_user_-_details')?['mobilePhone']}
\nMail: @{body('Get_user_-_details')?['mail']}
\n
\nThank you!
",
+ "Importance": "High",
+ "Subject": "@{items('For_each')?['Name']} has been disabled in Azure AD due to the security risk!",
+ "To": "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/v2/Mail"
+ }
+ }
+ },
+ "runAfter": {
+ "Parse_JSON_-_get_user_manager": [
+ "Succeeded"
+ ]
+ },
+ "else": {
+ "actions": {
+ "Add_comment_to_incident_-_no_manager_-_no_admin": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "message": "User @{items('For_each')?['Name']} (UPN - @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}) was disabled in AAD via playbook Block-AADUser. Manager has not been notified, since it is not found for this user!
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "not": {
+ "equals": [
+ "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']",
+ "@null"
+ ]
+ }
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "HTTP_-_get_user_manager": {
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com/",
+ "type": "ManagedServiceIdentity"
+ },
+ "method": "GET",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/manager"
+ }
+ },
+ "Parse_JSON_-_get_user_manager": {
+ "runAfter": {
+ "HTTP_-_get_user_manager": [
+ "Succeeded",
+ "Failed"
+ ]
+ },
+ "type": "ParseJson",
+ "inputs": {
+ "content": "@body('HTTP_-_get_user_manager')",
+ "schema": {
+ "properties": {
+ "userPrincipalName": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ }
+ },
+ "runAfter": {
+ "Update_user_-_disable_user": [
+ "Succeeded",
+ "Failed"
+ ]
+ },
+ "else": {
+ "actions": {
+ "Add_comment_to_incident_-_error_details": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "message": "Block-AADUser playbook could not disable user @{items('For_each')?['Name']}.
\nError message: @{body('Update_user_-_disable_user')['error']['message']}
\nNote: If user is admin, this playbook don't have privilages to block admin users!
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "equals": [
+ "@body('Update_user_-_disable_user')",
+ "@null"
+ ]
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "Update_user_-_disable_user": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "accountEnabled": false
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuread']['connectionId']"
+ }
+ },
+ "method": "patch",
+ "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}"
+ }
+ }
+ },
+ "runAfter": {
+ "Entities_-_Get_Accounts": [
+ "Succeeded"
+ ]
+ },
+ "type": "Foreach"
+ }
}
- ],
- "tactics": [
- "Persistence"
- ],
- "techniques": [
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "InitiatingName"
+ },
+ "parameters": {
+ "$connections": {
+ "value": {
+ "azuread": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "connectionName": "[[variables('AzureADConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
},
- {
- "identifier": "UPNSuffix",
- "columnName": "InitiatingUPNSuffix"
- }
- ]
- },
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "UserName"
+ "microsoftsentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
},
- {
- "identifier": "UPNSuffix",
- "columnName": "UserUPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "InitiatingIpAddress"
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "connectionName": "[[variables('Office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
}
- ]
+ }
}
- ]
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId39'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId1'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 39",
- "parentId": "[variables('analyticRuleId39')]",
- "contentId": "[variables('_analyticRulecontentId39')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion39')]",
+ "parentId": "[variables('playbookId1')]",
+ "contentId": "[variables('_playbookContentId1')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion1')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -9613,221 +8677,415 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Block AAD user - Alert",
+ "description": "For each account entity included in the alert, this playbook will disable the user in Azure Active Directoy, add a comment to the incident that contains this alert and notify manager if available. Note: This playbook will not disable admin user!",
+ "prerequisites": [
+ "None"
+ ],
+ "postDeployment": [
+ "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
+ "2. Grant User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All permissions to the managed identity.",
+ "3. Authorize Azure AD and Office 365 Outlook Logic App connections."
+ ],
+ "lastUpdateTime": "2022-07-11T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": [
+ {
+ "version": "1.0.0",
+ "title": "Added manager notification action",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ ]
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId39')]",
- "contentKind": "AnalyticsRule",
- "displayName": "NRT PIM Elevation Request Rejected",
- "contentProductId": "[variables('_analyticRulecontentProductId39')]",
- "id": "[variables('_analyticRulecontentProductId39')]",
- "version": "[variables('analyticRuleVersion39')]"
+ "contentId": "[variables('_playbookContentId1')]",
+ "contentKind": "Playbook",
+ "displayName": "Block-AADUser-Alert",
+ "contentProductId": "[variables('_playbookcontentProductId1')]",
+ "id": "[variables('_playbookcontentProductId1')]",
+ "version": "[variables('playbookVersion1')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName40')]",
+ "name": "[variables('playbookTemplateSpecName2')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "NRT_PrivlegedRoleAssignedOutsidePIM_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Block-AADUser-Incident Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion40')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion2')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Block-AADUser-Incident",
+ "type": "string"
+ }
+ },
+ "variables": {
+ "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
+ "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
+ "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
+ "_connection-1": "[[variables('connection-1')]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId40')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "NRT",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('AzureADConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
"properties": {
- "description": "Identifies a privileged role being assigned to a user outside of PIM\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor-1",
- "displayName": "NRT Privileged Role Assigned Outside PIM",
- "enabled": false,
- "query": "AuditLogs\n| where Category =~ \"RoleManagement\"\n| where OperationName has \"Add member to role outside of PIM\"\n or (LoggedByService =~ \"Core Directory\" and OperationName =~ \"Add member to role\" and Identity != \"MS-PIM\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend UserPrincipalName = tostring(TargetResource.userPrincipalName)\n )\n| extend IpAddress = tostring(InitiatedBy.user.ipAddress), Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
- "severity": "Low",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
- }
- ],
- "tactics": [
- "PrivilegeEscalation"
- ],
- "techniques": [
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IpAddress"
- }
- ]
- }
- ]
+ "displayName": "[[variables('AzureADConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-1')]"
+ }
}
},
{
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId40'),'/'))))]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('MicrosoftSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
"properties": {
- "description": "Azure Active Directory Analytics Rule 40",
- "parentId": "[variables('analyticRuleId40')]",
- "contentId": "[variables('_analyticRulecontentId40')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion40')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
- }
- }
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId40')]",
- "contentKind": "AnalyticsRule",
- "displayName": "NRT Privileged Role Assigned Outside PIM",
- "contentProductId": "[variables('_analyticRulecontentProductId40')]",
- "id": "[variables('_analyticRulecontentProductId40')]",
- "version": "[variables('analyticRuleVersion40')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName41')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "NRT_UseraddedtoPrivilgedGroups_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion41')]",
- "parameters": {},
- "variables": {},
- "resources": [
+ "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-2')]"
+ }
+ }
+ },
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId41')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "NRT",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('Office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
"properties": {
- "description": "This will alert when a user is added to any of the Privileged Groups.\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.\nFor Administrator role permissions in Azure Active Directory please see https://docs.microsoft.com/azure/active-directory/users-groups-roles/directory-assign-admin-roles",
- "displayName": "NRT User added to Azure Active Directory Privileged Groups",
- "enabled": false,
- "query": "let OperationList = dynamic([\"Add member to role\",\"Add member to role in PIM requested (permanent)\"]);\nlet PrivilegedGroups = dynamic([\"UserAccountAdmins\",\"PrivilegedRoleAdmins\",\"TenantAdmins\"]);\nAuditLogs\n//| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"RoleManagement\"\n| where OperationName in~ (OperationList)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend TargetUserPrincipalName = tostring(TargetResource.userPrincipalName),\n modProps = TargetResource.modifiedProperties\n )\n| mv-apply Property = modProps on \n (\n where Property.displayName =~ \"Role.WellKnownObjectName\"\n | extend DisplayName = trim('\"',tostring(Property.displayName)),\n GroupName = trim('\"',tostring(Property.newValue))\n )\n| extend AppId = InitiatedBy.app.appId,\n InitiatedByDisplayName = case(isnotempty(InitiatedBy.app.displayName), InitiatedBy.app.displayName, isnotempty(InitiatedBy.user.displayName), InitiatedBy.user.displayName, \"not available\"),\n ServicePrincipalId = tostring(InitiatedBy.app.servicePrincipalId),\n ServicePrincipalName = tostring(InitiatedBy.app.servicePrincipalName),\n UserId = InitiatedBy.user.id,\n UserIPAddress = InitiatedBy.user.ipAddress,\n UserRoles = InitiatedBy.user.roles,\n UserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)\n| where GroupName in~ (PrivilegedGroups)\n// If you don't want to alert for operations from PIM, remove below filtering for MS-PIM.\n//| where InitiatedByDisplayName != \"MS-PIM\"\n| project TimeGenerated, AADOperationType, Category, OperationName, AADTenantId, AppId, InitiatedByDisplayName, ServicePrincipalId, ServicePrincipalName, DisplayName, GroupName, UserId, UserIPAddress, UserRoles, UserPrincipalName, TargetUserPrincipalName\n| extend AccountCustomEntity = case(isnotempty(ServicePrincipalName), ServicePrincipalName, \n isnotempty(UserPrincipalName), UserPrincipalName, \n \"\")\n| extend AccountName = tostring(split(AccountCustomEntity,'@',0)[0]), AccountUPNSuffix = tostring(split(AccountCustomEntity,'@',1)[0])\n| extend TargetName = tostring(split(TargetUserPrincipalName,'@',0)[0]), TargetUPNSuffix = tostring(split(TargetUserPrincipalName,'@',1)[0])\n",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
+ "displayName": "[[variables('Office365ConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Logic/workflows",
+ "apiVersion": "2017-07-01",
+ "name": "[[parameters('PlaybookName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Block-AADUser",
+ "hidden-SentinelTemplateVersion": "1.1",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]"
+ ],
+ "properties": {
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
+ },
+ "triggers": {
+ "Microsoft_Sentinel_incident": {
+ "type": "ApiConnectionWebhook",
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "path": "/incident-creation"
+ }
+ }
+ },
+ "actions": {
+ "Entities_-_Get_Accounts": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": "@triggerBody()?['object']?['properties']?['relatedEntities']",
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/entities/account"
+ }
+ },
+ "For_each": {
+ "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
+ "actions": {
+ "Condition": {
+ "actions": {
+ "Condition_-_if_user_have_manager": {
+ "actions": {
+ "Add_comment_to_incident_-_with_manager_-_no_admin": {
+ "runAfter": {
+ "Get_user_-_details": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['object']?['id']",
+ "message": "User @{items('For_each')?['Name']} (UPN - @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}) was disabled in AAD via playbook Block-AADUser. Manager (@{body('Parse_JSON_-_get_user_manager')?['userPrincipalName']}) is notified.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ },
+ "Get_user_-_details": {
+ "type": "ApiConnection",
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuread']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}"
+ }
+ },
+ "Send_an_email_-_to_manager_-_no_admin": {
+ "runAfter": {
+ "Add_comment_to_incident_-_with_manager_-_no_admin": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "Body": "Security notification! This is automated email sent by Microsoft Sentinel Automation!
\n
\nYour direct report @{items('For_each')?['Name']} has been disabled in Azure AD due to the security incident. Can you please notify the user and work with him to reach our support.
\n
\nDirect report details:
\nFirst name: @{body('Get_user_-_details')?['displayName']}
\nSurname: @{body('Get_user_-_details')?['surname']}
\nJob title: @{body('Get_user_-_details')?['jobTitle']}
\nOffice location: @{body('Get_user_-_details')?['officeLocation']}
\nBusiness phone: @{body('Get_user_-_details')?['businessPhones']}
\nMobile phone: @{body('Get_user_-_details')?['mobilePhone']}
\nMail: @{body('Get_user_-_details')?['mail']}
\n
\nThank you!
",
+ "Importance": "High",
+ "Subject": "@{items('For_each')?['Name']} has been disabled in Azure AD due to the security risk!",
+ "To": "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/v2/Mail"
+ }
+ }
+ },
+ "runAfter": {
+ "Parse_JSON_-_get_user_manager": [
+ "Succeeded"
+ ]
+ },
+ "else": {
+ "actions": {
+ "Add_comment_to_incident_-_no_manager_-_no_admin": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['object']?['id']",
+ "message": "User @{items('For_each')?['Name']} (UPN - @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}) was disabled in AAD via playbook Block-AADUser. Manager has not been notified, since it is not found for this user!
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "not": {
+ "equals": [
+ "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']",
+ "@null"
+ ]
+ }
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "HTTP_-_get_user_manager": {
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com/",
+ "type": "ManagedServiceIdentity"
+ },
+ "method": "GET",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/manager"
+ }
+ },
+ "Parse_JSON_-_get_user_manager": {
+ "runAfter": {
+ "HTTP_-_get_user_manager": [
+ "Succeeded",
+ "Failed"
+ ]
+ },
+ "type": "ParseJson",
+ "inputs": {
+ "content": "@body('HTTP_-_get_user_manager')",
+ "schema": {
+ "properties": {
+ "userPrincipalName": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ }
+ },
+ "runAfter": {
+ "Update_user_-_disable_user": [
+ "Succeeded",
+ "Failed"
+ ]
+ },
+ "else": {
+ "actions": {
+ "Add_comment_to_incident_-_error_details": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['object']?['id']",
+ "message": "Block-AADUser playbook could not disable user @{items('For_each')?['Name']}.
\nError message: @{body('Update_user_-_disable_user')['error']['message']}
\nNote: If user is admin, this playbook don't have privilages to block admin users!
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "equals": [
+ "@body('Update_user_-_disable_user')",
+ "@null"
+ ]
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "Update_user_-_disable_user": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "accountEnabled": false
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuread']['connectionId']"
+ }
+ },
+ "method": "patch",
+ "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}"
+ }
+ }
+ },
+ "runAfter": {
+ "Entities_-_Get_Accounts": [
+ "Succeeded"
+ ]
+ },
+ "type": "Foreach"
+ }
}
- ],
- "tactics": [
- "Persistence",
- "PrivilegeEscalation"
- ],
- "techniques": [
- "T1098",
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "AccountName"
+ },
+ "parameters": {
+ "$connections": {
+ "value": {
+ "azuread": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "connectionName": "[[variables('AzureADConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
},
- {
- "identifier": "UPNSuffix",
- "columnName": "AccountUPNSuffix"
- }
- ]
- },
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "TargetName"
+ "microsoftsentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
},
- {
- "identifier": "UPNSuffix",
- "columnName": "TargetUPNSuffix"
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "connectionName": "[[variables('Office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
}
- ]
+ }
}
- ]
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId41'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId2'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 41",
- "parentId": "[variables('analyticRuleId41')]",
- "contentId": "[variables('_analyticRulecontentId41')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion41')]",
+ "parentId": "[variables('playbookId2')]",
+ "contentId": "[variables('_playbookContentId2')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion2')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -9845,242 +9103,426 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Block AAD user - Incident",
+ "description": "For each account entity included in the incident, this playbook will disable the user in Azure Active Directoy, add a comment to the incident that contains this alert and notify manager if available. Note: This playbook will not disable admin user!",
+ "prerequisites": [
+ "None"
+ ],
+ "postDeployment": [
+ "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
+ "2. Grant User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All permissions to the managed identity.",
+ "3. Authorize Azure AD and Office 365 Outlook Logic App connections."
+ ],
+ "lastUpdateTime": "2022-07-11T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": [
+ {
+ "version": "1.0.0",
+ "title": "Added manager notification action",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ ]
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId41')]",
- "contentKind": "AnalyticsRule",
- "displayName": "NRT User added to Azure Active Directory Privileged Groups",
- "contentProductId": "[variables('_analyticRulecontentProductId41')]",
- "id": "[variables('_analyticRulecontentProductId41')]",
- "version": "[variables('analyticRuleVersion41')]"
+ "contentId": "[variables('_playbookContentId2')]",
+ "contentKind": "Playbook",
+ "displayName": "Block-AADUser-Incident",
+ "contentProductId": "[variables('_playbookcontentProductId2')]",
+ "id": "[variables('_playbookcontentProductId2')]",
+ "version": "[variables('playbookVersion2')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName42')]",
+ "name": "[variables('playbookTemplateSpecName3')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "PIMElevationRequestRejected_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Prompt-User-Alert Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion42')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion3')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Prompt-User-Alert",
+ "type": "string"
+ },
+ "TeamsId": {
+ "metadata": {
+ "description": "Enter the Teams Group ID"
+ },
+ "type": "string"
+ },
+ "TeamsChannelId": {
+ "metadata": {
+ "description": "Enter the Teams Channel ID"
+ },
+ "type": "string"
+ }
+ },
+ "variables": {
+ "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
+ "AzureSentinelConnectionName": "[[concat('azuresentinel-', parameters('PlaybookName'))]",
+ "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "TeamsConnectionName": "[[concat('teams-', parameters('PlaybookName'))]",
+ "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
+ "_connection-1": "[[variables('connection-1')]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "connection-4": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/teams')]",
+ "_connection-4": "[[variables('connection-4')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId42')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('AzureADConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
"properties": {
- "description": "Identifies when a user is rejected for a privileged role elevation via PIM. Monitor rejections for indicators of attacker compromise of the requesting account.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-identity-management",
- "displayName": "PIM Elevation Request Rejected",
- "enabled": false,
- "query": "AuditLogs\n| where (ActivityDisplayName =~'Add member to role completed (PIM activation)' and Result =~ \"failure\") or ActivityDisplayName =~'Add member to role request denied (PIM activation)'\n| mv-apply ResourceItem = TargetResources on \n (\n where ResourceItem.type =~ \"Role\"\n | extend Role = trim(@'\"',tostring(ResourceItem.displayName))\n )\n| mv-apply ResourceItem = TargetResources on \n (\n where ResourceItem.type =~ \"User\"\n | extend User = trim(@'\"',tostring(ResourceItem.userPrincipalName))\n )\n| project-reorder TimeGenerated, User, Role, OperationName, Result, ResultDescription\n| where isnotempty(InitiatedBy.user)\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName), InitiatingIpAddress = tostring(InitiatedBy.user.ipAddress)\n| extend InitiatingName = tostring(split(InitiatingUser,'@',0)[0]), InitiatingUPNSuffix = tostring(split(InitiatingUser,'@',1)[0])\n| extend UserName = tostring(split(User,'@',0)[0]), UserUPNSuffix = tostring(split(User,'@',1)[0])\n",
- "queryFrequency": "PT2H",
- "queryPeriod": "PT2H",
- "severity": "High",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
- }
- ],
- "tactics": [
- "Persistence"
- ],
- "techniques": [
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "InitiatingName"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "InitiatingUPNSuffix"
- }
- ]
- },
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "UserName"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "UserUPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "InitiatingIpAddress"
- }
- ]
- }
- ]
+ "displayName": "[[variables('AzureADConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-1')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('AzureSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
+ "properties": {
+ "displayName": "[[variables('AzureSentinelConnectionName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-2')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('Office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "properties": {
+ "displayName": "[[variables('Office365ConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
+ }
}
},
{
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId42'),'/'))))]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('TeamsConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 42",
- "parentId": "[variables('analyticRuleId42')]",
- "contentId": "[variables('_analyticRulecontentId42')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion42')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
+ "displayName": "[[variables('TeamsConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-4')]"
}
}
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId42')]",
- "contentKind": "AnalyticsRule",
- "displayName": "PIM Elevation Request Rejected",
- "contentProductId": "[variables('_analyticRulecontentProductId42')]",
- "id": "[variables('_analyticRulecontentProductId42')]",
- "version": "[variables('analyticRuleVersion42')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName43')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "PrivilegedAccountsSigninFailureSpikes_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion43')]",
- "parameters": {},
- "variables": {},
- "resources": [
+ },
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId43')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Logic/workflows",
+ "apiVersion": "2017-07-01",
+ "name": "[[parameters('PlaybookName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Prompt-User_alert",
+ "hidden-SentinelTemplateVersion": "1.1",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('TeamsConnectionName'))]"
+ ],
"properties": {
- "description": " Identifies spike in failed sign-ins from Privileged accounts. Privileged accounts list can be based on IdentityInfo UEBA table.\nSpike is determined based on Time series anomaly which will look at historical baseline values.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor",
- "displayName": "Privileged Accounts - Sign in Failure Spikes",
- "enabled": false,
- "query": "let starttime = 14d;\nlet timeframe = 1d;\nlet scorethreshold = 3;\nlet baselinethreshold = 5;\nlet aadFunc = (tableName:string){\n IdentityInfo\n | where TimeGenerated > ago(starttime)\n | summarize arg_max(TimeGenerated, *) by AccountUPN\n | mv-expand AssignedRoles\n | where AssignedRoles contains 'Admin'\n | summarize Roles = make_list(AssignedRoles) by AccountUPN = tolower(AccountUPN)\n | join kind=inner (\n table(tableName)\n | where TimeGenerated between (startofday(ago(starttime))..startofday(now()))\n | where ResultType != 0\n | extend UserPrincipalName = tolower(UserPrincipalName)\n ) on $left.AccountUPN == $right.UserPrincipalName\n | extend timestamp = TimeGenerated, AccountCustomEntity = UserPrincipalName, Roles = tostring(Roles)\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nlet allSignins = union isfuzzy=true aadSignin, aadNonInt;\nlet TimeSeriesAlerts = \n allSignins\n | make-series HourlyCount=count() on TimeGenerated from startofday(ago(starttime)) to startofday(now()) step 1h by UserPrincipalName, Roles\n | extend (anomalies, score, baseline) = series_decompose_anomalies(HourlyCount, scorethreshold, -1, 'linefit')\n | mv-expand HourlyCount to typeof(double), TimeGenerated to typeof(datetime), anomalies to typeof(double), score to typeof(double), baseline to typeof(long)\n // Filtering low count events per baselinethreshold\n | where anomalies > 0 and baseline > baselinethreshold\n | extend AnomalyHour = TimeGenerated\n | project UserPrincipalName, Roles, AnomalyHour, TimeGenerated, HourlyCount, baseline, anomalies, score;\n// Filter the alerts for specified timeframe\nTimeSeriesAlerts\n| where TimeGenerated > startofday(ago(timeframe))\n| join kind=inner ( \n allSignins\n | where TimeGenerated > startofday(ago(timeframe))\n // create a new column and round to hour\n | extend DateHour = bin(TimeGenerated, 1h)\n | summarize PartialFailedSignins = count(), LatestAnomalyTime = arg_max(TimeGenerated, *) by bin(TimeGenerated, 1h), OperationName, Category, ResultType, ResultDescription, UserPrincipalName, Roles, UserDisplayName, AppDisplayName, ClientAppUsed, IPAddress, ResourceDisplayName\n) on UserPrincipalName, $left.AnomalyHour == $right.DateHour\n| project LatestAnomalyTime, OperationName, Category, UserPrincipalName, Roles = todynamic(Roles), UserDisplayName, ResultType, ResultDescription, AppDisplayName, ClientAppUsed, UserAgent, IPAddress, Location, AuthenticationRequirement, ConditionalAccessStatus, ResourceDisplayName, PartialFailedSignins, TotalFailedSignins = HourlyCount, baseline, anomalies, score\n| extend timestamp = LatestAnomalyTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P14D",
- "severity": "High",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "actions": {
+ "Alert_-_Get_incident": {
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
+ },
+ "type": "ApiConnection"
+ },
+ "Entities_-_Get_Accounts": {
+ "inputs": {
+ "body": "@triggerBody()?['Entities']",
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/entities/account"
+ },
+ "runAfter": {
+ "Alert_-_Get_incident": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ },
+ "For_each": {
+ "actions": {
+ "Condition_2": {
+ "actions": {
+ "Add_comment_to_incident_(V3)": {
+ "inputs": {
+ "body": {
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "message": "@{body('Get_user')?['displayName']} confirms they completed the action that triggered the alert. Closing the incident.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ },
+ "type": "ApiConnection"
+ },
+ "Update_incident": {
+ "inputs": {
+ "body": {
+ "classification": {
+ "ClassificationAndReason": "BenignPositive - SuspiciousButExpected",
+ "ClassificationReasonText": "User Confirmed it was them"
+ },
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "status": "Closed"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "put",
+ "path": "/Incidents"
+ },
+ "runAfter": {
+ "Add_comment_to_incident_(V3)": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ }
+ },
+ "else": {
+ "actions": {
+ "Add_comment_to_incident_(V3)_2": {
+ "inputs": {
+ "body": {
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "message": "@{body('Get_user')?['displayName']} confirms they did not complete the action. Further investigation is needed.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ },
+ "type": "ApiConnection"
+ },
+ "Post_message_in_a_chat_or_channel": {
+ "inputs": {
+ "body": {
+ "messageBody": "New alert from Microsoft Sentinel.
\nPlease investigate ASAP.
\nSeverity : @{body('Alert_-_Get_incident')?['properties']?['severity']}
\nDescription: @{body('Alert_-_Get_incident')?['properties']?['description']}
\n
\n@{body('Get_user')?['displayName']} user confirmed they did not complete the action.
",
+ "recipient": {
+ "channelId": "[[parameters('TeamsChannelId')]",
+ "groupId": "[[parameters('TeamsId')]"
+ },
+ "subject": "Incident @{body('Alert_-_Get_incident')?['properties']?['incidentNumber']} - @{body('Alert_-_Get_incident')?['properties']?['title']}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['teams']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/beta/teams/conversation/message/poster/@{encodeURIComponent('User')}/location/@{encodeURIComponent('Channel')}"
+ },
+ "runAfter": {
+ "Add_comment_to_incident_(V3)_2": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "equals": [
+ "",
+ "This was me"
+ ]
+ }
+ ]
+ },
+ "runAfter": {
+ "Send_approval_email": [
+ "Succeeded"
+ ]
+ },
+ "type": "If"
+ },
+ "Get_user": {
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuread']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@' ,items('For_each')?['UPNSuffix']))}"
+ },
+ "type": "ApiConnection"
+ },
+ "Send_approval_email": {
+ "inputs": {
+ "body": {
+ "Message": {
+ "Body": "New Alert from Microsoft Sentinel.\nPlease respond ASAP.\nSeverity: @{triggerBody()?['Severity']}\nName: @{triggerBody()?['AlertDisplayName']}\nDescription: @{triggerBody()?['Description']}",
+ "HideHTMLMessage": false,
+ "Importance": "High",
+ "Options": "This was me, This was not me",
+ "ShowHTMLConfirmationDialog": false,
+ "Subject": "Security Alert: @{body('Alert_-_Get_incident')?['properties']?['title']}",
+ "To": "@body('Get_user')?['mail']"
+ },
+ "NotificationUrl": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "path": "/approvalmail/$subscriptions"
+ },
+ "runAfter": {
+ "Get_user": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnectionWebhook"
+ }
+ },
+ "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
+ "runAfter": {
+ "Entities_-_Get_Accounts": [
+ "Succeeded"
+ ]
+ },
+ "type": "Foreach"
+ }
},
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
+ },
+ "triggers": {
+ "Microsoft_Sentinel_alert": {
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "path": "/subscribe"
+ },
+ "type": "ApiConnectionWebhook"
+ }
}
- ],
- "tactics": [
- "InitialAccess"
- ],
- "techniques": [
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
+ },
+ "parameters": {
+ "$connections": {
+ "value": {
+ "azuread": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "connectionName": "[[variables('AzureADConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
},
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IPAddress"
+ "azuresentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
+ "connectionName": "[[variables('AzureSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
+ },
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "connectionName": "[[variables('Office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
+ },
+ "teams": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('TeamsConnectionName'))]",
+ "connectionName": "[[variables('TeamsConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/teams')]"
}
- ]
+ }
}
- ]
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId43'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId3'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 43",
- "parentId": "[variables('analyticRuleId43')]",
- "contentId": "[variables('_analyticRulecontentId43')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion43')]",
+ "parentId": "[variables('playbookId3')]",
+ "contentId": "[variables('_playbookContentId3')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion3')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -10098,351 +9540,408 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Prompt User - Alert",
+ "description": "This playbook will ask the user if they completed the action from the alert in Microsoft Sentinel. If so, it will close the incident and add a comment. If not, it will post a message to teams for the SOC to investigate and add a comment to the incident.",
+ "prerequisites": [
+ "1. You will need the Team Id and Channel Id."
+ ],
+ "postDeployment": [
+ "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
+ "2. Authorize Azure AD, Microsoft Teams, and Office 365 Outlook Logic App connections."
+ ],
+ "lastUpdateTime": "2022-07-11T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": [
+ {
+ "version": "1.0.0",
+ "title": "Added new Post a Teams message action",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ ]
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId43')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Privileged Accounts - Sign in Failure Spikes",
- "contentProductId": "[variables('_analyticRulecontentProductId43')]",
- "id": "[variables('_analyticRulecontentProductId43')]",
- "version": "[variables('analyticRuleVersion43')]"
+ "contentId": "[variables('_playbookContentId3')]",
+ "contentKind": "Playbook",
+ "displayName": "Prompt-User-Alert",
+ "contentProductId": "[variables('_playbookcontentProductId3')]",
+ "id": "[variables('_playbookcontentProductId3')]",
+ "version": "[variables('playbookVersion3')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName44')]",
+ "name": "[variables('playbookTemplateSpecName4')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "PrivlegedRoleAssignedOutsidePIM_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Prompt-User-Incident Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion44')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion4')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Prompt-User-Incident",
+ "type": "string"
+ },
+ "TeamsId": {
+ "metadata": {
+ "description": "Enter the Teams Group ID"
+ },
+ "type": "string"
+ },
+ "TeamsChannelId": {
+ "metadata": {
+ "description": "Enter the Teams Channel ID"
+ },
+ "type": "string"
+ }
+ },
+ "variables": {
+ "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
+ "AzureSentinelConnectionName": "[[concat('azuresentinel-', parameters('PlaybookName'))]",
+ "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "TeamsConnectionName": "[[concat('teams-', parameters('PlaybookName'))]",
+ "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
+ "_connection-1": "[[variables('connection-1')]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "connection-4": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/teams')]",
+ "_connection-4": "[[variables('connection-4')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId44')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('AzureADConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
"properties": {
- "description": "Identifies a privileged role being assigned to a user outside of PIM\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor-1",
- "displayName": "Privileged Role Assigned Outside PIM",
- "enabled": false,
- "query": "AuditLogs\n| where Category =~ \"RoleManagement\"\n| where OperationName has \"Add member to role outside of PIM\"\n or (LoggedByService =~ \"Core Directory\" and OperationName =~ \"Add member to role\" and Identity != \"MS-PIM\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend UserPrincipalName = tostring(TargetResource.userPrincipalName)\n )\n| extend IpAddress = tostring(InitiatedBy.user.ipAddress), Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P1D",
- "severity": "Low",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
- }
- ],
- "tactics": [
- "PrivilegeEscalation"
- ],
- "techniques": [
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IpAddress"
- }
- ]
- }
- ]
+ "displayName": "[[variables('AzureADConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-1')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('AzureSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
+ "properties": {
+ "displayName": "[[variables('AzureSentinelConnectionName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-2')]"
+ }
}
},
{
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId44'),'/'))))]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('Office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 44",
- "parentId": "[variables('analyticRuleId44')]",
- "contentId": "[variables('_analyticRulecontentId44')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion44')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
+ "displayName": "[[variables('Office365ConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
}
}
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId44')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Privileged Role Assigned Outside PIM",
- "contentProductId": "[variables('_analyticRulecontentProductId44')]",
- "id": "[variables('_analyticRulecontentProductId44')]",
- "version": "[variables('analyticRuleVersion44')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName45')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "RareApplicationConsent_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion45')]",
- "parameters": {},
- "variables": {},
- "resources": [
+ },
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId45')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('TeamsConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
"properties": {
- "description": "This will alert when the \"Consent to application\" operation occurs by a user that has not done this operation before or rarely does this.\nThis could indicate that permissions to access the listed Azure App were provided to a malicious actor.\nConsent to application, Add service principal and Add OAuth2PermissionGrant should typically be rare events.\nThis may help detect the Oauth2 attack that can be initiated by this publicly available tool - https://github.com/fireeye/PwnAuth\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "Rare application consent",
- "enabled": false,
- "query": "let current = 1d;\nlet auditLookback = 7d;\n// Setting threshold to 3 as a default, change as needed.\n// Any operation that has been initiated by a user or app more than 3 times in the past 7 days will be excluded\nlet threshold = 3;\n// Gather initial data from lookback period, excluding current, adjust current to more than a single day if no results\nlet AuditTrail = AuditLogs | where TimeGenerated >= ago(auditLookback) and TimeGenerated < ago(current)\n// 2 other operations that can be part of malicious activity in this situation are\n// \"Add OAuth2PermissionGrant\" and \"Add service principal\", extend the filter below to capture these too\n| where OperationName has \"Consent to application\"\n| extend InitiatedBy = iff(isnotempty(tostring(InitiatedBy.user.userPrincipalName)),\n tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend TargetResourceName = tolower(tostring(TargetResource.displayName))\n )\n| summarize max(TimeGenerated), OperationCount = count() by OperationName, InitiatedBy, TargetResourceName\n// only including operations initiated by a user or app that is above the threshold so we produce only rare and has not occurred in last 7 days\n| where OperationCount > threshold;\n// Gather current period of audit data\nlet RecentConsent = AuditLogs | where TimeGenerated >= ago(current)\n| where OperationName has \"Consent to application\"\n| extend IpAddress = case(\n isnotempty(tostring(InitiatedBy.user.ipAddress)) and tostring(InitiatedBy.user.ipAddress) != 'null', tostring(InitiatedBy.user.ipAddress),\n isnotempty(tostring(InitiatedBy.app.ipAddress)) and tostring(InitiatedBy.app.ipAddress) != 'null', tostring(InitiatedBy.app.ipAddress),\n 'Not Available')\n| extend InitiatedBy = iff(isnotempty(tostring(InitiatedBy.user.userPrincipalName)),\n tostring(InitiatedBy.user.userPrincipalName), tostring(InitiatedBy.app.displayName))\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend TargetResourceName = tolower(tostring(TargetResource.displayName)),\n props = TargetResource.modifiedProperties\n )\n| parse props with * \"ConsentType: \" ConsentType \"]\" *\n| mv-apply AdditionalDetail = AdditionalDetails on \n (\n where AdditionalDetail.key =~ \"User-Agent\"\n | extend UserAgent = tostring(AdditionalDetail.value)\n )\n| project TimeGenerated, InitiatedBy, IpAddress, TargetResourceName, Category, OperationName, ConsentType, UserAgent, CorrelationId, Type;\n// Exclude previously seen audit activity for \"Consent to application\" that was seen in the lookback period\n// First for rare InitiatedBy\nlet RareConsentBy = RecentConsent | join kind= leftanti AuditTrail on OperationName, InitiatedBy\n| extend Reason = \"Previously unseen user consenting\";\n// Second for rare TargetResourceName\nlet RareConsentApp = RecentConsent | join kind= leftanti AuditTrail on OperationName, TargetResourceName\n| extend Reason = \"Previously unseen app granted consent\";\nRareConsentBy | union RareConsentApp\n| summarize Reason = make_set(Reason,100) by TimeGenerated, InitiatedBy, IpAddress, TargetResourceName, Category, OperationName, ConsentType, UserAgent, CorrelationId, Type\n| extend timestamp = TimeGenerated, Name = tolower(tostring(split(InitiatedBy,'@',0)[0])), UPNSuffix = tolower(tostring(split(InitiatedBy,'@',1)[0]))\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P7D",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 3,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
- }
- ],
- "tactics": [
- "Persistence",
- "PrivilegeEscalation"
- ],
- "techniques": [
- "T1136",
- "T1068"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
+ "displayName": "[[variables('TeamsConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-4')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Logic/workflows",
+ "apiVersion": "2017-07-01",
+ "name": "[[parameters('PlaybookName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Prompt-User",
+ "hidden-SentinelTemplateVersion": "1.1",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('TeamsConnectionName'))]"
+ ],
+ "properties": {
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "actions": {
+ "Entities_-_Get_Accounts": {
+ "inputs": {
+ "body": "@triggerBody()?['object']?['properties']?['relatedEntities']",
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/entities/account"
+ },
+ "type": "ApiConnection"
+ },
+ "For_each": {
+ "actions": {
+ "Condition_2": {
+ "actions": {
+ "Add_comment_to_incident_(V3)": {
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['object']?['id']",
+ "message": "@{body('Get_user')?['displayName']} confirms they completed the action that triggered the alert. Closing the incident.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ },
+ "type": "ApiConnection"
+ },
+ "Update_incident": {
+ "inputs": {
+ "body": {
+ "classification": {
+ "ClassificationAndReason": "BenignPositive - SuspiciousButExpected",
+ "ClassificationReasonText": "User Confirmed it was them"
+ },
+ "incidentArmId": "@triggerBody()?['object']?['id']",
+ "status": "Closed"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "put",
+ "path": "/Incidents"
+ },
+ "runAfter": {
+ "Add_comment_to_incident_(V3)": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ }
+ },
+ "else": {
+ "actions": {
+ "Add_comment_to_incident_(V3)_2": {
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['object']?['id']",
+ "message": "@{body('Get_user')?['displayName']} confirms they did not complete the action. Further investigation is needed.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ },
+ "type": "ApiConnection"
+ },
+ "Post_message_in_a_chat_or_channel": {
+ "inputs": {
+ "body": {
+ "messageBody": "New alert from Microsoft Sentinel.
\nPlease investigate ASAP.
\nSeverity : @{triggerBody()?['object']?['properties']?['severity']}
\nDescription: @{triggerBody()?['object']?['properties']?['description']}
\n
\n@{body('Get_user')?['displayName']} user confirmed they did not complete the action.
",
+ "recipient": {
+ "channelId": "[[parameters('TeamsChannelId')]",
+ "groupId": "[[parameters('TeamsId')]"
+ },
+ "subject": "Incident @{triggerBody()?['object']?['properties']?['incidentNumber']} - @{triggerBody()?['object']?['properties']?['title']}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['teams']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/beta/teams/conversation/message/poster/@{encodeURIComponent('User')}/location/@{encodeURIComponent('Channel')}"
+ },
+ "runAfter": {
+ "Add_comment_to_incident_(V3)_2": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "equals": [
+ "@body('Send_approval_email')?['SelectedOption']",
+ "This was me"
+ ]
+ }
+ ]
+ },
+ "runAfter": {
+ "Send_approval_email": [
+ "Succeeded"
+ ]
+ },
+ "type": "If"
+ },
+ "Get_user": {
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuread']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@' ,items('For_each')?['UPNSuffix']))}"
+ },
+ "type": "ApiConnection"
+ },
+ "Send_approval_email": {
+ "inputs": {
+ "body": {
+ "Message": {
+ "Body": "New Alert from Microsoft Sentinel.\nPlease respond ASAP.\nSeverity: @{triggerBody()?['object']?['properties']?['severity']}\nName: @{triggerBody()?['object']?['properties']?['title']}\nDescription: @{triggerBody()?['object']?['properties']?['description']}",
+ "HideHTMLMessage": false,
+ "Importance": "High",
+ "Options": "This was me, This was not me",
+ "ShowHTMLConfirmationDialog": false,
+ "Subject": "Security Alert: @{triggerBody()?['object']?['properties']?['title']}",
+ "To": "@body('Get_user')?['mail']"
+ },
+ "NotificationUrl": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "path": "/approvalmail/$subscriptions"
+ },
+ "runAfter": {
+ "Get_user": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnectionWebhook"
+ }
},
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
+ "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
+ "runAfter": {
+ "Entities_-_Get_Accounts": [
+ "Succeeded"
+ ]
+ },
+ "type": "Foreach"
+ }
},
- {
- "entityType": "CloudApplication",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "TargetResourceName"
- }
- ]
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
},
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IpAddress"
- }
- ]
+ "triggers": {
+ "Microsoft_Sentinel_incident": {
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "path": "/incident-creation"
+ },
+ "type": "ApiConnectionWebhook"
+ }
}
- ]
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId45'),'/'))))]",
- "properties": {
- "description": "Azure Active Directory Analytics Rule 45",
- "parentId": "[variables('analyticRuleId45')]",
- "contentId": "[variables('_analyticRulecontentId45')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion45')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
},
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
- }
- }
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId45')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Rare application consent",
- "contentProductId": "[variables('_analyticRulecontentProductId45')]",
- "id": "[variables('_analyticRulecontentProductId45')]",
- "version": "[variables('analyticRuleVersion45')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName46')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "SeamlessSSOPasswordSpray_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion46')]",
- "parameters": {},
- "variables": {},
- "resources": [
- {
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId46')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
- "properties": {
- "description": "This query detects when there is a spike in Azure AD Seamless SSO errors. They may not be caused by a Password Spray attack, but the cause of the errors might need to be investigated.\nAzure AD only logs the requests that matched existing accounts, thus there might have been unlogged requests for non-existing accounts.",
- "displayName": "Password spray attack against Azure AD Seamless SSO",
- "enabled": false,
- "query": "let account_threshold = 5;\nAADNonInteractiveUserSignInLogs\n//| where ResultType == \"81016\"\n| where ResultType startswith \"81\"\n| summarize DistinctAccounts = dcount(UserPrincipalName), DistinctAddresses = make_set(IPAddress,100) by ResultType\n| where DistinctAccounts > account_threshold\n| mv-expand IPAddress = DistinctAddresses\n| extend IPAddress = tostring(IPAddress)\n| join kind=leftouter (union isfuzzy=true SigninLogs, AADNonInteractiveUserSignInLogs) on IPAddress\n| summarize\n StartTime = min(TimeGenerated),\n EndTime = max(TimeGenerated),\n UserPrincipalName = make_set(UserPrincipalName,100),\n UserAgent = make_set(UserAgent,100),\n ResultDescription = take_any(ResultDescription),\n ResultSignature = take_any(ResultSignature)\n by IPAddress, Type, ResultType\n| project Type, StartTime, EndTime, IPAddress, ResultType, ResultDescription, ResultSignature, UserPrincipalName, UserAgent = iff(array_length(UserAgent) == 1, UserAgent[0], UserAgent)\n| extend Name = tostring(split(UserPrincipalName[0],'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName[0],'@',1)[0])\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT1H",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
- }
- ],
- "tactics": [
- "CredentialAccess"
- ],
- "techniques": [
- "T1110"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
+ "parameters": {
+ "$connections": {
+ "value": {
+ "azuread": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "connectionName": "[[variables('AzureADConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
},
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IPAddress"
+ "azuresentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
+ "connectionName": "[[variables('AzureSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
+ },
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "connectionName": "[[variables('Office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
+ },
+ "teams": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('TeamsConnectionName'))]",
+ "connectionName": "[[variables('TeamsConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/teams')]"
}
- ]
+ }
}
- ]
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId46'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId4'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 46",
- "parentId": "[variables('analyticRuleId46')]",
- "contentId": "[variables('_analyticRulecontentId46')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion46')]",
+ "parentId": "[variables('playbookId4')]",
+ "contentId": "[variables('_playbookContentId4')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion4')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -10459,222 +9958,389 @@
"link": "https://support.microsoft.com/"
}
}
- }
- ]
+ }
+ ],
+ "metadata": {
+ "title": "Prompt User - Incident",
+ "description": "This playbook will ask the user if they completed the action from the Incident in Microsoft Sentinel. If so, it will close the incident and add a comment. If not, it will post a message to teams for the SOC to investigate and add a comment to the incident.",
+ "prerequisites": [
+ "1. You will need the Team Id and Channel Id."
+ ],
+ "postDeployment": [
+ "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
+ "2. Authorize Azure AD, Microsoft Teams, and Office 365 Outlook Logic App connections."
+ ],
+ "lastUpdateTime": "2022-07-11T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": [
+ {
+ "version": "1.0.0",
+ "title": "Added new Post a Teams message action",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ ]
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId46')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Password spray attack against Azure AD Seamless SSO",
- "contentProductId": "[variables('_analyticRulecontentProductId46')]",
- "id": "[variables('_analyticRulecontentProductId46')]",
- "version": "[variables('analyticRuleVersion46')]"
+ "contentId": "[variables('_playbookContentId4')]",
+ "contentKind": "Playbook",
+ "displayName": "Prompt-User-Incident",
+ "contentProductId": "[variables('_playbookcontentProductId4')]",
+ "id": "[variables('_playbookcontentProductId4')]",
+ "version": "[variables('playbookVersion4')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName47')]",
+ "name": "[variables('playbookTemplateSpecName5')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "Sign-in Burst from Multiple Locations_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Reset-AADPassword-AlertTrigger Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion47')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion5')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Reset-AADPassword-AlertTrigger",
+ "type": "string"
+ }
+ },
+ "variables": {
+ "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
+ "office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId47')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
"properties": {
- "description": "This detection triggers when there is a Signin burst from multiple locations in GitHub (AAD SSO).\n This detection is based on configurable threshold which can be prone to false positives. To view the anomaly based equivalent of thie detection, please see here https://github.com/Azure/Azure-Sentinel/blob/master/Solutions/Azure%20Active%20Directory/Analytic%20Rules/AnomalousUserAppSigninLocationIncrease-detection.yaml. ",
- "displayName": "GitHub Signin Burst from Multiple Locations",
- "enabled": false,
- "query": "let locationThreshold = 1;\nlet aadFunc = (tableName:string){\ntable(tableName)\n| where AppDisplayName =~ \"GitHub.com\"\n| where ResultType == 0\n| summarize CountOfLocations = dcount(Location), Locations = make_set(Location,100), BurstStartTime = min(TimeGenerated), BurstEndTime = max(TimeGenerated) by UserPrincipalName, Type\n| where CountOfLocations > locationThreshold\n| extend timestamp = BurstStartTime\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n| extend Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT1H",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
+ "provisioningState": "Succeeded",
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
},
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
+ "triggers": {
+ "Microsoft_Sentinel_alert": {
+ "type": "ApiConnectionWebhook",
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "path": "/subscribe"
+ }
+ }
+ },
+ "actions": {
+ "Alert_-_Get_incident": {
+ "runAfter": {
+ "Set_variable_-_password": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
+ }
+ },
+ "Entities_-_Get_Accounts": {
+ "runAfter": {
+ "Alert_-_Get_incident": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": "@triggerBody()?['Entities']",
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/entities/account"
+ }
+ },
+ "For_each": {
+ "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
+ "actions": {
+ "Condition_-_is_manager_available": {
+ "actions": {
+ "Add_comment_to_incident_-_manager_available": {
+ "runAfter": {
+ "Send_an_email_-_to_manager_with_password_details": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} password was reset in AAD and their manager @{body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']} was contacted using playbook.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ },
+ "Parse_JSON_-_HTTP_-_get_manager": {
+ "type": "ParseJson",
+ "inputs": {
+ "content": "@body('HTTP_-_get_manager')",
+ "schema": {
+ "properties": {
+ "userPrincipalName": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ },
+ "Send_an_email_-_to_manager_with_password_details": {
+ "runAfter": {
+ "Parse_JSON_-_HTTP_-_get_manager": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "Body": "User, @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}, was involved in part of a security incident. As part of remediation, the user password has been reset.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
",
+ "Subject": "A user password was reset due to security incident.",
+ "To": "@body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/v2/Mail"
+ }
+ }
+ },
+ "runAfter": {
+ "HTTP_-_get_manager": [
+ "Succeeded",
+ "Failed"
+ ]
+ },
+ "else": {
+ "actions": {
+ "Add_comment_to_incident_-_manager_not_available": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} password was reset in AAD but the user doesn't have a manager.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "equals": [
+ "@outputs('HTTP_-_get_manager')['statusCode']",
+ 200
+ ]
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "HTTP_-_get_manager": {
+ "runAfter": {
+ "HTTP_-_reset_a_password": [
+ "Succeeded"
+ ]
+ },
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com",
+ "type": "ManagedServiceIdentity"
+ },
+ "method": "GET",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/manager"
+ }
+ },
+ "HTTP_-_reset_a_password": {
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com",
+ "type": "ManagedServiceIdentity"
+ },
+ "body": {
+ "passwordProfile": {
+ "forceChangePasswordNextSignIn": true,
+ "forceChangePasswordNextSignInWithMfa": false,
+ "password": "@{variables('Password')}"
+ }
+ },
+ "method": "PATCH",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}"
+ }
+ }
+ },
+ "runAfter": {
+ "Entities_-_Get_Accounts": [
+ "Succeeded"
+ ]
+ },
+ "type": "Foreach"
+ },
+ "Initialize_variable": {
+ "type": "InitializeVariable",
+ "inputs": {
+ "variables": [
+ {
+ "name": "Password",
+ "type": "String",
+ "value": "null"
+ }
+ ]
+ }
+ },
+ "Set_variable_-_password": {
+ "runAfter": {
+ "Initialize_variable": [
+ "Succeeded"
+ ]
+ },
+ "type": "SetVariable",
+ "inputs": {
+ "name": "Password",
+ "value": "@{substring(guid(), 0, 10)}"
+ }
+ }
}
- ],
- "tactics": [
- "CredentialAccess"
- ],
- "techniques": [
- "T1110"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
+ },
+ "parameters": {
+ "$connections": {
+ "value": {
+ "microsoftsentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
},
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]",
+ "connectionName": "[[variables('office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
}
- ]
+ }
}
- ]
- }
+ }
+ },
+ "name": "[[parameters('PlaybookName')]",
+ "type": "Microsoft.Logic/workflows",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Reset-AADUserPassword_alert",
+ "hidden-SentinelTemplateVersion": "1.1",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "apiVersion": "2017-07-01",
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]"
+ ]
},
{
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId47'),'/'))))]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('MicrosoftSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
"properties": {
- "description": "Azure Active Directory Analytics Rule 47",
- "parentId": "[variables('analyticRuleId47')]",
- "contentId": "[variables('_analyticRulecontentId47')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion47')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
+ "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-2')]"
}
}
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId47')]",
- "contentKind": "AnalyticsRule",
- "displayName": "GitHub Signin Burst from Multiple Locations",
- "contentProductId": "[variables('_analyticRulecontentProductId47')]",
- "id": "[variables('_analyticRulecontentProductId47')]",
- "version": "[variables('analyticRuleVersion47')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName48')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "SigninAttemptsByIPviaDisabledAccounts_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion48')]",
- "parameters": {},
- "variables": {},
- "resources": [
+ },
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId48')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
"properties": {
- "description": "Identifies IPs with failed attempts to sign in to one or more disabled accounts using the IP through which successful signins from other accounts have happened.\nThis could indicate an attacker who obtained credentials for a list of accounts and is attempting to login with those accounts, some of which may have already been disabled.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes\n50057 - User account is disabled. The account has been disabled by an administrator.\nThis query has also been updated to include UEBA logs IdentityInfo and BehaviorAnalytics for contextual information around the results.",
- "displayName": "Sign-ins from IPs that attempt sign-ins to disabled accounts",
- "enabled": false,
- "query": "let aadFunc = (tableName: string) {\nlet failed_signins = table(tableName)\n| where ResultType == \"50057\"\n| where ResultDescription == \"User account is disabled. The account has been disabled by an administrator.\";\nlet disabled_users = failed_signins | summarize by UserPrincipalName;\ntable(tableName)\n | where ResultType == 0\n | where isnotempty(UserPrincipalName)\n | where UserPrincipalName !in (disabled_users)\n| summarize\n successfulAccountsTargettedCount = dcount(UserPrincipalName),\n successfulAccountSigninSet = make_set(UserPrincipalName, 100),\n successfulApplicationSet = make_set(AppDisplayName, 100)\n by IPAddress, Type\n // Assume IPs associated with sign-ins from 100+ distinct user accounts are safe\n | where successfulAccountsTargettedCount < 50\n | where isnotempty(successfulAccountsTargettedCount)\n | join kind=inner (failed_signins\n| summarize\n StartTime = min(TimeGenerated),\n EndTime = max(TimeGenerated),\n totalDisabledAccountLoginAttempts = count(),\n disabledAccountsTargettedCount = dcount(UserPrincipalName),\n applicationsTargeted = dcount(AppDisplayName),\n disabledAccountSet = make_set(UserPrincipalName, 100),\n disabledApplicationSet = make_set(AppDisplayName, 100)\nby IPAddress, Type\n| order by totalDisabledAccountLoginAttempts desc) on IPAddress\n| project StartTime, EndTime, IPAddress, totalDisabledAccountLoginAttempts, disabledAccountsTargettedCount, disabledAccountSet, disabledApplicationSet, successfulApplicationSet, successfulAccountsTargettedCount, successfulAccountSigninSet, Type\n| order by totalDisabledAccountLoginAttempts};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n| join kind=leftouter (\n BehaviorAnalytics\n | where ActivityType in (\"FailedLogOn\", \"LogOn\")\n | where EventSource =~ \"Azure AD\"\n | project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress, UserPrincipalName\n | project-rename IPAddress = SourceIPAddress\n | summarize\n Users = make_set(UserPrincipalName, 100),\n UsersInsights = make_set(UsersInsights, 100),\n DevicesInsights = make_set(DevicesInsights, 100),\n IPInvestigationPriority = sum(InvestigationPriority)\n by IPAddress\n) on IPAddress\n| extend SFRatio = toreal(toreal(disabledAccountsTargettedCount)/toreal(successfulAccountsTargettedCount))\n| where SFRatio >= 0.5\n| sort by IPInvestigationPriority desc\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P1D",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
- },
- {
- "connectorId": "BehaviorAnalytics",
- "dataTypes": [
- "BehaviorAnalytics"
- ]
- }
- ],
- "tactics": [
- "InitialAccess",
- "Persistence"
- ],
- "techniques": [
- "T1078",
- "T1098"
- ],
- "entityMappings": [
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IPAddress"
- }
- ]
- }
- ]
+ "displayName": "[[variables('office365ConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId48'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId5'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 48",
- "parentId": "[variables('analyticRuleId48')]",
- "contentId": "[variables('_analyticRulecontentId48')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion48')]",
+ "parentId": "[variables('playbookId5')]",
+ "contentId": "[variables('_playbookContentId5')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion5')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -10692,112 +10358,372 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Reset Azure AD User Password - Alert Trigger",
+ "description": "This playbook will reset the user password using Graph API. It will send the password (which is a random guid substring) to the user's manager. The user will have to reset the password upon login.",
+ "prerequisites": [
+ "None"
+ ],
+ "postDeployment": [
+ "1. Assign Password Administrator permission to managed identity.",
+ "2. Assign Microsoft Sentinel Responder permission to managed identity.",
+ "3. Authorize Office 365 Outlook connection"
+ ],
+ "lastUpdateTime": "2022-07-11T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": [
+ {
+ "version": "1.0.0",
+ "title": " Added manager notification action",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ ]
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId48')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Sign-ins from IPs that attempt sign-ins to disabled accounts",
- "contentProductId": "[variables('_analyticRulecontentProductId48')]",
- "id": "[variables('_analyticRulecontentProductId48')]",
- "version": "[variables('analyticRuleVersion48')]"
+ "contentId": "[variables('_playbookContentId5')]",
+ "contentKind": "Playbook",
+ "displayName": "Reset-AADPassword-AlertTrigger",
+ "contentProductId": "[variables('_playbookcontentProductId5')]",
+ "id": "[variables('_playbookcontentProductId5')]",
+ "version": "[variables('playbookVersion5')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName49')]",
+ "name": "[variables('playbookTemplateSpecName6')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "SigninBruteForce-AzurePortal_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Reset-AADPassword-IncidentTrigger Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion49')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion6')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Reset-AADPassword-IncidentTrigger",
+ "type": "string"
+ }
+ },
+ "variables": {
+ "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
+ "office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId49')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
"properties": {
- "description": "Identifies evidence of brute force activity against Azure Portal by highlighting multiple authentication failures and by a successful authentication within a given time window. \nDefault Failure count is 10 and default Time Window is 20 minutes.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes.",
- "displayName": "Brute force attack against Azure Portal",
- "enabled": false,
- "query": "let timeRange = 24h;\nlet failureCountThreshold = 10;\nlet authenticationWindow = 20m;\nlet aadFunc = (tableName:string){\n table(tableName)\n| where AppDisplayName has \"Azure Portal\"\n| extend\n DeviceDetail = todynamic(DeviceDetail),\n //Status = todynamic(Status),\n LocationDetails = todynamic(LocationDetails)\n| extend\n OS = tostring(DeviceDetail.operatingSystem),\n Browser = tostring(DeviceDetail.browser),\n //StatusCode = tostring(Status.errorCode),\n //StatusDetails = tostring(Status.additionalDetails),\n State = tostring(LocationDetails.state),\n City = tostring(LocationDetails.city),\n Region = tostring(LocationDetails.countryOrRegion)\n// Split out failure versus non-failure types\n| extend FailureOrSuccess = iff(ResultType in (\"0\", \"50125\", \"50140\", \"70043\", \"70044\"), \"Success\", \"Failure\") \n// sort for sessionizing - by UserPrincipalName and time of the authentication outcome\n| sort by UserPrincipalName asc, TimeGenerated asc\n// sessionize into failure groupings until either the account changes or there is a success\n| extend SessionStartedUtc = row_window_session(TimeGenerated, timeRange, authenticationWindow, UserPrincipalName != prev(UserPrincipalName) or prev(FailureOrSuccess) == \"Success\")\n// bin outcomes based on authenticationWindow\n| summarize FailureOrSuccessCount = count() by FailureOrSuccess, UserId, UserDisplayName, AppDisplayName, IPAddress, Browser, OS, State, City, Region, Type, CorrelationId, bin(TimeGenerated, authenticationWindow), ResultType, UserPrincipalName,SessionStartedUtc\n// count the failures in each session\n| summarize FailureCountBeforeSuccess=sumif(FailureOrSuccessCount, FailureOrSuccess == \"Failure\"), StartTime=min(TimeGenerated), EndTime=max(TimeGenerated), makelist(FailureOrSuccess), IPAddress = make_set(IPAddress,15), make_set(Browser,15), make_set(City,15), make_set(State,15), make_set(Region,15), make_set(ResultType,15) by SessionStartedUtc, UserPrincipalName, CorrelationId, AppDisplayName, UserId, Type\n// the session must not start with a success, and must end with one\n| where array_index_of(list_FailureOrSuccess, \"Success\") != 0\n| where array_index_of(list_FailureOrSuccess, \"Success\") == array_length(list_FailureOrSuccess) - 1\n| project-away SessionStartedUtc, list_FailureOrSuccess\n// where the number of failures before the success is above the threshold \n| where FailureCountBeforeSuccess >= failureCountThreshold \n// expand out ip for entity assignment\n| mv-expand IPAddress\n| extend IPAddress = tostring(IPAddress)\n| extend timestamp = StartTime \n};\n let aadSignin = aadFunc(\"SigninLogs\");\n let aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\n union isfuzzy=true aadSignin, aadNonInt\n | extend Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P1D",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
+ "provisioningState": "Succeeded",
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
},
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
- }
- ],
- "tactics": [
- "CredentialAccess"
- ],
- "techniques": [
- "T1110"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
+ "triggers": {
+ "Microsoft_Sentinel_incident": {
+ "type": "ApiConnectionWebhook",
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "path": "/incident-creation"
+ }
+ }
+ },
+ "actions": {
+ "Entities_-_Get_Accounts": {
+ "runAfter": {
+ "Set_variable_-_password": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": "@triggerBody()?['object']?['properties']?['relatedEntities']",
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/entities/account"
+ }
+ },
+ "For_each": {
+ "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
+ "actions": {
+ "Condition_-_is_manager_available": {
+ "actions": {
+ "Add_comment_to_incident_-_manager_available": {
+ "runAfter": {
+ "Send_an_email_-_to_manager_with_password_details": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['object']?['id']",
+ "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} password was reset in AAD and their manager @{body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']} was contacted using playbook.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ },
+ "Parse_JSON_-_HTTP_-_get_manager": {
+ "type": "ParseJson",
+ "inputs": {
+ "content": "@body('HTTP_-_get_manager')",
+ "schema": {
+ "properties": {
+ "userPrincipalName": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ },
+ "Send_an_email_-_to_manager_with_password_details": {
+ "runAfter": {
+ "Parse_JSON_-_HTTP_-_get_manager": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "Body": "User, @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}, was involved in part of a security incident. As part of remediation, the user password has been reset.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
",
+ "Subject": "A user password was reset due to security incident.",
+ "To": "@body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/v2/Mail"
+ }
+ }
+ },
+ "runAfter": {
+ "HTTP_-_get_manager": [
+ "Succeeded",
+ "Failed"
+ ]
+ },
+ "else": {
+ "actions": {
+ "Add_comment_to_incident_-_manager_not_available": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['object']?['id']",
+ "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} password was reset in AAD but the user doesn't have a manager.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "equals": [
+ "@outputs('HTTP_-_get_manager')['statusCode']",
+ 200
+ ]
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "HTTP_-_get_manager": {
+ "runAfter": {
+ "HTTP_-_reset_a_password": [
+ "Succeeded"
+ ]
+ },
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com",
+ "type": "ManagedServiceIdentity"
+ },
+ "method": "GET",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/manager"
+ }
+ },
+ "HTTP_-_reset_a_password": {
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com",
+ "type": "ManagedServiceIdentity"
+ },
+ "body": {
+ "passwordProfile": {
+ "forceChangePasswordNextSignIn": true,
+ "forceChangePasswordNextSignInWithMfa": false,
+ "password": "@{variables('Password')}"
+ }
+ },
+ "method": "PATCH",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}"
+ }
+ }
+ },
+ "runAfter": {
+ "Entities_-_Get_Accounts": [
+ "Succeeded"
+ ]
+ },
+ "type": "Foreach"
+ },
+ "Initialize_variable": {
+ "type": "InitializeVariable",
+ "inputs": {
+ "variables": [
+ {
+ "name": "Password",
+ "type": "String",
+ "value": "null"
+ }
+ ]
+ }
+ },
+ "Set_variable_-_password": {
+ "runAfter": {
+ "Initialize_variable": [
+ "Succeeded"
+ ]
},
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "type": "SetVariable",
+ "inputs": {
+ "name": "Password",
+ "value": "@{substring(guid(), 0, 10)}"
}
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IPAddress"
+ }
+ }
+ },
+ "parameters": {
+ "$connections": {
+ "value": {
+ "microsoftsentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
+ },
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]",
+ "connectionName": "[[variables('office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
}
- ]
+ }
}
- ]
+ }
+ },
+ "name": "[[parameters('PlaybookName')]",
+ "type": "Microsoft.Logic/workflows",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Reset-AADUserPassword",
+ "hidden-SentinelTemplateVersion": "1.1",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "apiVersion": "2017-07-01",
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]"
+ ]
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('MicrosoftSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
+ "properties": {
+ "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-2')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
+ "properties": {
+ "displayName": "[[variables('office365ConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId49'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId6'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 49",
- "parentId": "[variables('analyticRuleId49')]",
- "contentId": "[variables('_analyticRulecontentId49')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion49')]",
+ "parentId": "[variables('playbookId6')]",
+ "contentId": "[variables('_playbookContentId6')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion6')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -10815,380 +10741,453 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Reset Azure AD User Password - Incident Trigger",
+ "description": "This playbook will reset the user password using Graph API. It will send the password (which is a random guid substring) to the user's manager. The user will have to reset the password upon login.",
+ "prerequisites": [
+ "None"
+ ],
+ "postDeployment": [
+ "1. Assign Password Administrator permission to managed identity.",
+ "2. Assign Microsoft Sentinel Responder permission to managed identity.",
+ "3. Authorize Office 365 Outlook connection"
+ ],
+ "lastUpdateTime": "2022-07-11T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": [
+ {
+ "version": "1.0.0",
+ "title": " Added manager notification action",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ ]
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId49')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Brute force attack against Azure Portal",
- "contentProductId": "[variables('_analyticRulecontentProductId49')]",
- "id": "[variables('_analyticRulecontentProductId49')]",
- "version": "[variables('analyticRuleVersion49')]"
+ "contentId": "[variables('_playbookContentId6')]",
+ "contentKind": "Playbook",
+ "displayName": "Reset-AADPassword-IncidentTrigger",
+ "contentProductId": "[variables('_playbookcontentProductId6')]",
+ "id": "[variables('_playbookcontentProductId6')]",
+ "version": "[variables('playbookVersion6')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName50')]",
+ "name": "[variables('playbookTemplateSpecName7')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "SigninPasswordSpray_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Block-AADUser-EntityTrigger Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion50')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion7')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Block-AADUser-EntityTrigger",
+ "type": "string"
+ }
+ },
+ "variables": {
+ "AzureADConnectionName": "[[concat('azuread-', parameters('PlaybookName'))]",
+ "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
+ "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]",
+ "_connection-1": "[[variables('connection-1')]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId50')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('AzureADConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
"properties": {
- "description": "Identifies evidence of password spray activity against Azure AD applications by looking for failures from multiple accounts from the same\nIP address within a time window. If the number of accounts breaches the threshold just once, all failures from the IP address within the time range\nare bought into the result. Details on whether there were successful authentications by the IP address within the time window are also included.\nThis can be an indicator that an attack was successful.\nThe default failure acccount threshold is 5, Default time window for failures is 20m and default look back window is 3 days\nNote: Due to the number of possible accounts involved in a password spray it is not possible to map identities to a custom entity.\nReferences: https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-sign-ins-error-codes.",
- "displayName": "Password spray attack against Azure AD application",
- "enabled": false,
- "query": "let timeRange = 3d;\nlet lookBack = 7d;\nlet authenticationWindow = 20m;\nlet authenticationThreshold = 5;\nlet isGUID = \"[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}\";\nlet failureCodes = dynamic([50053, 50126, 50055]); // invalid password, account is locked - too many sign ins, expired password\nlet successCodes = dynamic([0, 50055, 50057, 50155, 50105, 50133, 50005, 50076, 50079, 50173, 50158, 50072, 50074, 53003, 53000, 53001, 50129]);\n// Lookup up resolved identities from last 7 days\nlet aadFunc = (tableName:string){\nlet identityLookup = table(tableName)\n| where TimeGenerated >= ago(lookBack)\n| where not(Identity matches regex isGUID)\n| where isnotempty(UserId)\n| summarize by UserId, lu_UserDisplayName = UserDisplayName, lu_UserPrincipalName = UserPrincipalName, Type;\n// collect window threshold breaches\ntable(tableName)\n| where TimeGenerated > ago(timeRange)\n| where ResultType in(failureCodes)\n| summarize FailedPrincipalCount = dcount(UserPrincipalName) by bin(TimeGenerated, authenticationWindow), IPAddress, AppDisplayName, Type\n| where FailedPrincipalCount >= authenticationThreshold\n| summarize WindowThresholdBreaches = count() by IPAddress, Type\n| join kind= inner (\n// where we breached a threshold, join the details back on all failure data\ntable(tableName)\n| where TimeGenerated > ago(timeRange)\n| where ResultType in(failureCodes)\n| extend LocationDetails = todynamic(LocationDetails)\n| extend FullLocation = strcat(LocationDetails.countryOrRegion,'|', LocationDetails.state, '|', LocationDetails.city)\n| summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated), make_set(ClientAppUsed,20), make_set(FullLocation,20), FailureCount = count() by IPAddress, AppDisplayName, UserPrincipalName, UserDisplayName, Identity, UserId, Type\n// lookup any unresolved identities\n| extend UnresolvedUserId = iff(Identity matches regex isGUID, UserId, \"\")\n| join kind= leftouter (\n identityLookup\n) on $left.UnresolvedUserId==$right.UserId\n| extend UserDisplayName=iff(isempty(lu_UserDisplayName), UserDisplayName, lu_UserDisplayName)\n| extend UserPrincipalName=iff(isempty(lu_UserPrincipalName), UserPrincipalName, lu_UserPrincipalName)\n| summarize StartTime = min(StartTime), EndTime = max(EndTime), make_set(UserPrincipalName,20), make_set(UserDisplayName,20), make_set(set_ClientAppUsed,20), make_set(set_FullLocation,20), make_list(FailureCount,20) by IPAddress, AppDisplayName, Type\n| extend FailedPrincipalCount = array_length(set_UserPrincipalName)\n) on IPAddress\n| project IPAddress, StartTime, EndTime, TargetedApplication=AppDisplayName, FailedPrincipalCount, UserPrincipalNames=set_UserPrincipalName, UserDisplayNames=set_UserDisplayName, ClientAppsUsed=set_set_ClientAppUsed, Locations=set_set_FullLocation, FailureCountByPrincipal=list_FailureCount, WindowThresholdBreaches, Type\n| join kind= inner (\ntable(tableName) // get data on success vs. failure history for each IP\n| where TimeGenerated > ago(timeRange)\n| where ResultType in(successCodes) or ResultType in(failureCodes) // success or failure types\n| summarize GlobalSuccessPrincipalCount = dcountif(UserPrincipalName, (ResultType in (successCodes))), ResultTypeSuccesses = make_set_if(ResultType, (ResultType in (successCodes))), GlobalFailPrincipalCount = dcountif(UserPrincipalName, (ResultType in (failureCodes))), ResultTypeFailures = make_set_if(ResultType, (ResultType in (failureCodes))) by IPAddress, Type\n| where GlobalFailPrincipalCount > GlobalSuccessPrincipalCount // where the number of failed principals is greater than success - eliminates FPs from IPs who authenticate successfully alot and as a side effect have alot of failures\n) on IPAddress\n| project-away IPAddress1\n| extend timestamp=StartTime\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P7D",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
- }
- ],
- "tactics": [
- "CredentialAccess"
- ],
- "techniques": [
- "T1110"
- ],
- "entityMappings": [
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IPAddress"
- }
- ]
- }
- ]
+ "displayName": "[[variables('AzureADConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-1')]"
+ }
}
},
{
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId50'),'/'))))]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('MicrosoftSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
"properties": {
- "description": "Azure Active Directory Analytics Rule 50",
- "parentId": "[variables('analyticRuleId50')]",
- "contentId": "[variables('_analyticRulecontentId50')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion50')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
+ "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-2')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('Office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "properties": {
+ "displayName": "[[variables('Office365ConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
}
}
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId50')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Password spray attack against Azure AD application",
- "contentProductId": "[variables('_analyticRulecontentProductId50')]",
- "id": "[variables('_analyticRulecontentProductId50')]",
- "version": "[variables('analyticRuleVersion50')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName51')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "SuccessThenFail_DiffIP_SameUserandApp_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion51')]",
- "parameters": {},
- "variables": {},
- "resources": [
+ },
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId51')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Logic/workflows",
+ "apiVersion": "2017-07-01",
+ "name": "[[parameters('PlaybookName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Block-AADUser-EntityTrigger",
+ "hidden-SentinelTemplateVersion": "1.1",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]"
+ ],
"properties": {
- "description": "Identifies when a user account successfully logs onto an Azure App from one IP and within 10 mins failed to logon to the same App via a different IP (may indicate a malicious attempt at password guessing with known account). UEBA added for context.",
- "displayName": "Successful logon from IP and failure from a different IP",
- "enabled": false,
- "query": "let riskScoreCutoff = 20; //Adjust this based on volume of results\nlet logonDiff = 10m; let aadFunc = (tableName:string){ table(tableName)\n| where ResultType == \"0\"\n| where AppDisplayName !in (\"Office 365 Exchange Online\", \"Skype for Business Online\") // To remove false-positives, add more Apps to this array\n// ---------- Fix for SuccessBlock to also consider IPv6\n| extend SuccessIPv6Block = strcat(split(IPAddress, \":\")[0], \":\", split(IPAddress, \":\")[1], \":\", split(IPAddress, \":\")[2], \":\", split(IPAddress, \":\")[3])\n| extend SuccessIPv4Block = strcat(split(IPAddress, \".\")[0], \".\", split(IPAddress, \".\")[1])\n// ------------------\n| project SuccessLogonTime = TimeGenerated, UserPrincipalName, SuccessIPAddress = IPAddress, SuccessLocation = Location, AppDisplayName, SuccessIPBlock = iff(IPAddress contains \":\", strcat(split(IPAddress, \":\")[0], \":\", split(IPAddress, \":\")[1]), strcat(split(IPAddress, \".\")[0], \".\", split(IPAddress, \".\")[1])), Type\n| join kind= inner (\n table(tableName)\n | where ResultType !in (\"0\", \"50140\")\n | where ResultDescription !~ \"Other\"\n | where AppDisplayName !in (\"Office 365 Exchange Online\", \"Skype for Business Online\")\n | project FailedLogonTime = TimeGenerated, UserPrincipalName, FailedIPAddress = IPAddress, FailedLocation = Location, AppDisplayName, ResultType, ResultDescription, Type \n) on UserPrincipalName, AppDisplayName\n| where SuccessLogonTime < FailedLogonTime and FailedLogonTime - SuccessLogonTime <= logonDiff and FailedIPAddress !startswith SuccessIPBlock\n| summarize FailedLogonTime = max(FailedLogonTime), SuccessLogonTime = max(SuccessLogonTime) by UserPrincipalName, SuccessIPAddress, SuccessLocation, AppDisplayName, FailedIPAddress, FailedLocation, ResultType, ResultDescription, Type\n| extend timestamp = SuccessLogonTime\n| extend UserPrincipalName = tolower(UserPrincipalName)};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nunion isfuzzy=true aadSignin, aadNonInt\n| extend Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n// UEBA context below - make sure you have these 2 datatypes, otherwise the query will not work. If so, comment all that is below.\n| join kind=leftouter (\n IdentityInfo\n | summarize LatestReportTime = arg_max(TimeGenerated, *) by AccountUPN\n | extend BlastRadiusInt = iif(BlastRadius == \"High\", 1, 0)\n | project AccountUPN, Tags, JobTitle, GroupMembership, AssignedRoles, UserType, IsAccountEnabled, BlastRadiusInt\n | summarize\n Tags = make_set(Tags, 1000),\n GroupMembership = make_set(GroupMembership, 1000),\n AssignedRoles = make_set(AssignedRoles, 1000),\n BlastRadiusInt = sum(BlastRadiusInt),\n UserType = make_set(UserType, 1000),\n UserAccountControl = make_set(UserType, 1000)\n by AccountUPN\n | extend UserPrincipalName=tolower(AccountUPN)\n) on UserPrincipalName\n| join kind=leftouter (\n BehaviorAnalytics\n | where ActivityType in (\"FailedLogOn\", \"LogOn\")\n | where isnotempty(SourceIPAddress)\n | project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress\n | project-rename FailedIPAddress = SourceIPAddress\n | summarize\n UsersInsights = make_set(UsersInsights, 1000),\n DevicesInsights = make_set(DevicesInsights, 1000),\n IPInvestigationPriority = sum(InvestigationPriority)\n by FailedIPAddress)\non FailedIPAddress\n| extend UEBARiskScore = BlastRadiusInt + IPInvestigationPriority\n| where UEBARiskScore > riskScoreCutoff\n| sort by UEBARiskScore desc \n",
- "queryFrequency": "P1D",
- "queryPeriod": "P1D",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
},
- {
- "connectorId": "BehaviorAnalytics",
- "dataTypes": [
- "BehaviorAnalytics"
- ]
+ "triggers": {
+ "Microsoft_Sentinel_entity": {
+ "type": "ApiConnectionWebhook",
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "path": "/entity/@{encodeURIComponent('Account')}"
+ }
+ }
},
- {
- "connectorId": "IdentityInfo",
- "dataTypes": [
- "IdentityInfo"
- ]
- }
- ],
- "tactics": [
- "CredentialAccess",
- "InitialAccess"
- ],
- "techniques": [
- "T1110",
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
+ "actions": {
+ "Condition": {
+ "actions": {
+ "Condition_-_if_user_have_manager": {
+ "actions": {
+ "Condition_2": {
+ "actions": {
+ "Add_comment_to_incident_-_with_manager_-_no_admin": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['IncidentArmID']",
+ "message": "User @{triggerBody()?['Entity']?['properties']?['Name']} (UPN - @{variables('AccountDetails')}) was disabled in AAD via playbook Block-AADUser. Manager (@{body('Parse_JSON_-_get_user_manager')?['userPrincipalName']}) is notified.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ },
+ "runAfter": {
+ "Get_user_-_details": [
+ "Succeeded"
+ ]
+ },
+ "expression": {
+ "and": [
+ {
+ "not": {
+ "equals": [
+ "@triggerBody()?['IncidentArmID']",
+ "@null"
+ ]
+ }
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "Get_user_-_details": {
+ "type": "ApiConnection",
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuread']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/v1.0/users/@{encodeURIComponent(variables('AccountDetails'))}"
+ }
+ },
+ "Send_an_email_-_to_manager_-_no_admin": {
+ "runAfter": {
+ "Condition_2": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "Body": "Security notification! This is automated email sent by Microsoft Sentinel Automation!
\n
\nYour direct report @{triggerBody()?['Entity']?['properties']?['Name']} has been disabled in Azure AD due to the security incident. Can you please notify the user and work with him to reach our support.
\n
\nDirect report details:
\nFirst name: @{body('Get_user_-_details')?['displayName']}
\nSurname: @{body('Get_user_-_details')?['surname']}
\nJob title: @{body('Get_user_-_details')?['jobTitle']}
\nOffice location: @{body('Get_user_-_details')?['officeLocation']}
\nBusiness phone: @{body('Get_user_-_details')?['businessPhones']}
\nMobile phone: @{body('Get_user_-_details')?['mobilePhone']}
\nMail: @{body('Get_user_-_details')?['mail']}
\n
\nThank you!
",
+ "Importance": "High",
+ "Subject": "@{triggerBody()?['Entity']?['properties']?['Name']} has been disabled in Azure AD due to the security risk!",
+ "To": "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/v2/Mail"
+ }
+ }
+ },
+ "runAfter": {
+ "Parse_JSON_-_get_user_manager": [
+ "Succeeded"
+ ]
+ },
+ "else": {
+ "actions": {
+ "Condition_3": {
+ "actions": {
+ "Add_comment_to_incident_-_no_manager_-_no_admin": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['IncidentArmID']",
+ "message": "User @{triggerBody()?['Entity']?['properties']?['Name']} (UPN - @{variables('AccountDetails')}) was disabled in AAD via playbook Block-AADUser. Manager has not been notified, since it is not found for this user!
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "not": {
+ "equals": [
+ "@triggerBody()?['IncidentArmID']",
+ "@null"
+ ]
+ }
+ }
+ ]
+ },
+ "type": "If"
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "not": {
+ "equals": [
+ "@body('Parse_JSON_-_get_user_manager')?['userPrincipalName']",
+ "@null"
+ ]
+ }
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "HTTP_-_get_user_manager": {
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com/",
+ "type": "ManagedServiceIdentity"
+ },
+ "method": "GET",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{variables('AccountDetails')}/manager"
+ }
+ },
+ "Parse_JSON_-_get_user_manager": {
+ "runAfter": {
+ "HTTP_-_get_user_manager": [
+ "Succeeded",
+ "Failed"
+ ]
+ },
+ "type": "ParseJson",
+ "inputs": {
+ "content": "@body('HTTP_-_get_user_manager')",
+ "schema": {
+ "properties": {
+ "userPrincipalName": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ }
},
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "runAfter": {
+ "Update_user_-_disable_user": [
+ "Succeeded",
+ "Failed"
+ ]
+ },
+ "else": {
+ "actions": {
+ "Add_comment_to_incident_-_error_details": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['IncidentArmID']",
+ "message": "Block-AADUser playbook could not disable user @{triggerBody()?['Entity']?['properties']?['Name']}.
\nError message: @{body('Update_user_-_disable_user')['error']['message']}
\nNote: If user is admin, this playbook don't have privilages to block admin users!
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "equals": [
+ "@body('Update_user_-_disable_user')",
+ "@null"
+ ]
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "Initialize_variable_Account_Details": {
+ "type": "InitializeVariable",
+ "inputs": {
+ "variables": [
+ {
+ "name": "AccountDetails",
+ "type": "string"
+ }
+ ]
}
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "SuccessIPAddress"
+ },
+ "Set_variable": {
+ "runAfter": {
+ "Initialize_variable_Account_Details": [
+ "Succeeded"
+ ]
+ },
+ "type": "SetVariable",
+ "inputs": {
+ "name": "AccountDetails",
+ "value": "@{concat(triggerBody()?['Entity']?['properties']?['Name'],'@',triggerBody()?['Entity']?['properties']?['UPNSuffix'])}"
}
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "FailedIPAddress"
+ },
+ "Update_user_-_disable_user": {
+ "runAfter": {
+ "Set_variable": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "accountEnabled": false
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuread']['connectionId']"
+ }
+ },
+ "method": "patch",
+ "path": "/v1.0/users/@{encodeURIComponent(variables('AccountDetails'))}"
}
- ]
+ }
}
- ]
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId51'),'/'))))]",
- "properties": {
- "description": "Azure Active Directory Analytics Rule 51",
- "parentId": "[variables('analyticRuleId51')]",
- "contentId": "[variables('_analyticRulecontentId51')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion51')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
},
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
- }
- }
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId51')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Successful logon from IP and failure from a different IP",
- "contentProductId": "[variables('_analyticRulecontentProductId51')]",
- "id": "[variables('_analyticRulecontentProductId51')]",
- "version": "[variables('analyticRuleVersion51')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName52')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "SuspiciousAADJoinedDeviceUpdate_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion52')]",
- "parameters": {},
- "variables": {},
- "resources": [
- {
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId52')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
- "properties": {
- "description": "This query looks for suspicious updates to an Azure AD joined device where the device name is changed and the device falls out of compliance.\nThis could occur when a threat actor updates the details of an Autopilot provisioned device using a stolen device ticket, in order to access certificates and keys.\nRef: https://dirkjanm.io/assets/raw/Insomnihack%20Breaking%20and%20fixing%20Azure%20AD%20device%20identity%20security.pdf",
- "displayName": "Suspicious AAD Joined Device Update",
- "enabled": false,
- "query": "AuditLogs\n| where OperationName =~ \"Update device\"\n| mv-apply TargetResource=TargetResources on (\n where TargetResource.type =~ \"Device\"\n | extend ModifiedProperties = TargetResource.modifiedProperties\n | extend DeviceId = TargetResource.id)\n| mv-apply Prop=ModifiedProperties on ( \n where Prop.displayName =~ \"CloudDisplayName\"\n | extend OldName = Prop.oldValue \n | extend NewName = Prop.newValue)\n| mv-apply Prop=ModifiedProperties on ( \n where Prop.displayName =~ \"IsCompliant\"\n | extend OldComplianceState = Prop.oldValue \n | extend NewComplianceState = Prop.newValue)\n| mv-apply Prop=ModifiedProperties on ( \n where Prop.displayName =~ \"TargetId.DeviceTrustType\"\n | extend OldTrustType = Prop.oldValue \n | extend NewTrustType = Prop.newValue)\n| mv-apply Prop=ModifiedProperties on ( \n where Prop.displayName =~ \"Included Updated Properties\" \n | extend UpdatedProperties = Prop.newValue)\n| extend OldDeviceName = tostring(parse_json(tostring(OldName))[0])\n| extend NewDeviceName = tostring(parse_json(tostring(NewName))[0])\n| extend OldComplianceState = tostring(parse_json(tostring(OldComplianceState))[0])\n| extend NewComplianceState = tostring(parse_json(tostring(NewComplianceState))[0])\n| extend InitiatedByUser = tostring(iff(isnotempty(InitiatedBy.user.userPrincipalName),InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName))\n| extend UpdatedPropertiesCount = array_length(split(UpdatedProperties, ','))\n| where OldDeviceName != NewDeviceName\n| where OldComplianceState =~ 'true' and NewComplianceState =~ 'false'\n// Most common is transferring from AAD Registered to AAD Joined - we just want AAD Joined devices\n| where NewTrustType == '\"AzureAd\"' and OldTrustType != '\"Workplace\"'\n// We can modify this value to tune FPs - more properties changed about the device beyond its name the more suspicious it could be\n| where UpdatedPropertiesCount > 1\n| project-reorder TimeGenerated, DeviceId, NewDeviceName, OldDeviceName, NewComplianceState, InitiatedByUser, AADOperationType, OldTrustType, NewTrustType, UpdatedProperties, UpdatedPropertiesCount\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P1D",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
- }
- ],
- "tactics": [
- "CredentialAccess"
- ],
- "techniques": [
- "T1528"
- ],
- "entityMappings": [
- {
- "entityType": "Host",
- "fieldMappings": [
- {
- "identifier": "HostName",
- "columnName": "NewDeviceName"
- }
- ]
- },
- {
- "entityType": "Host",
- "fieldMappings": [
- {
- "identifier": "HostName",
- "columnName": "OldDeviceName"
- }
- ]
- },
- {
- "entityType": "Host",
- "fieldMappings": [
- {
- "identifier": "AzureID",
- "columnName": "DeviceId"
- }
- ]
- },
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "AadUserId",
- "columnName": "InitiatedByUser"
+ "parameters": {
+ "$connections": {
+ "value": {
+ "azuread": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureADConnectionName'))]",
+ "connectionName": "[[variables('AzureADConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuread')]"
+ },
+ "microsoftsentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
+ },
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "connectionName": "[[variables('Office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
}
- ]
+ }
}
- ],
- "alertDetailsOverride": {
- "alertDisplayNameFormat": "Suspicious AAD Joined Device Update {{OldDeviceName}} renamed to {{NewDeviceName}} and {{UpdatedPropertiesCount}} properties changed",
- "alertDescriptionFormat": "This query looks for suspicious updates to an Azure AD joined device where the device name is changed and the device falls out of compliance.\nIn this case {{OldDeviceName}} was renamed to {{NewDeviceName}} and {{UpdatedPropertiesCount}} properties were changed.\nThis could occur when a threat actor steals a Device ticket from an Autopilot provisioned device and uses it to AAD Join a new device.\nRef: https://dirkjanm.io/assets/raw/Insomnihack%20Breaking%20and%20fixing%20Azure%20AD%20device%20identity%20security.pdf\n"
}
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId52'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId7'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 52",
- "parentId": "[variables('analyticRuleId52')]",
- "contentId": "[variables('_analyticRulecontentId52')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion52')]",
+ "parentId": "[variables('playbookId7')]",
+ "contentId": "[variables('_playbookContentId7')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion7')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -11206,241 +11205,396 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Block AAD user - Entity trigger",
+ "description": "This playbook disables the selected user (account entity) in Azure Active Directoy. If this playbook triggered from an incident context, it will add a comment to the incident. This playbook will notify the disabled user manager if available. Note: This playbook will not disable admin user!",
+ "postDeployment": [
+ "1. Assign Microsoft Sentinel Responder role to the Playbook's managed identity.",
+ "2. Grant User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All permissions to the managed identity.",
+ "3. Authorize Azure AD and Office 365 Outlook Logic App connections."
+ ],
+ "lastUpdateTime": "2022-12-08T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": [
+ {
+ "version": "1.0.0",
+ "title": "Added manager notification action",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ ]
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId52')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Suspicious AAD Joined Device Update",
- "contentProductId": "[variables('_analyticRulecontentProductId52')]",
- "id": "[variables('_analyticRulecontentProductId52')]",
- "version": "[variables('analyticRuleVersion52')]"
+ "contentId": "[variables('_playbookContentId7')]",
+ "contentKind": "Playbook",
+ "displayName": "Block-AADUser-EntityTrigger",
+ "contentProductId": "[variables('_playbookcontentProductId7')]",
+ "id": "[variables('_playbookcontentProductId7')]",
+ "version": "[variables('playbookVersion7')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName53')]",
+ "name": "[variables('playbookTemplateSpecName8')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "SuspiciousOAuthApp_OfflineAccess_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Reset-AADUserPassword-EntityTrigger Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion53')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion8')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Reset-AADUserPassword-EntityTrigger",
+ "type": "string"
+ }
+ },
+ "variables": {
+ "MicrosoftSentinelConnectionName": "[[concat('microsoftsentinel-', parameters('PlaybookName'))]",
+ "office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId53')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
"properties": {
- "description": "This will alert when a user consents to provide a previously-unknown Azure application with offline access via OAuth.\nOffline access will provide the Azure App with access to the listed resources without requiring two-factor authentication.\nConsent to applications with offline access and read capabilities should be rare, especially as the knownApplications list is expanded. Public contributions to expand this filter are welcome!\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.",
- "displayName": "Suspicious application consent for offline access",
- "enabled": false,
- "query": "let detectionTime = 1d;\nlet joinLookback = 14d;\nAuditLogs\n| where TimeGenerated > ago(detectionTime)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Consent to application\"\n| where TargetResources has \"offline\"\n| mv-apply TargetResource=TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend ModifiedProperties = TargetResource.modifiedProperties,\n AppDisplayName = tostring(TargetResource.displayName),\n AppClientId = tolower(tostring(TargetResource.id))\n )\n| where AppClientId !in ((externaldata(knownAppClientId:string, knownAppDisplayName:string)[@\"https://raw.githubusercontent.com/Azure/Azure-Sentinel/master/Sample%20Data/Feeds/Microsoft.OAuth.KnownApplications.csv\"] with (format=\"csv\")))\n| mv-apply Properties=ModifiedProperties on \n (\n where Properties.displayName =~ \"ConsentAction.Permissions\"\n | extend ConsentFull = tostring(Properties.newValue)\n | extend ConsentFull = trim(@'\"',tostring(ConsentFull))\n )\n| parse ConsentFull with * \"ConsentType: \" GrantConsentType \", Scope: \" GrantScope1 \"]\" *\n| where ConsentFull has \"offline_access\" and ConsentFull has_any (\"Files.Read\", \"Mail.Read\", \"Notes.Read\", \"ChannelMessage.Read\", \"Chat.Read\", \"TeamsActivity.Read\", \"Group.Read\", \"EWS.AccessAsUser.All\", \"EAS.AccessAsUser.All\")\n| where GrantConsentType != \"AllPrincipals\" // NOTE: we are ignoring if OAuth application was granted to all users via an admin - but admin due diligence should be audited occasionally\n| extend GrantIpAddress = tostring(iff(isnotempty(InitiatedBy.user.ipAddress), InitiatedBy.user.ipAddress, InitiatedBy.app.ipAddress))\n| extend GrantInitiatedBy = tostring(iff(isnotempty(InitiatedBy.user.userPrincipalName),InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName))\n| extend GrantUserAgent = tostring(iff(AdditionalDetails[0].key =~ \"User-Agent\", AdditionalDetails[0].value, \"\"))\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, GrantIpAddress, GrantUserAgent, AppClientId, OperationName, ConsentFull, CorrelationId\n| join kind = leftouter (AuditLogs\n| where TimeGenerated > ago(joinLookback)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Add service principal\"\n| mv-apply TargetResource=TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\"\n | extend ModifiedProperties = TargetResource.modifiedProperties,\n AppClientId = tolower(TargetResource.id)\n )\n| mv-apply ModifiedProperties=TargetResource.modifiedProperties on \n (\n where ModifiedProperties.displayName =~ \"AppAddress\" and ModifiedProperties.newValue has \"AddressType\"\n | extend AppReplyURLs = ModifiedProperties.newValue\n )\n | distinct AppClientId, tostring(AppReplyURLs)\n)\non AppClientId\n| join kind = innerunique (AuditLogs\n| where TimeGenerated > ago(joinLookback)\n| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"ApplicationManagement\"\n| where OperationName =~ \"Add OAuth2PermissionGrant\" or OperationName =~ \"Add delegated permission grant\"\n | mv-apply TargetResource=TargetResources on \n (\n where TargetResource.type =~ \"ServicePrincipal\" and array_length(TargetResource.modifiedProperties) > 0 and isnotnull(TargetResource.displayName)\n | extend GrantAuthentication = tostring(TargetResource.displayName)\n )\n| extend GrantOperation = OperationName\n| project GrantAuthentication, GrantOperation, CorrelationId\n) on CorrelationId\n| project TimeGenerated, GrantConsentType, GrantScope1, GrantInitiatedBy, AppDisplayName, AppReplyURLs, GrantIpAddress, GrantUserAgent, AppClientId, GrantAuthentication, OperationName, GrantOperation, CorrelationId, ConsentFull\n| extend timestamp = TimeGenerated, Name = tostring(split(GrantInitiatedBy,'@',0)[0]), UPNSuffix = tostring(split(GrantInitiatedBy,'@',1)[0])\n",
- "queryFrequency": "P1D",
- "queryPeriod": "P14D",
- "severity": "Low",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
- }
- ],
- "tactics": [
- "CredentialAccess"
- ],
- "techniques": [
- "T1528"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
+ "provisioningState": "Succeeded",
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
+ },
+ "triggers": {
+ "Microsoft_Sentinel_entity": {
+ "type": "ApiConnectionWebhook",
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "path": "/entity/@{encodeURIComponent('Account')}"
+ }
+ }
+ },
+ "actions": {
+ "Condition_-_is_manager_available": {
+ "actions": {
+ "Condition_2": {
+ "actions": {
+ "Add_comment_to_incident_-_manager_available": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['IncidentArmID']",
+ "message": "User @{variables('AccountDetails')} password was reset in AAD and their manager @{body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']} was contacted using playbook.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ },
+ "runAfter": {
+ "Send_an_email_-_to_manager_with_password_details": [
+ "Succeeded"
+ ]
+ },
+ "expression": {
+ "and": [
+ {
+ "not": {
+ "equals": [
+ "@triggerBody()?['IncidentArmID']",
+ "@null"
+ ]
+ }
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "Parse_JSON_-_HTTP_-_get_manager": {
+ "type": "ParseJson",
+ "inputs": {
+ "content": "@body('HTTP_-_get_manager')",
+ "schema": {
+ "properties": {
+ "userPrincipalName": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ }
+ },
+ "Send_an_email_-_to_manager_with_password_details": {
+ "runAfter": {
+ "Parse_JSON_-_HTTP_-_get_manager": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "Body": "User, @{variables('AccountDetails')}, was involved in part of a security incident. As part of remediation, the user password has been reset.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
",
+ "Subject": "A user password was reset due to security incident.",
+ "To": "@body('Parse_JSON_-_HTTP_-_get_manager')?['userPrincipalName']"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/v2/Mail"
+ }
+ }
+ },
+ "runAfter": {
+ "HTTP_-_get_manager": [
+ "Succeeded",
+ "Failed"
+ ]
+ },
+ "else": {
+ "actions": {
+ "Condition": {
+ "actions": {
+ "Add_comment_to_incident_-_manager_not_available": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['IncidentArmID']",
+ "message": "User @{variables('AccountDetails')} password was reset in AAD but the user doesn't have a manager.
\n
\nThe temporary password is: @{variables('Password')}
\n
\nThe user will be required to reset this password upon login.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "not": {
+ "equals": [
+ "@triggerBody()?['IncidentArmID']",
+ "@null"
+ ]
+ }
+ }
+ ]
+ },
+ "type": "If"
+ }
+ }
+ },
+ "expression": {
+ "and": [
+ {
+ "equals": [
+ "@outputs('HTTP_-_get_manager')['statusCode']",
+ 200
+ ]
+ }
+ ]
},
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
+ "type": "If"
+ },
+ "HTTP_-_get_manager": {
+ "runAfter": {
+ "HTTP_-_reset_a_password": [
+ "Succeeded"
+ ]
+ },
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com",
+ "type": "ManagedServiceIdentity"
+ },
+ "method": "GET",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{variables('AccountDetails')}/manager"
}
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "GrantIpAddress"
+ },
+ "HTTP_-_reset_a_password": {
+ "runAfter": {
+ "Initialize_variable_Account": [
+ "Succeeded"
+ ]
+ },
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com",
+ "type": "ManagedServiceIdentity"
+ },
+ "body": {
+ "passwordProfile": {
+ "forceChangePasswordNextSignIn": true,
+ "forceChangePasswordNextSignInWithMfa": false,
+ "password": "@{variables('Password')}"
+ }
+ },
+ "method": "PATCH",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{variables('AccountDetails')}"
+ }
+ },
+ "Initialize_variable": {
+ "type": "InitializeVariable",
+ "inputs": {
+ "variables": [
+ {
+ "name": "Password",
+ "type": "String",
+ "value": "null"
+ }
+ ]
+ }
+ },
+ "Initialize_variable_Account": {
+ "runAfter": {
+ "Set_variable_-_password": [
+ "Succeeded"
+ ]
+ },
+ "type": "InitializeVariable",
+ "inputs": {
+ "variables": [
+ {
+ "name": "AccountDetails",
+ "type": "string",
+ "value": "@{concat(triggerBody()?['Entity']?['properties']?['Name'],'@',triggerBody()?['Entity']?['properties']?['UPNSuffix'])}"
+ }
+ ]
}
- ]
+ },
+ "Set_variable_-_password": {
+ "runAfter": {
+ "Initialize_variable": [
+ "Succeeded"
+ ]
+ },
+ "type": "SetVariable",
+ "inputs": {
+ "name": "Password",
+ "value": "@{substring(guid(), 0, 10)}"
+ }
+ }
}
- ]
- }
+ },
+ "parameters": {
+ "$connections": {
+ "value": {
+ "microsoftsentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
+ },
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]",
+ "connectionName": "[[variables('office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
+ }
+ }
+ }
+ }
+ },
+ "name": "[[parameters('PlaybookName')]",
+ "type": "Microsoft.Logic/workflows",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Reset-AADUserPassword-EntityTrigger",
+ "hidden-SentinelTemplateVersion": "1.1",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "apiVersion": "2017-07-01",
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('office365ConnectionName'))]"
+ ]
},
{
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId53'),'/'))))]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('MicrosoftSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
"properties": {
- "description": "Azure Active Directory Analytics Rule 53",
- "parentId": "[variables('analyticRuleId53')]",
- "contentId": "[variables('_analyticRulecontentId53')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion53')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
+ "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-2')]"
}
}
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId53')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Suspicious application consent for offline access",
- "contentProductId": "[variables('_analyticRulecontentProductId53')]",
- "id": "[variables('_analyticRulecontentProductId53')]",
- "version": "[variables('analyticRuleVersion53')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName54')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "SuspiciousServicePrincipalcreationactivity_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion54')]",
- "parameters": {},
- "variables": {},
- "resources": [
- {
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId54')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
- "properties": {
- "description": "This alert will detect creation of an SPN, permissions granted, credentials created, activity and deletion of the SPN in a time frame (default 10 minutes)",
- "displayName": "Suspicious Service Principal creation activity",
- "enabled": false,
- "query": "let queryfrequency = 1h;\nlet wait_for_deletion = 10m;\nlet account_created =\n AuditLogs \n | where ActivityDisplayName == \"Add service principal\"\n | where Result == \"success\"\n | extend AppID = tostring(AdditionalDetails[1].value)\n | extend creationTime = ActivityDateTime\n | extend userPrincipalName_creator = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)\n | extend ipAddress_creator = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress);\nlet account_activity =\n AADServicePrincipalSignInLogs\n | extend Activities = pack(\"ActivityTime\", TimeGenerated ,\"IpAddress\", IPAddress, \"ResourceDisplayName\", ResourceDisplayName)\n | extend AppID = AppId\n | summarize make_list(Activities) by AppID;\nlet account_deleted =\n AuditLogs \n | where OperationName == \"Remove service principal\"\n | where Result == \"success\"\n | extend AppID = tostring(AdditionalDetails[1].value)\n | extend deletionTime = ActivityDateTime\n | extend userPrincipalName_deleter = tostring(parse_json(tostring(InitiatedBy.user)).userPrincipalName)\n | extend ipAddress_deleter = tostring(parse_json(tostring(InitiatedBy.user)).ipAddress);\nlet account_credentials =\n AuditLogs\n | where OperationName has_all (\"Update application\", \"Certificates and secrets management\")\n | where Result == \"success\"\n | extend AppID = tostring(AdditionalDetails[1].value)\n | extend credentialCreationTime = ActivityDateTime;\nlet roles_assigned =\n AuditLogs\n | where ActivityDisplayName == \"Add app role assignment to service principal\"\n | extend AppID = tostring(TargetResources[1].displayName)\n | extend AssignedRole = iff(tostring(parse_json(tostring(TargetResources[0].modifiedProperties))[1].displayName)==\"AppRole.Value\", tostring(parse_json(tostring(parse_json(tostring(TargetResources[0].modifiedProperties))[1].newValue))),\"\")\n | extend AssignedRoles = pack(\"Role\", AssignedRole)\n | summarize make_list(AssignedRoles) by AppID;\naccount_created\n| where TimeGenerated between (ago(wait_for_deletion+queryfrequency)..ago(wait_for_deletion))\n| join kind= inner (account_activity) on AppID\n| join kind= inner (account_deleted) on AppID\n| join kind= inner (account_credentials) on AppID\n| join kind= inner (roles_assigned) on AppID\n| where deletionTime - creationTime between (time(0s)..wait_for_deletion)\n| extend AliveTime = deletionTime - creationTime\n| project AADTenantId, AppID, creationTime, deletionTime, userPrincipalName_creator, userPrincipalName_deleter, ipAddress_creator, ipAddress_deleter, list_Activities, list_AssignedRoles, AliveTime\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT70M",
- "severity": "Low",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs",
- "AADServicePrincipalSignInLogs"
- ]
- }
- ],
- "tactics": [
- "CredentialAccess",
- "PrivilegeEscalation",
- "InitialAccess"
- ],
- "techniques": [
- "T1078",
- "T1528"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "FullName",
- "columnName": "userPrincipalName_creator"
- }
- ]
- },
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "FullName",
- "columnName": "userPrincipalName_deleter"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "ipAddress_creator"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "ipAddress_deleter"
- }
- ]
- }
- ]
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
+ "properties": {
+ "displayName": "[[variables('office365ConnectionName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId54'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId8'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 54",
- "parentId": "[variables('analyticRuleId54')]",
- "contentId": "[variables('_analyticRulecontentId54')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion54')]",
+ "parentId": "[variables('playbookId8')]",
+ "contentId": "[variables('_playbookContentId8')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion8')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -11458,129 +11612,317 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Reset Azure AD User Password - Entity trigger",
+ "description": "This playbook will reset the user password using Graph API. It will send the password (which is a random guid substring) to the user's manager. The user will have to reset the password upon login.",
+ "postDeployment": [
+ "1. Assign Password Administrator permission to managed identity.",
+ "2. Assign Microsoft Sentinel Responder permission to managed identity.",
+ "3. Authorize Office 365 Outlook connection"
+ ],
+ "lastUpdateTime": "2022-12-06T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": {
+ "version": "1.1",
+ "title": "[variables('blanks')]",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId54')]",
- "contentKind": "AnalyticsRule",
- "displayName": "Suspicious Service Principal creation activity",
- "contentProductId": "[variables('_analyticRulecontentProductId54')]",
- "id": "[variables('_analyticRulecontentProductId54')]",
- "version": "[variables('analyticRuleVersion54')]"
+ "contentId": "[variables('_playbookContentId8')]",
+ "contentKind": "Playbook",
+ "displayName": "Reset-AADUserPassword-EntityTrigger",
+ "contentProductId": "[variables('_playbookcontentProductId8')]",
+ "id": "[variables('_playbookcontentProductId8')]",
+ "version": "[variables('playbookVersion8')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName55')]",
+ "name": "[variables('playbookTemplateSpecName9')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "UnusualGuestActivity_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Revoke-AADSignInSessions-alert Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion55')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion9')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Revoke-AADSignInSessions-alert",
+ "type": "string"
+ },
+ "UserName": {
+ "defaultValue": "@",
+ "type": "string"
+ }
+ },
+ "variables": {
+ "AzureSentinelConnectionName": "[[concat('azuresentinel-', parameters('PlaybookName'))]",
+ "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "Office365UsersConnectionName": "[[concat('office365users-', parameters('PlaybookName'))]",
+ "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-1": "[[variables('connection-1')]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365users')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId55')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('AzureSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
"properties": {
- "description": "By default guests have capability to invite more external guest users, guests also can do suspicious Azure AD enumeration. This detection look at guests\nusers, who have been invited or have invited recently, who also are logging via various PowerShell CLI.\nRef : 'https://danielchronlund.com/2021/11/18/scary-azure-ad-tenant-enumeration-using-regular-b2b-guest-accounts/",
- "displayName": "External guest invitation followed by Azure AD PowerShell signin",
- "enabled": false,
- "query": "let queryfrequency = 1h;\nlet queryperiod = 1d;\nAuditLogs\n| where TimeGenerated > ago(queryperiod)\n| where OperationName in (\"Invite external user\", \"Bulk invite users - started (bulk)\", \"Invite external user with reset invitation status\")\n| extend InitiatedBy = iff(isnotempty(InitiatedBy.user.userPrincipalName), InitiatedBy.user.userPrincipalName, InitiatedBy.app.displayName)\n// Uncomment the following line to filter events where the inviting user was a guest user\n//| where InitiatedBy has_any (\"live.com#\", \"#EXT#\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend InvitedUser = tostring(TargetResource.userPrincipalName)\n )\n| mv-expand UserToCompare = pack_array(InitiatedBy, InvitedUser) to typeof(string)\n| where UserToCompare has_any (\"live.com#\", \"#EXT#\")\n| extend\n parsedUser = replace_string(tolower(iff(UserToCompare startswith \"live.com#\", tostring(split(UserToCompare, \"#\")[1]), tostring(split(UserToCompare, \"#EXT#\")[0]))), \"@\", \"_\"),\n InvitationTime = TimeGenerated\n| join (\n (union isfuzzy=true SigninLogs, AADNonInteractiveUserSignInLogs)\n | where TimeGenerated > ago(queryfrequency)\n | where UserType != \"Member\"\n | where AppId has_any // This web may contain a list of these apps: https://msshells.net/\n (\"1b730954-1685-4b74-9bfd-dac224a7b894\",// Azure Active Directory PowerShell\n \"04b07795-8ddb-461a-bbee-02f9e1bf7b46\",// Microsoft Azure CLI\n \"1950a258-227b-4e31-a9cf-717495945fc2\",// Microsoft Azure PowerShell\n \"a0c73c16-a7e3-4564-9a95-2bdf47383716\",// Microsoft Exchange Online Remote PowerShell\n \"fb78d390-0c51-40cd-8e17-fdbfab77341b\",// Microsoft Exchange REST API Based Powershell\n \"d1ddf0e4-d672-4dae-b554-9d5bdfd93547\",// Microsoft Intune PowerShell\n \"9bc3ab49-b65d-410a-85ad-de819febfddc\",// Microsoft SharePoint Online Management Shell\n \"12128f48-ec9e-42f0-b203-ea49fb6af367\",// MS Teams Powershell Cmdlets\n \"23d8f6bd-1eb0-4cc2-a08c-7bf525c67bcd\",// Power BI PowerShell\n \"31359c7f-bd7e-475c-86db-fdb8c937548e\",// PnP Management Shell\n \"90f610bf-206d-4950-b61d-37fa6fd1b224\",// Aadrm Admin Powershell\n \"14d82eec-204b-4c2f-b7e8-296a70dab67e\" // Microsoft Graph PowerShell\n )\n | summarize arg_min(TimeGenerated, *) by UserPrincipalName\n | extend\n parsedUser = replace_string(UserPrincipalName, \"@\", \"_\"),\n SigninTime = TimeGenerated\n )\n on parsedUser\n| project InvitationTime, InitiatedBy, OperationName, InvitedUser, SigninTime, SigninCategory = Category1, SigninUserPrincipalName = UserPrincipalName, IPAddress, AppDisplayName, ResourceDisplayName, UserAgent, InvitationAdditionalDetails = AdditionalDetails, InvitationTargetResources = TargetResources\n| extend InvitedUserName = tostring(split(InvitedUser,'@',0)[0]), InvitedUserUPNSuffix = tostring(split(InvitedUser,'@',1)[0]), \n InitiatedByName = tostring(split(InitiatedBy,'@',0)[0]), InitiatedByUPNSuffix = tostring(split(InitiatedBy,'@',1)[0])\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "P1D",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
+ "displayName": "[[parameters('PlaybookName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-1')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('Office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "properties": {
+ "displayName": "[[parameters('UserName')]",
+ "api": {
+ "id": "[[variables('_connection-2')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('Office365UsersConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "properties": {
+ "displayName": "[[parameters('UserName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Logic/workflows",
+ "apiVersion": "2017-07-01",
+ "name": "[[parameters('PlaybookName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Revoke-AADSigninSessions_alert",
+ "hidden-SentinelTemplateVersion": "1.0",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('Office365UsersConnectionName'))]"
+ ],
+ "properties": {
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "actions": {
+ "Alert_-_Get_incident": {
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
+ },
+ "type": "ApiConnection"
+ },
+ "Entities_-_Get_Accounts": {
+ "inputs": {
+ "body": "@triggerBody()?['Entities']",
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/entities/account"
+ },
+ "runAfter": {
+ "Alert_-_Get_incident": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ },
+ "For_each": {
+ "actions": {
+ "Add_comment_to_incident_(V3)": {
+ "inputs": {
+ "body": {
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} singin sessions were revoked in AAD and their manager @{body('Get_manager_(V2)')?['displayName']} was contacted using playbook.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ },
+ "runAfter": {
+ "Send_an_email_(V2)": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ },
+ "Get_manager_(V2)": {
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365users']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/codeless/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}/manager"
+ },
+ "runAfter": {
+ "HTTP": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ },
+ "HTTP": {
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com",
+ "type": "ManagedServiceIdentity"
+ },
+ "method": "POST",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/revokeSignInSessions"
+ },
+ "type": "Http"
+ },
+ "Send_an_email_(V2)": {
+ "inputs": {
+ "body": {
+ "Body": "User, @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}, was involved in part of a security incident. As part of remediation, the user signin sessions have been revoked. The user will need to reauthenticate in all applications.
",
+ "Subject": "User signin sessions were reset due to security incident.",
+ "To": "@body('Get_manager_(V2)')?['mail']"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/v2/Mail"
+ },
+ "runAfter": {
+ "Get_manager_(V2)": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ }
+ },
+ "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
+ "runAfter": {
+ "Entities_-_Get_Accounts": [
+ "Succeeded"
+ ]
+ },
+ "type": "Foreach"
+ }
},
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
+ },
+ "triggers": {
+ "Microsoft_Sentinel_alert": {
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "path": "/subscribe"
+ },
+ "type": "ApiConnectionWebhook"
+ }
}
- ],
- "tactics": [
- "InitialAccess",
- "Persistence",
- "Discovery"
- ],
- "techniques": [
- "T1078",
- "T1136",
- "T1087"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "InvitedUserName"
+ },
+ "parameters": {
+ "$connections": {
+ "value": {
+ "azuresentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
+ "connectionName": "[[variables('AzureSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
},
- {
- "identifier": "UPNSuffix",
- "columnName": "InvitedUserUPNSuffix"
- }
- ]
- },
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "InitiatedByName"
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "connectionName": "[[variables('Office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
},
- {
- "identifier": "UPNSuffix",
- "columnName": "InitiatedByUPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IPAddress"
+ "office365users": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365UsersConnectionName'))]",
+ "connectionName": "[[variables('Office365UsersConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365users')]"
}
- ]
+ }
}
- ]
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId55'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId9'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 55",
- "parentId": "[variables('analyticRuleId55')]",
- "contentId": "[variables('_analyticRulecontentId55')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion55')]",
+ "parentId": "[variables('playbookId9')]",
+ "contentId": "[variables('_playbookContentId9')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion9')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -11598,368 +11940,317 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Revoke-AADSignInSessions alert trigger",
+ "description": "This playbook will revoke all signin sessions for the user using Graph API. It will send an email to the user's manager.",
+ "prerequisites": [
+ "1. You must create an app registration for graph api with appropriate permissions.",
+ "2. You will need to add the managed identity that is created by the logic app to the Password Administrator role in Azure AD."
+ ],
+ "comments": "This playbook will revoke all signin sessions for the user using Graph API using a Beta API. It will send and email to the user's manager.",
+ "lastUpdateTime": "2021-07-14T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": {
+ "version": "1.0",
+ "title": "[variables('blanks')]",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId55')]",
- "contentKind": "AnalyticsRule",
- "displayName": "External guest invitation followed by Azure AD PowerShell signin",
- "contentProductId": "[variables('_analyticRulecontentProductId55')]",
- "id": "[variables('_analyticRulecontentProductId55')]",
- "version": "[variables('analyticRuleVersion55')]"
+ "contentId": "[variables('_playbookContentId9')]",
+ "contentKind": "Playbook",
+ "displayName": "Revoke-AADSignInSessions-alert",
+ "contentProductId": "[variables('_playbookcontentProductId9')]",
+ "id": "[variables('_playbookcontentProductId9')]",
+ "version": "[variables('playbookVersion9')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName56')]",
+ "name": "[variables('playbookTemplateSpecName10')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "UserAccounts-CABlockedSigninSpikes_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Revoke-AADSignInSessions-incident Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion56')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion10')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Revoke-AADSignInSessions-incident",
+ "type": "string"
+ },
+ "UserName": {
+ "defaultValue": "@",
+ "type": "string"
+ }
+ },
+ "variables": {
+ "AzureSentinelConnectionName": "[[concat('azuresentinel-', parameters('PlaybookName'))]",
+ "Office365ConnectionName": "[[concat('office365-', parameters('PlaybookName'))]",
+ "Office365UsersConnectionName": "[[concat('office365users-', parameters('PlaybookName'))]",
+ "connection-1": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "_connection-1": "[[variables('connection-1')]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "connection-3": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365users')]",
+ "_connection-3": "[[variables('connection-3')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId56')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('AzureSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
"properties": {
- "description": " Identifies spike in failed sign-ins from user accounts due to conditional access policied.\nSpike is determined based on Time series anomaly which will look at historical baseline values.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-user-accounts#monitoring-for-failed-unusual-sign-ins\nThis query has also been updated to include UEBA logs IdentityInfo and BehaviorAnalytics for contextual information around the results.",
- "displayName": "User Accounts - Sign in Failure due to CA Spikes",
- "enabled": false,
- "query": "let riskScoreCutoff = 20; //Adjust this based on volume of results\nlet starttime = 14d;\nlet timeframe = 1d;\nlet scorethreshold = 3;\nlet baselinethreshold = 50;\nlet aadFunc = (tableName:string){\n // Failed Signins attempts with reasoning related to conditional access policies.\n table(tableName)\n | where TimeGenerated between (startofday(ago(starttime))..startofday(now()))\n | where ResultDescription has_any (\"conditional access\", \"CA\") or ResultType in (50005, 50131, 53000, 53001, 53002, 52003, 70044)\n | extend UserPrincipalName = tolower(UserPrincipalName)\n | extend timestamp = TimeGenerated, AccountCustomEntity = UserPrincipalName\n};\nlet aadSignin = aadFunc(\"SigninLogs\");\nlet aadNonInt = aadFunc(\"AADNonInteractiveUserSignInLogs\");\nlet allSignins = union isfuzzy=true aadSignin, aadNonInt;\nlet TimeSeriesAlerts = \nallSignins\n| make-series DailyCount=count() on TimeGenerated from startofday(ago(starttime)) to startofday(now()) step 1d by UserPrincipalName\n| extend (anomalies, score, baseline) = series_decompose_anomalies(DailyCount, scorethreshold, -1, 'linefit')\n| mv-expand DailyCount to typeof(double), TimeGenerated to typeof(datetime), anomalies to typeof(double), score to typeof(double), baseline to typeof(long)\n// Filtering low count events per baselinethreshold\n| where anomalies > 0 and baseline > baselinethreshold\n| extend AnomalyHour = TimeGenerated\n| project UserPrincipalName, AnomalyHour, TimeGenerated, DailyCount, baseline, anomalies, score;\n// Filter the alerts for specified timeframe\nTimeSeriesAlerts\n| where TimeGenerated > startofday(ago(timeframe))\n| join kind=inner ( \n allSignins\n | where TimeGenerated > startofday(ago(timeframe))\n // create a new column and round to hour\n | extend DateHour = bin(TimeGenerated, 1h)\n | summarize PartialFailedSignins = count(), LatestAnomalyTime = arg_max(TimeGenerated, *) by bin(TimeGenerated, 1h), OperationName, Category, ResultType, ResultDescription, UserPrincipalName, UserDisplayName, AppDisplayName, ClientAppUsed, IPAddress, ResourceDisplayName\n) on UserPrincipalName, $left.AnomalyHour == $right.DateHour\n| project LatestAnomalyTime, OperationName, Category, UserPrincipalName, UserDisplayName, ResultType, ResultDescription, AppDisplayName, ClientAppUsed, UserAgent, IPAddress, Location, AuthenticationRequirement, ConditionalAccessStatus, ResourceDisplayName, PartialFailedSignins, TotalFailedSignins = DailyCount, baseline, anomalies, score\n| extend timestamp = LatestAnomalyTime, Name = tostring(split(UserPrincipalName,'@',0)[0]), UPNSuffix = tostring(split(UserPrincipalName,'@',1)[0])\n| extend UserPrincipalName = tolower(UserPrincipalName)\n| join kind=leftouter (\n IdentityInfo\n | summarize LatestReportTime = arg_max(TimeGenerated, *) by AccountUPN\n | extend BlastRadiusInt = iif(BlastRadius == \"High\", 1, 0)\n | project AccountUPN, Tags, JobTitle, GroupMembership, AssignedRoles, UserType, IsAccountEnabled, BlastRadiusInt\n | summarize\n Tags = make_set(Tags, 1000),\n GroupMembership = make_set(GroupMembership, 1000),\n AssignedRoles = make_set(AssignedRoles, 1000),\n BlastRadiusInt = sum(BlastRadiusInt),\n UserType = make_set(UserType, 1000),\n UserAccountControl = make_set(UserType, 1000)\n by AccountUPN\n | extend UserPrincipalName=tolower(AccountUPN)\n) on UserPrincipalName\n| join kind=leftouter (\n BehaviorAnalytics\n | where ActivityType in (\"FailedLogOn\", \"LogOn\")\n | where isnotempty(SourceIPAddress)\n | project UsersInsights, DevicesInsights, ActivityInsights, InvestigationPriority, SourceIPAddress\n | project-rename IPAddress = SourceIPAddress\n | summarize\n UsersInsights = make_set(UsersInsights, 1000),\n DevicesInsights = make_set(DevicesInsights, 1000),\n IPInvestigationPriority = sum(InvestigationPriority)\n by IPAddress)\non IPAddress\n| extend UEBARiskScore = BlastRadiusInt + IPInvestigationPriority\n| where UEBARiskScore > riskScoreCutoff\n| sort by UEBARiskScore desc \n",
- "queryFrequency": "P1D",
- "queryPeriod": "P14D",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "SigninLogs"
- ]
- },
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AADNonInteractiveUserSignInLogs"
- ]
- },
- {
- "connectorId": "BehaviorAnalytics",
- "dataTypes": [
- "BehaviorAnalytics"
- ]
- },
- {
- "connectorId": "IdentityInfo",
- "dataTypes": [
- "IdentityInfo"
- ]
- }
- ],
- "tactics": [
- "InitialAccess"
- ],
- "techniques": [
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "Name"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- }
- ]
- },
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "IPAddress"
- }
- ]
- }
- ]
+ "displayName": "[[parameters('PlaybookName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-1')]"
+ }
+ }
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('Office365ConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "properties": {
+ "displayName": "[[parameters('UserName')]",
+ "api": {
+ "id": "[[variables('_connection-2')]"
+ }
}
},
{
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId56'),'/'))))]",
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('Office365UsersConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 56",
- "parentId": "[variables('analyticRuleId56')]",
- "contentId": "[variables('_analyticRulecontentId56')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion56')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
- },
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
+ "displayName": "[[parameters('UserName')]",
+ "api": {
+ "id": "[[variables('_connection-3')]"
}
}
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId56')]",
- "contentKind": "AnalyticsRule",
- "displayName": "User Accounts - Sign in Failure due to CA Spikes",
- "contentProductId": "[variables('_analyticRulecontentProductId56')]",
- "id": "[variables('_analyticRulecontentProductId56')]",
- "version": "[variables('analyticRuleVersion56')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName57')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "UseraddedtoPrivilgedGroups_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion57')]",
- "parameters": {},
- "variables": {},
- "resources": [
+ },
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId57')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
+ "type": "Microsoft.Logic/workflows",
+ "apiVersion": "2017-07-01",
+ "name": "[[parameters('PlaybookName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "LogicAppsCategory": "security",
+ "hidden-SentinelTemplateName": "Revoke-AADSigninSessions",
+ "hidden-SentinelTemplateVersion": "1.0",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "[[resourceId('Microsoft.Web/connections', variables('Office365UsersConnectionName'))]"
+ ],
"properties": {
- "description": "This will alert when a user is added to any of the Privileged Groups.\nFor further information on AuditLogs please see https://docs.microsoft.com/azure/active-directory/reports-monitoring/reference-audit-activities.\nFor Administrator role permissions in Azure Active Directory please see https://docs.microsoft.com/azure/active-directory/users-groups-roles/directory-assign-admin-roles",
- "displayName": "User added to Azure Active Directory Privileged Groups",
- "enabled": false,
- "query": "let OperationList = dynamic([\"Add member to role\",\"Add member to role in PIM requested (permanent)\"]);\nlet PrivilegedGroups = dynamic([\"UserAccountAdmins\",\"PrivilegedRoleAdmins\",\"TenantAdmins\"]);\nAuditLogs\n//| where LoggedByService =~ \"Core Directory\"\n| where Category =~ \"RoleManagement\"\n| where OperationName in~ (OperationList)\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type =~ \"User\"\n | extend TargetUserPrincipalName = tostring(TargetResource.userPrincipalName),\n modProps = TargetResource.modifiedProperties\n )\n| mv-apply Property = modProps on \n (\n where Property.displayName =~ \"Role.WellKnownObjectName\"\n | extend DisplayName = trim('\"',tostring(Property.displayName)),\n GroupName = trim('\"',tostring(Property.newValue))\n )\n| extend AppId = InitiatedBy.app.appId,\n InitiatedByDisplayName = case(isnotempty(InitiatedBy.app.displayName), InitiatedBy.app.displayName, isnotempty(InitiatedBy.user.displayName), InitiatedBy.user.displayName, \"not available\"),\n ServicePrincipalId = tostring(InitiatedBy.app.servicePrincipalId),\n ServicePrincipalName = tostring(InitiatedBy.app.servicePrincipalName),\n UserId = InitiatedBy.user.id,\n UserIPAddress = InitiatedBy.user.ipAddress,\n UserRoles = InitiatedBy.user.roles,\n UserPrincipalName = tostring(InitiatedBy.user.userPrincipalName)\n| where GroupName in~ (PrivilegedGroups)\n// If you don't want to alert for operations from PIM, remove below filtering for MS-PIM.\n//| where InitiatedByDisplayName != \"MS-PIM\"\n| project TimeGenerated, AADOperationType, Category, OperationName, AADTenantId, AppId, InitiatedByDisplayName, ServicePrincipalId, ServicePrincipalName, DisplayName, GroupName, UserId, UserIPAddress, UserRoles, UserPrincipalName, TargetUserPrincipalName\n| extend AccountCustomEntity = case(isnotempty(ServicePrincipalName), ServicePrincipalName, \n isnotempty(UserPrincipalName), UserPrincipalName, \n \"\")\n| extend AccountName = tostring(split(AccountCustomEntity,'@',0)[0]), AccountUPNSuffix = tostring(split(AccountCustomEntity,'@',1)[0])\n| extend TargetName = tostring(split(TargetUserPrincipalName,'@',0)[0]), TargetUPNSuffix = tostring(split(TargetUserPrincipalName,'@',1)[0])\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT1H",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
- }
- ],
- "tactics": [
- "Persistence",
- "PrivilegeEscalation"
- ],
- "techniques": [
- "T1098",
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "AccountName"
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "actions": {
+ "Alert_-_Get_incident": {
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/Incidents/subscriptions/@{encodeURIComponent(triggerBody()?['WorkspaceSubscriptionId'])}/resourceGroups/@{encodeURIComponent(triggerBody()?['WorkspaceResourceGroup'])}/workspaces/@{encodeURIComponent(triggerBody()?['WorkspaceId'])}/alerts/@{encodeURIComponent(triggerBody()?['SystemAlertId'])}"
},
- {
- "identifier": "UPNSuffix",
- "columnName": "AccountUPNSuffix"
- }
- ]
+ "type": "ApiConnection"
+ },
+ "Entities_-_Get_Accounts": {
+ "inputs": {
+ "body": "@triggerBody()?['Entities']",
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/entities/account"
+ },
+ "runAfter": {
+ "Alert_-_Get_incident": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ },
+ "For_each": {
+ "actions": {
+ "Add_comment_to_incident_(V3)": {
+ "inputs": {
+ "body": {
+ "incidentArmId": "@body('Alert_-_Get_incident')?['id']",
+ "message": "User @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])} singin sessions were revoked in AAD and their manager @{body('Get_manager_(V2)')?['displayName']} was contacted using playbook.
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ },
+ "runAfter": {
+ "Send_an_email_(V2)": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ },
+ "Get_manager_(V2)": {
+ "inputs": {
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365users']['connectionId']"
+ }
+ },
+ "method": "get",
+ "path": "/codeless/v1.0/users/@{encodeURIComponent(concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix']))}/manager"
+ },
+ "runAfter": {
+ "HTTP": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ },
+ "HTTP": {
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com",
+ "type": "ManagedServiceIdentity"
+ },
+ "method": "POST",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}/revokeSignInSessions"
+ },
+ "type": "Http"
+ },
+ "Send_an_email_(V2)": {
+ "inputs": {
+ "body": {
+ "Body": "User, @{concat(items('For_each')?['Name'], '@', items('for_each')?['UPNSuffix'])}, was involved in part of a security incident. As part of remediation, the user signin sessions have been revoked. The user will need to reauthenticate in all applications.
",
+ "Subject": "User signin sessions were reset due to security incident.",
+ "To": "@body('Get_manager_(V2)')?['mail']"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['office365']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/v2/Mail"
+ },
+ "runAfter": {
+ "Get_manager_(V2)": [
+ "Succeeded"
+ ]
+ },
+ "type": "ApiConnection"
+ }
+ },
+ "foreach": "@body('Entities_-_Get_Accounts')?['Accounts']",
+ "runAfter": {
+ "Entities_-_Get_Accounts": [
+ "Succeeded"
+ ]
+ },
+ "type": "Foreach"
+ }
},
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "TargetName"
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
+ },
+ "triggers": {
+ "Microsoft_Sentinel_alert": {
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['azuresentinel']['connectionId']"
+ }
+ },
+ "path": "/subscribe"
},
- {
- "identifier": "UPNSuffix",
- "columnName": "TargetUPNSuffix"
- }
- ]
+ "type": "ApiConnectionWebhook"
+ }
}
- ]
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
- "apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId57'),'/'))))]",
- "properties": {
- "description": "Azure Active Directory Analytics Rule 57",
- "parentId": "[variables('analyticRuleId57')]",
- "contentId": "[variables('_analyticRulecontentId57')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion57')]",
- "source": {
- "kind": "Solution",
- "name": "Azure Active Directory",
- "sourceId": "[variables('_solutionId')]"
- },
- "author": {
- "name": "Microsoft",
- "email": "[variables('_email')]"
},
- "support": {
- "tier": "Microsoft",
- "name": "Microsoft Corporation",
- "email": "support@microsoft.com",
- "link": "https://support.microsoft.com/"
- }
- }
- }
- ]
- },
- "packageKind": "Solution",
- "packageVersion": "[variables('_solutionVersion')]",
- "packageName": "[variables('_solutionName')]",
- "packageId": "[variables('_solutionId')]",
- "contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId57')]",
- "contentKind": "AnalyticsRule",
- "displayName": "User added to Azure Active Directory Privileged Groups",
- "contentProductId": "[variables('_analyticRulecontentProductId57')]",
- "id": "[variables('_analyticRulecontentProductId57')]",
- "version": "[variables('analyticRuleVersion57')]"
- }
- },
- {
- "type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
- "apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName58')]",
- "location": "[parameters('workspace-location')]",
- "dependsOn": [
- "[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
- ],
- "properties": {
- "description": "UserAssignedPrivilegedRole_AnalyticalRules Analytics Rule with template version 3.0.3",
- "mainTemplate": {
- "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion58')]",
- "parameters": {},
- "variables": {},
- "resources": [
- {
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId58')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
- "properties": {
- "description": "Identifies when a new privileged role is assigned to a user. Any account eligible for a role is now being given privileged access. If the assignment is unexpected or into a role that isn't the responsibility of the account holder, investigate.\nRef : https://docs.microsoft.com/azure/active-directory/fundamentals/security-operations-privileged-accounts#things-to-monitor-1",
- "displayName": "User Assigned Privileged Role",
- "enabled": false,
- "query": "AuditLogs\n| where Category =~ \"RoleManagement\"\n| where AADOperationType in (\"Assign\", \"AssignEligibleRole\")\n| where ActivityDisplayName has_any (\"Add eligible member to role\", \"Add member to role\")\n| mv-apply TargetResource = TargetResources on \n (\n where TargetResource.type in~ (\"User\", \"ServicePrincipal\")\n | extend Target = iff(TargetResource.type =~ \"ServicePrincipal\", tostring(TargetResource.displayName), tostring(TargetResource.userPrincipalName)),\n props = TargetResource.modifiedProperties\n )\n| mv-apply Property = props on \n (\n where Property.displayName =~ \"Role.DisplayName\"\n | extend RoleName = trim('\"',tostring(Property.newValue))\n )\n| where RoleName contains \"Admin\"\n| extend InitiatingApp = tostring(InitiatedBy.app.displayName)\n| extend Initiator = iif(isnotempty(InitiatingApp), InitiatingApp, tostring(InitiatedBy.user.userPrincipalName))\n// Uncomment below to not alert for PIM activations\n//| where Initiator != \"MS-PIM\"\n| summarize by bin(TimeGenerated, 1h), OperationName, RoleName, Target, Initiator, Result\n| extend TargetName = tostring(split(Target,'@',0)[0]), TargetUPNSuffix = tostring(split(Target,'@',1)[0]), InitiatorName = tostring(split(Initiator,'@',0)[0]), InitiatorUPNSuffix = tostring(split(Initiator,'@',1)[0])\n",
- "queryFrequency": "PT2H",
- "queryPeriod": "PT2H",
- "severity": "High",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
- }
- ],
- "tactics": [
- "Persistence"
- ],
- "techniques": [
- "T1078"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "TargetName"
+ "parameters": {
+ "$connections": {
+ "value": {
+ "azuresentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('AzureSentinelConnectionName'))]",
+ "connectionName": "[[variables('AzureSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
},
- {
- "identifier": "UPNSuffix",
- "columnName": "TargetUPNSuffix"
- }
- ]
- },
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "InitiatorName"
+ "office365": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365ConnectionName'))]",
+ "connectionName": "[[variables('Office365ConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365')]"
},
- {
- "identifier": "UPNSuffix",
- "columnName": "InitiatorUPNSuffix"
+ "office365users": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('Office365UsersConnectionName'))]",
+ "connectionName": "[[variables('Office365UsersConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/office365users')]"
}
- ]
+ }
}
- ]
+ }
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId58'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId10'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 58",
- "parentId": "[variables('analyticRuleId58')]",
- "contentId": "[variables('_analyticRulecontentId58')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion58')]",
+ "parentId": "[variables('playbookId10')]",
+ "contentId": "[variables('_playbookContentId10')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion10')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -11977,126 +12268,204 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Revoke AAD SignIn Sessions - incident trigger",
+ "description": "This playbook will revoke all signin sessions for the user using Graph API. It will send an email to the user's manager.",
+ "prerequisites": "1. You will need to grant User.ReadWrite.All permissions to the managed identity.",
+ "lastUpdateTime": "2021-07-14T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "tags": [
+ "Remediation"
+ ],
+ "releaseNotes": {
+ "version": "1.0",
+ "title": "[variables('blanks')]",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId58')]",
- "contentKind": "AnalyticsRule",
- "displayName": "User Assigned Privileged Role",
- "contentProductId": "[variables('_analyticRulecontentProductId58')]",
- "id": "[variables('_analyticRulecontentProductId58')]",
- "version": "[variables('analyticRuleVersion58')]"
+ "contentId": "[variables('_playbookContentId10')]",
+ "contentKind": "Playbook",
+ "displayName": "Revoke-AADSignInSessions-incident",
+ "contentProductId": "[variables('_playbookcontentProductId10')]",
+ "id": "[variables('_playbookcontentProductId10')]",
+ "version": "[variables('playbookVersion10')]"
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/contentTemplates",
"apiVersion": "2023-04-01-preview",
- "name": "[variables('analyticRuleTemplateSpecName59')]",
+ "name": "[variables('playbookTemplateSpecName11')]",
"location": "[parameters('workspace-location')]",
"dependsOn": [
"[extensionResourceId(resourceId('Microsoft.OperationalInsights/workspaces', parameters('workspace')), 'Microsoft.SecurityInsights/contentPackages', variables('_solutionId'))]"
],
"properties": {
- "description": "NewOnmicrosoftDomainAdded_AnalyticalRules Analytics Rule with template version 3.0.3",
+ "description": "Revoke-AADSignIn-Session-entityTrigger Playbook with template version 3.0.3",
"mainTemplate": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
- "contentVersion": "[variables('analyticRuleVersion59')]",
- "parameters": {},
- "variables": {},
+ "contentVersion": "[variables('playbookVersion11')]",
+ "parameters": {
+ "PlaybookName": {
+ "defaultValue": "Revoke-AADSignIn-Session-entityTrigger",
+ "type": "string"
+ }
+ },
+ "variables": {
+ "MicrosoftSentinelConnectionName": "[[concat('MicrosoftSentinel-', parameters('PlaybookName'))]",
+ "connection-2": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/Azuresentinel')]",
+ "_connection-2": "[[variables('connection-2')]",
+ "workspace-location-inline": "[concat('[resourceGroup().locatio', 'n]')]",
+ "workspace-name": "[parameters('workspace')]",
+ "workspaceResourceId": "[[resourceId('microsoft.OperationalInsights/Workspaces', variables('workspace-name'))]"
+ },
"resources": [
{
- "type": "Microsoft.SecurityInsights/AlertRuleTemplates",
- "name": "[variables('analyticRulecontentId59')]",
- "apiVersion": "2022-04-01-preview",
- "kind": "Scheduled",
- "location": "[parameters('workspace-location')]",
"properties": {
- "description": "This detection looks for new onmicrosoft domains being added to a tenant. \nAn attacker who compromises a tenant may register a new onmicrosoft domain in order to masquerade as a service provider for launching phishing campaigns.\nDomain additions are not a common occurrence and users should validate that the domain was added by a legitimate user, with a legitimate purpose.",
- "displayName": "New onmicrosoft domain added to tenant",
- "enabled": false,
- "query": "AuditLogs\n| where AADOperationType == \"Add\"\n| where Result == \"success\"\n| where OperationName in (\"Add verified domain\", \"Add unverified domain\")\n| extend InitiatedBy = parse_json(InitiatedBy)\n| extend InitiatingUser = tostring(InitiatedBy.user.userPrincipalName)\n| extend InitiatingIp = tostring(InitiatedBy.user.ipAddress)\n| extend InitiatingApp = tostring(InitiatedBy.app.displayName)\n| extend InitiatingSPID = tostring(InitiatedBy.app.servicePrincipalId)\n| extend DomainAdded = tostring(TargetResources[0].displayName)\n| where DomainAdded has \"onmicrosoft\"\n| extend ActionInitiatedBy = case(isnotempty(InitiatingUser), InitiatingUser, strcat(InitiatingApp, \" - \", InitiatingSPID))\n| extend UserName = split(InitiatingUser, \"@\")[0]\n| extend UPNSuffix = split(InitiatingUser, \"@\")[1]\n| project-reorder TimeGenerated, OperationName, DomainAdded, ActionInitiatedBy, InitiatingIp\n",
- "queryFrequency": "PT1H",
- "queryPeriod": "PT1H",
- "severity": "Medium",
- "suppressionDuration": "PT1H",
- "suppressionEnabled": false,
- "triggerOperator": "GreaterThan",
- "triggerThreshold": 0,
- "status": "Available",
- "requiredDataConnectors": [
- {
- "connectorId": "AzureActiveDirectory",
- "dataTypes": [
- "AuditLogs"
- ]
- }
- ],
- "tactics": [
- "ResourceDevelopment"
- ],
- "techniques": [
- "T1585"
- ],
- "entityMappings": [
- {
- "entityType": "Account",
- "fieldMappings": [
- {
- "identifier": "Name",
- "columnName": "UserName"
- },
- {
- "identifier": "UPNSuffix",
- "columnName": "UPNSuffix"
- },
- {
- "identifier": "AadUserId",
- "columnName": "InitiatingSPID"
- }
- ]
+ "provisioningState": "Succeeded",
+ "state": "Enabled",
+ "definition": {
+ "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "$connections": {
+ "type": "Object"
+ }
},
- {
- "entityType": "IP",
- "fieldMappings": [
- {
- "identifier": "Address",
- "columnName": "InitiatingIp"
+ "triggers": {
+ "Microsoft_Sentinel_entity": {
+ "type": "ApiConnectionWebhook",
+ "inputs": {
+ "body": {
+ "callback_url": "@{listCallbackUrl()}"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "path": "/entity/@{encodeURIComponent('Account')}"
}
- ]
+ }
},
- {
- "entityType": "DNS",
- "fieldMappings": [
- {
- "identifier": "DomainName",
- "columnName": "DomainAdded"
+ "actions": {
+ "Condition": {
+ "actions": {
+ "Add_comment_to_incident_(V3)_-_session_revoked": {
+ "type": "ApiConnection",
+ "inputs": {
+ "body": {
+ "incidentArmId": "@triggerBody()?['IncidentArmID']",
+ "message": "Sign-in session revoked for the user - @{concat(triggerBody()?['Entity']?['properties']?['Name'], '@', triggerBody()?['Entity']?['properties']?['upnSuffix'])}
"
+ },
+ "host": {
+ "connection": {
+ "name": "@parameters('$connections')['microsoftsentinel']['connectionId']"
+ }
+ },
+ "method": "post",
+ "path": "/Incidents/Comment"
+ }
+ }
+ },
+ "runAfter": {
+ "HTTP_-_revoke_sign-in_session": [
+ "Succeeded"
+ ]
+ },
+ "expression": {
+ "and": [
+ {
+ "not": {
+ "equals": [
+ "@triggerBody()?['IncidentArmID']",
+ "@null"
+ ]
+ }
+ }
+ ]
+ },
+ "type": "If"
+ },
+ "HTTP_-_revoke_sign-in_session": {
+ "type": "Http",
+ "inputs": {
+ "authentication": {
+ "audience": "https://graph.microsoft.com",
+ "type": "ManagedServiceIdentity"
+ },
+ "method": "POST",
+ "uri": "https://graph.microsoft.com/v1.0/users/@{concat(triggerBody()?['Entity']?['properties']?['Name'], '@', triggerBody()?['Entity']?['properties']?['upnSuffix'])}/revokeSignInSessions"
}
- ]
+ }
}
- ],
- "eventGroupingSettings": {
- "aggregationKind": "SingleAlert"
},
- "alertDetailsOverride": {
- "alertDisplayNameFormat": "{{DomainAdded}} added to tenant by {{ActionInitiatedBy}}",
- "alertDescriptionFormat": "This detection looks for new onmicrosoft domains being added to a tenant. An attacker who compromises a tenant may register a new onmicrosoft domain in order to masquerade as a service provider for launching phishing accounts. Domain additions are not a common occurrence and users should validate that {{ActionInitiatedBy}} added {{DomainAdded}} with a legitimate purpose."
+ "parameters": {
+ "$connections": {
+ "value": {
+ "microsoftsentinel": {
+ "connectionId": "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]",
+ "connectionName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "id": "[[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Web/locations/', variables('workspace-location-inline'), '/managedApis/Azuresentinel')]",
+ "connectionProperties": {
+ "authentication": {
+ "type": "ManagedServiceIdentity"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "name": "[[parameters('PlaybookName')]",
+ "type": "Microsoft.Logic/workflows",
+ "location": "[[variables('workspace-location-inline')]",
+ "tags": {
+ "hidden-SentinelTemplateName": "Revoke-AADSignIn-Session-entityTrigger",
+ "hidden-SentinelTemplateVersion": "1.0",
+ "hidden-SentinelWorkspaceId": "[[variables('workspaceResourceId')]"
+ },
+ "identity": {
+ "type": "SystemAssigned"
+ },
+ "apiVersion": "2017-07-01",
+ "dependsOn": [
+ "[[resourceId('Microsoft.Web/connections', variables('MicrosoftSentinelConnectionName'))]"
+ ]
+ },
+ {
+ "type": "Microsoft.Web/connections",
+ "apiVersion": "2016-06-01",
+ "name": "[[variables('MicrosoftSentinelConnectionName')]",
+ "location": "[[variables('workspace-location-inline')]",
+ "kind": "V1",
+ "properties": {
+ "displayName": "[[variables('MicrosoftSentinelConnectionName')]",
+ "parameterValueType": "Alternative",
+ "api": {
+ "id": "[[variables('_connection-2')]"
}
}
},
{
"type": "Microsoft.OperationalInsights/workspaces/providers/metadata",
"apiVersion": "2022-01-01-preview",
- "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('AnalyticsRule-', last(split(variables('analyticRuleId59'),'/'))))]",
+ "name": "[concat(parameters('workspace'),'/Microsoft.SecurityInsights/',concat('Playbook-', last(split(variables('playbookId11'),'/'))))]",
"properties": {
- "description": "Azure Active Directory Analytics Rule 59",
- "parentId": "[variables('analyticRuleId59')]",
- "contentId": "[variables('_analyticRulecontentId59')]",
- "kind": "AnalyticsRule",
- "version": "[variables('analyticRuleVersion59')]",
+ "parentId": "[variables('playbookId11')]",
+ "contentId": "[variables('_playbookContentId11')]",
+ "kind": "Playbook",
+ "version": "[variables('playbookVersion11')]",
"source": {
"kind": "Solution",
"name": "Azure Active Directory",
@@ -12114,19 +12483,38 @@
}
}
}
- ]
+ ],
+ "metadata": {
+ "title": "Revoke AAD Sign-in session using entity trigger",
+ "description": "This playbook will revoke user's sign-in sessions and user will have to perform authentication again. It invalidates all the refresh tokens issued to applications for a user (as well as session cookies in a user's browser), by resetting the signInSessionsValidFromDateTime user property to the current date-time.",
+ "postDeployment": [
+ "1. Add Microsoft Sentinel Responder role to the managed identity.",
+ "2. Assign User.ReadWrite.All and Directory.ReadWrite.All API permissions to the managed identity."
+ ],
+ "lastUpdateTime": "2022-12-22T00:00:00Z",
+ "entities": [
+ "Account"
+ ],
+ "releaseNotes": {
+ "version": "1.0",
+ "title": "[variables('blanks')]",
+ "notes": [
+ "Initial version"
+ ]
+ }
+ }
},
"packageKind": "Solution",
"packageVersion": "[variables('_solutionVersion')]",
"packageName": "[variables('_solutionName')]",
"packageId": "[variables('_solutionId')]",
"contentSchemaVersion": "3.0.0",
- "contentId": "[variables('_analyticRulecontentId59')]",
- "contentKind": "AnalyticsRule",
- "displayName": "New onmicrosoft domain added to tenant",
- "contentProductId": "[variables('_analyticRulecontentProductId59')]",
- "id": "[variables('_analyticRulecontentProductId59')]",
- "version": "[variables('analyticRuleVersion59')]"
+ "contentId": "[variables('_playbookContentId11')]",
+ "contentKind": "Playbook",
+ "displayName": "Revoke-AADSignIn-Session-entityTrigger",
+ "contentProductId": "[variables('_playbookcontentProductId11')]",
+ "id": "[variables('_playbookcontentProductId11')]",
+ "version": "[variables('playbookVersion11')]"
}
},
{
@@ -12139,7 +12527,7 @@
"contentSchemaVersion": "3.0.0",
"displayName": "Azure Active Directory",
"publisherDisplayName": "Microsoft Sentinel, Microsoft Corporation",
- "descriptionHtml": "Note: There may be known issues pertaining to this Solution, please refer to them before installing.
\nThe Azure Active Directory solution for Microsoft Sentinel enables you to ingest Azure Active Directory Audit, Sign-in, Provisioning, Risk Events and Risky User/Service Principal logs using Diagnostic Settings into Microsoft Sentinel.
\nWorkbooks: 2, Analytic Rules: 59, Playbooks: 11
\nLearn more about Microsoft Sentinel | Learn more about Solutions
\n",
+ "descriptionHtml": "Note: There may be known issues pertaining to this Solution, please refer to them before installing.
\nThe Azure Active Directory solution for Microsoft Sentinel enables you to ingest Azure Active Directory Audit, Sign-in, Provisioning, Risk Events and Risky User/Service Principal logs using Diagnostic Settings into Microsoft Sentinel.
\nData Connectors: 1, Workbooks: 2, Analytic Rules: 59, Playbooks: 11
\nLearn more about Microsoft Sentinel | Learn more about Solutions
\n",
"contentKind": "Solution",
"contentProductId": "[variables('_solutioncontentProductId')]",
"id": "[variables('_solutioncontentProductId')]",
@@ -12165,59 +12553,9 @@
"operator": "AND",
"criteria": [
{
- "kind": "Playbook",
- "contentId": "[variables('_Block-AADUser-alert-trigger')]",
- "version": "[variables('playbookVersion1')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Block-AADUser-entity-trigger')]",
- "version": "[variables('playbookVersion2')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Block-AADUser-incident-trigger')]",
- "version": "[variables('playbookVersion3')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Prompt-User-alert-trigger')]",
- "version": "[variables('playbookVersion4')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Prompt-User-incident-trigger')]",
- "version": "[variables('playbookVersion5')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Reset-AADUserPassword-alert-trigger')]",
- "version": "[variables('playbookVersion6')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Reset-AADUserPassword-entity-trigger')]",
- "version": "[variables('playbookVersion7')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Reset-AADUserPassword-incident-trigger')]",
- "version": "[variables('playbookVersion8')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Revoke-AADSignInSessions-alert-trigger')]",
- "version": "[variables('playbookVersion9')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Revoke-AADSignInSessions-entity-trigger')]",
- "version": "[variables('playbookVersion10')]"
- },
- {
- "kind": "Playbook",
- "contentId": "[variables('_Revoke-AADSignInSessions-incident-trigger')]",
- "version": "[variables('playbookVersion11')]"
+ "kind": "DataConnector",
+ "contentId": "[variables('_dataConnectorContentId1')]",
+ "version": "[variables('dataConnectorVersion1')]"
},
{
"kind": "Workbook",
@@ -12523,6 +12861,61 @@
"kind": "AnalyticsRule",
"contentId": "[variables('analyticRulecontentId59')]",
"version": "[variables('analyticRuleVersion59')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Block-AADUser-alert-trigger')]",
+ "version": "[variables('playbookVersion1')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Block-AADUser-incident-trigger')]",
+ "version": "[variables('playbookVersion2')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Prompt-User-alert-trigger')]",
+ "version": "[variables('playbookVersion3')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Prompt-User-incident-trigger')]",
+ "version": "[variables('playbookVersion4')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Reset-AADUserPassword-alert-trigger')]",
+ "version": "[variables('playbookVersion5')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Reset-AADUserPassword-incident-trigger')]",
+ "version": "[variables('playbookVersion6')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Block-AADUser-entity-trigger')]",
+ "version": "[variables('playbookVersion7')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Reset-AADUserPassword-entity-trigger')]",
+ "version": "[variables('playbookVersion8')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Revoke-AADSignInSessions-alert-trigger')]",
+ "version": "[variables('playbookVersion9')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Revoke-AADSignInSessions-incident-trigger')]",
+ "version": "[variables('playbookVersion10')]"
+ },
+ {
+ "kind": "Playbook",
+ "contentId": "[variables('_Revoke-AADSignInSessions-entity-trigger')]",
+ "version": "[variables('playbookVersion11')]"
}
]
},
diff --git a/Solutions/Azure Active Directory/ReleaseNotes.md b/Solutions/Azure Active Directory/ReleaseNotes.md
index 3ab7989e706..cf294f260bc 100644
--- a/Solutions/Azure Active Directory/ReleaseNotes.md
+++ b/Solutions/Azure Active Directory/ReleaseNotes.md
@@ -1,6 +1,6 @@
| **Version** | **Date Modified (DD-MM-YYYY)** | **Change History** |
|-------------|--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
-| 3.0.3 | 22-09-2023 | 1 **Analytic Rules** updated in the solution (PIM Elevation Request Rejected) |
+| 3.0.3 | 22-09-2023 | 2 **Analytic Rules** updated in the solution (PIM Elevation Request Rejected),(NRT Authentication Methods Changed for VIP Users) |
| 3.0.2 | 08-08-2023 | 1 **Analytic Rules** updated in the solution (Credential added after admin consented to Application) |
| 3.0.1 | 01-08-2023 | Added new **Analytic Rule** (New onmicrosoft domain added to tenant) |
| 3.0.0 | 19-07-2023 | 2 **Analytic Rules** updated in the solution (User Assigned Privileged Role,Successful logon from IP and failure from a different IP) |