|
| 1 | +# Lock SAP User from Teams - Basic (Consumption) |
| 2 | + |
| 3 | +This playbook locks an SAP ERP user when triggered by a Microsoft Sentinel incident leveraging the SAP Integration Suite. It posts an adaptive card to a Teams channel, letting an analyst choose to **block the user** on SAP ERP (or flag as false positive). |
| 4 | + |
| 5 | +Unlike a static approach that assumes the SAP alert is always the first alert, this playbook **dynamically searches all alerts** in the incident for SAP-specific Custom Details (`SAP_User`, `SidGuid`, `AgentGuid`). This makes it compatible with **complex, multi-alert incidents from Defender XDR**. |
| 6 | + |
| 7 | +[](https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2FAzure-Sentinel%2Fmaster%2FSolutions%2FSAP%2FPlaybooks%2FBasic-SAPLockUser%2Fazuredeploy.json) |
| 8 | +[](https://portal.azure.us/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2FAzure-Sentinel%2Fmaster%2FSolutions%2FSAP%2FPlaybooks%2FBasic-SAPLockUser%2Fazuredeploy.json) |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +| Item | Detail | |
| 13 | +| --- | --- | |
| 14 | +| **Logic App type** | Consumption | |
| 15 | +| **Trigger** | Microsoft Sentinel incident | |
| 16 | +| **Connectors** | Microsoft Sentinel (Managed Identity), Microsoft Teams | |
| 17 | +| **SAP integration** | SAP Integration Suite (CPI) iFlow via OAuth2 client credentials | |
| 18 | + |
| 19 | +### Flow summary |
| 20 | + |
| 21 | +``` |
| 22 | +Incident trigger |
| 23 | + ├─ Filter all alerts → find SAP alert with Custom Details containing SAP_User |
| 24 | + ├─ No SAP alert found? → add incident comment, exit gracefully |
| 25 | + ├─ Post adaptive card to Teams (incident info + SAP user + block/flag) |
| 26 | + ├─ Block path: |
| 27 | + │ ├─ SAP ERP → OAuth token → lock user via Integration Suite → notify + close incident |
| 28 | + │ ├─ Entra ID → placeholder (extend with Entra ID connector) |
| 29 | + │ └─ SAP BTP → placeholder (extend with IAS/XSUAA REST call) |
| 30 | + ├─ Flag path: close incident as false positive |
| 31 | + └─ Error handlers: notify admin via Teams bot chat |
| 32 | +``` |
| 33 | + |
| 34 | +## Prerequisites |
| 35 | + |
| 36 | +1. **SAP Integration Suite** with the community [user lock/unlock iFlow](https://github.com/Azure-Samples/Sentinel-For-SAP-Community/tree/main/integration-artifacts/solution-packages/baseline-extension-package) deployed. |
| 37 | +2. **OAuth2 client credentials** (client ID + secret) from the SAP Process Integration runtime. |
| 38 | +3. **Microsoft Teams** channel for incident notifications (you'll need the Team ID and Channel ID). |
| 39 | +4. **Microsoft Sentinel Responder** role assigned to the Logic App's managed identity on the Sentinel workspace. |
| 40 | + |
| 41 | +## Deployment parameters |
| 42 | + |
| 43 | +| Parameter | Description | Example | |
| 44 | +| --- | --- | --- | |
| 45 | +| `PlaybookName` | Name of the Logic App resource | `SAPLockUser-Basic` | |
| 46 | +| `DefaultAdminEmail` | Admin UPN for error notifications via Teams bot | `admin@contoso.com` | |
| 47 | +| `SAPOAuthTokenEndpoint` | OAuth2 token URL for SAP BTP | `https://<sub>.authentication.<region>.hana.ondemand.com/oauth/token` | |
| 48 | +| `SAPOAuthClientId` | OAuth2 client ID (securestring) | — | |
| 49 | +| `SAPOAuthClientSecret` | OAuth2 client secret (securestring) | — | |
| 50 | +| `SAPClientId` | SAP MANDT / client number | `100` | |
| 51 | +| `TeamsTeamId` | Teams Team ID | `626751d1-...` | |
| 52 | +| `TeamsChannelId` | Teams Channel ID | `19:abc123...@thread.tacv2` | |
| 53 | + |
| 54 | +> **Tip:** If you don't have the Teams IDs at deployment time, leave them empty and configure the `TeamsChannel` workflow parameter in the Logic App designer after deployment. |
| 55 | +
|
| 56 | +## Post-deployment steps |
| 57 | + |
| 58 | +1. **Authorize the Teams connection** — open the Logic App in the Azure portal → API connections → `teams-*` → Edit API connection → Authorize. |
| 59 | +2. **Assign Sentinel Responder role** — grant the Logic App's managed identity the *Microsoft Sentinel Responder* role on the Log Analytics workspace. |
| 60 | +3. **Verify Teams channel** — ensure the `TeamsChannel` parameter has valid `teamID` and `channelID` values. |
| 61 | +4. **Test** — create a test incident with SAP Custom Details (`SAP_User`, `SidGuid`, `AgentGuid`) and verify the adaptive card appears in Teams. |
| 62 | + |
| 63 | +## Key differences from the Standard (STD) version |
| 64 | + |
| 65 | +| Aspect | This playbook (Consumption) | STD version | |
| 66 | +| --- | --- | --- | |
| 67 | +| Logic App type | Consumption (pay-per-execution) | Standard (dedicated hosting) | |
| 68 | +| VNet injection | Not supported | Supported | |
| 69 | +| Alert handling | Dynamic — filters all alerts for SAP details | Static — uses `alerts[0]` | |
| 70 | +| Defender XDR | ✅ Complex multi-alert incidents | ⚠️ Assumes SAP alert is first | |
| 71 | +| SAP username | Dynamic from Custom Details | Hardcoded demo value | |
| 72 | +| Unlock flow | Not included (add separately) | Included with timeout auto-unlock | |
| 73 | +| Deployment | ARM template with Deploy to Azure button | ARM template for Standard + storage | |
| 74 | + |
| 75 | +## Extending the playbook |
| 76 | + |
| 77 | +- **Entra ID lock** — add the *Microsoft Entra ID* connector with a "Disable user" action in the `Case_AAD` branch. |
| 78 | +- **BTP/IAS lock** — add an HTTP action calling SAP Cloud Identity Services SCIM API to set `active: false` in the `Case_BTP` branch. |
| 79 | +- **Unlock flow** — add a follow-up adaptive card with a timeout-based auto-unlock (see the STD version for a blueprint). |
| 80 | +- **User notification** — add a Teams chat action to notify the impacted user directly using their UPN from incident entities. |
| 81 | + |
| 82 | +## Related resources |
| 83 | + |
| 84 | +- [SAP SOAR blog series](https://blogs.sap.com/2023/05/22/from-zero-to-hero-security-coverage-with-microsoft-sentinel-for-your-critical-sap-security-signals-blog-series/) |
| 85 | +- [SAP Integration Suite community package](https://api.sap.com/package/MicrosoftSentinelSolutionforSAP/integrationflow) |
| 86 | +- [Microsoft Sentinel SAP solution documentation](https://learn.microsoft.com/azure/sentinel/sap/solution-overview) |
| 87 | +- [Logic Apps Consumption overview](https://learn.microsoft.com/azure/logic-apps/logic-apps-overview) |
0 commit comments