SA1.5 Authentication and Permissions
Figure SA1.5 — Three authentication patterns and the permission matrix. Every playbook in this course follows these patterns with least-privilege grants.
Pattern 1: Managed identity for Microsoft APIs
Managed identity solves the credential management problem. Instead of creating a service account with a password that expires, embedding a client secret that leaks, or hardcoding an API key that appears in version control — you enable a system-assigned identity on the Logic App and Azure handles credential issuance, rotation, and revocation automatically.
When your playbook calls Microsoft Graph to query a user’s risk level, the HTTP action authenticates using the managed identity. Azure intercepts the request, obtains an OAuth token for the identity, attaches it to the API call, and the Graph API validates the token. The entire flow happens without credentials appearing anywhere — not in the Logic App definition, not in the run history, not in the logs.
Enabling managed identity. Navigate to your Logic App → Settings → Identity → System assigned → Status: On → Save. Azure creates the identity and shows the Object ID. You need this ID for permission grants.
Granting Azure RBAC roles. For Sentinel and Log Analytics operations, the managed identity needs RBAC roles at the workspace level. Navigate to Sentinel workspace → Access control (IAM) → Add role assignment → select role → select the Logic App’s managed identity as member.
Enrichment playbooks need two roles: Microsoft Sentinel Responder (read incidents, add comments, change properties) and Log Analytics Reader (run KQL queries). These roles provide the minimum access for Tier 1 operations.
Granting Microsoft Graph permissions. This is where most builders get stuck. The Azure portal does not support granting application permissions to managed identities — only to app registrations. You must use PowerShell.
The process using Microsoft Graph PowerShell SDK:
| |
After running these commands, the managed identity can call Graph endpoints that require these permissions. The permissions take effect within minutes — no Logic App restart required.
Using managed identity in the Logic App. In the HTTP action, set Authentication type to “Managed Identity,” set Managed Identity to “System-assigned,” and set Audience to https://graph.microsoft.com. For Log Analytics queries, the “Run query and list results” action handles authentication through the connector configuration — select “Connect with managed identity” during setup.
Pattern 2: Key Vault for API keys
Third-party APIs like VirusTotal, AbuseIPDB, and Shodan use API keys. These keys must never appear in your Logic App definition. Anyone with read access to the Logic App (Contributor role on the resource group) can view the full JSON definition, including any hardcoded values.
Setting up Key Vault. Create an Azure Key Vault (portal.azure.com → Create resource → Key Vault). Use the same resource group as your Logic Apps. Enable RBAC authorization model (not the legacy access policy model).
Storing secrets. Navigate to Key Vault → Objects → Secrets → Generate/Import. Create one secret per API key: “VirusTotal-API-Key” → paste the key → Create. Repeat for AbuseIPDB, Shodan, and any other external API.
Granting access. The Logic App’s managed identity needs the “Key Vault Secrets User” role on the Key Vault. Navigate to Key Vault → Access control (IAM) → Add role assignment → Key Vault Secrets User → select the Logic App’s managed identity.
Reading secrets in the Logic App. Add an action: “Azure Key Vault — Get secret.” Select the Key Vault name and the secret name (“VirusTotal-API-Key”). The action returns the secret value at runtime. Reference the output in subsequent HTTP actions:
In the HTTP action headers, add: x-apikey → dynamic content → “Get secret” → value.
The API key is read from Key Vault each time the playbook runs. If you rotate the key (generate a new one in VirusTotal, update the Key Vault secret), the Logic App uses the new key on the next run with no playbook modification.
Pattern 3: Connector-managed authentication
Some Logic App connectors handle authentication through their own connection mechanism. The Teams connector, Outlook connector, and SharePoint connector use delegated (user-context) authentication — when you create the connection, you sign in with your account, and the connector uses your identity for subsequent actions.
This is acceptable for notification actions (posting to Teams, sending email) but has an operational risk: the connection is tied to a specific user account. If that user’s password changes, MFA re-enrollment is required, or the account is disabled, the connection breaks and the playbook fails.
The mitigation: create connections using a dedicated service account (e.g., soc-automation@northgateeng.com) that is excluded from password expiration policies, has a dedicated MFA method, and is not used for interactive sign-in. Document the service account in the playbook runbook and include connection refresh in the quarterly maintenance checklist.
For Microsoft Graph operations, always prefer managed identity over connector-managed auth. Managed identity uses application permissions (no user context required) and does not depend on any individual user account.
Least privilege — the design principle
Every permission beyond the minimum required is attack surface. An enrichment playbook with Directory.ReadWrite.All (granted “just in case”) gives a compromised managed identity the ability to create admin accounts, modify group memberships, and change conditional access policies. An enrichment playbook with User.Read.All limits the compromise to reading user properties — visibility without modification capability.
The permission matrix by playbook type is not a guideline — it is the specification. When you build each playbook in this course, the sub specifies the exact permissions required. Do not add permissions that are not listed. If a future playbook enhancement requires a new permission, grant it explicitly at that time — do not pre-grant permissions for features you have not built yet.
Quarterly permission audit. Every 90 days, review all managed identity permissions. For each Logic App, list its granted permissions and compare against the actions the playbook currently uses. If a permission was granted during development but the corresponding action was removed in a later revision, remove the permission. The command to list all permissions:
| |
The myth: Managed identities rely on Azure for credential management. If Azure has a security incident, managed identity credentials could be compromised. Service accounts with passwords we control are more secure.
The reality: Service account passwords are stored in Entra ID (also Azure infrastructure), can be extracted via credential theft (Mimikatz, DCSync), are often set to never expire, and are frequently shared across multiple scripts. Managed identity credentials are never exposed to any user, cannot be extracted from the directory, rotate automatically, and are bound to a single Azure resource. Every security metric favors managed identity: no credential exposure, no theft surface, no expiration management, no shared secrets. The Azure infrastructure risk applies equally to both — service account passwords are stored in the same Azure AD infrastructure that issues managed identity tokens.
Decision point: Your containment playbook needs to revoke user sessions (Graph: User.RevokeSessions.All) and isolate endpoints (MDE: Machine.Isolate). Should you use one Logic App with both permission sets or two separate Logic Apps? One Logic App is simpler to build, test, and maintain. Two Logic Apps provide permission isolation — if one managed identity is compromised, the attacker only gets half the containment capability. For most organisations, one Logic App is correct: the operational complexity of coordinating two Logic Apps outweighs the marginal security benefit. Exception: if your compliance framework mandates separation of identity management and endpoint management roles, split the Logic Apps.
Try it: Configure managed identity permissions
For your enrichment playbook from SA1.4:
- Confirm managed identity is enabled (Logic App → Identity → System assigned → On)
- Grant Sentinel Responder + Log Analytics Reader on the workspace (IAM → Add role assignment)
- Use the PowerShell commands above to grant
User.Read.AllandIdentityRiskyUser.Read.All - Test: add an HTTP action calling
https://graph.microsoft.com/v1.0/identityProtection/riskyUserswith managed identity auth - Verify the call succeeds (200 response)
- List all permissions with
Get-MgServicePrincipalAppRoleAssignment— confirm only the two Graph permissions are present
If you plan to add VirusTotal enrichment: 7. Create a Key Vault and store your VirusTotal API key 8. Grant “Key Vault Secrets User” to the Logic App’s managed identity 9. Add a “Get secret” action and use the output in an HTTP call to VirusTotal
Where this goes deeper. SA5 configures identity containment permissions (User.RevokeSessions.All, UserAuthenticationMethod.ReadWrite.All) for the containment playbook. SA6 configures MDE RBAC permissions for endpoint isolation. SA10 covers Azure Functions authentication — managed identity for Azure APIs, Key Vault for external APIs, and the Function-to-Sentinel integration pattern.
You're reading the free modules of this course
The full course continues with advanced topics, production detection rules, worked investigation scenarios, and deployable artifacts. Premium subscribers get access to all courses.