Administering Keen
Microsoft Entra ID and Azure
Chapter 15 of 40
Microsoft Entra ID and Azure
Microsoft posture reads one Entra tenant through Microsoft Graph and its Azure subscriptions through Azure Resource Manager, with read-only access, and records the tenant's sign-ins and directory audits and each subscription's activity log. Results appear on the Microsoft vendor's Cloud posture tab, one section for the tenant and one per subscription (see Cloud vendor posture).
Keen signs in as an app registration with the client credentials flow, through its validated HTTP client, and follows paging links only on the host that issued them. The tenant is the app registration's own, and Azure must confirm that each subscription belongs to it before Keen reads the subscription.
Checks
| Scope | Check | Action | Met when |
|---|---|---|---|
| Tenant | MFA for users | posture.identity.mfa | Every member has registered a strong method the authentication methods policy allows (Microsoft's MFA capable). |
| Tenant | MFA for administrators | posture.identity.admin_mfa | Every member holding an Entra administrator role is MFA capable. |
| Tenant | MFA enforcement | posture.identity.mfa_enforced | Security defaults are on, or an enabled Conditional Access policy requires MFA of all users for all cloud apps, with no alternative control and no location, platform, client app, device or risk condition. Users every such policy excludes by name are listed. |
| Tenant | Administrators | posture.identity.admins | Reported for information: the users, groups and apps holding a privileged Entra role across the whole tenant. |
| Tenant | Guest accounts | posture.identity.guests | Reported for information: how many guests the tenant holds, and how many are yet to accept. |
| Tenant | Unused accounts | posture.identity.inactive | No enabled account has gone without a successful sign-in for KEEN_CLOUD_INACTIVE_DAYS. |
| Tenant | App registration secrets and certificates | posture.credentials.key_age | No app registration holds a live client secret or certificate older than KEEN_CLOUD_KEY_AGE_DAYS. The detail also counts those expiring within 30 days. |
| Subscription | Owners | posture.identity.admins | Reported for information: the principals holding Owner or User Access Administrator on the subscription, directly or from above it. |
| Subscription | Activity log export | posture.logging.audit_trail | A diagnostic setting sends the subscription's Administrative activity log to a Log Analytics workspace, storage account, event hub or partner solution. |
| Subscription | Public blob access | posture.storage.public_access | No storage account allows anonymous public access to blobs. |
| Subscription | SSH and RDP open to the internet | posture.network.admin_ports | No network security group attached to a network interface or subnet lets TCP port 22 or 3389 in from the internet (*, Internet, Any, 0.0.0.0/0 or ::/0). |
| Subscription | Databases open to the internet | posture.network.databases | No Azure SQL server or PostgreSQL or MySQL flexible server with public network access has a firewall rule from 0.0.0.0 to 255.255.255.255. |
| Subscription | Defender for Cloud recommendations | posture.findings | No unhealthy recommendation of high severity; the detail also gives the secure score and the medium and low counts. |
Network security group rules apply in priority order, the first rule matching the port and source decides, and Azure's default rules deny the internet. Privileged Entra roles are those Microsoft labels privileged, apart from the reader roles; assignments scoped to an administrative unit and eligible Privileged Identity Management assignments are left out. Group and role exclusions in a Conditional Access policy are counted in the detail, since their members are not expanded. MFA for users and Unused accounts need Microsoft Entra ID P1 or P2; without it they read Not established and the other checks carry on.
The vendor page lists the tenant's users with their administrator roles, MFA and last sign-in, and guests.
Activity
Keen records the tenant's sign-ins as SignIn, with whether MFA was required, its directory audits under their own activity names, such as Add member to role, and each subscription's completed Administrative, Security and Policy activity under its Resource Manager operation, such as Microsoft.Authorization/roleAssignments/write. Entra keeps audits and sign-ins for 7 days on the free tier and 30 days with P1 or P2, and sign-in logs need P1 or P2; Azure keeps the activity log for 90 days. Each read stops 30 minutes before the present.
1. Register the app and grant its access
- In the Microsoft Entra admin centre, open Applications → App registrations → New registration. Name it, for example Keen posture, keep Accounts in this organisational directory only, and register it. Note the Application (client) ID and Directory (tenant) ID.
- Under Certificates & secrets → Client secrets, choose New client secret, set an expiry and copy the secret's Value at once: the admin centre shows it only once.
- Under API permissions, choose Add a permission → Microsoft Graph → Application permissions, add the permissions below, then Grant admin consent, which needs a Privileged Role Administrator or Global Administrator.
- For each subscription, or once on a management group above them, open Access control (IAM) → Add → Add role assignment, choose Reader, then User, group, or service principal, and select the app registration. Repeat with Security Reader.
| Permission or role | Needed by |
|---|---|
AuditLog.Read.All | MFA for users and administrators, Unused accounts, sign-ins and directory audits |
Policy.Read.All | MFA enforcement |
User.Read.All | MFA enforcement, Administrators, Guest accounts, Unused accounts and naming subscription owners |
RoleManagement.Read.Directory | Administrators |
Application.Read.All | App registration secrets and certificates |
Reader role | Every subscription check and the activity log, on each subscription |
Security Reader role | Defender for Cloud recommendations, on each subscription |
2. Configure Keen
| Setting | Purpose |
|---|---|
KEEN_AZURE_ENABLED | Turns Microsoft posture on. |
AZURE_POSTURE_TENANT_ID, AZURE_POSTURE_CLIENT_ID, AZURE_POSTURE_CLIENT_SECRET | The tenant ID, client ID and secret value from step 1. The _POSTURE_ names keep Azure SDKs, which read AZURE_CLIENT_SECRET, from using them. |
KEEN_AZURE_SUBSCRIPTIONS | The subscription IDs to read, separated by commas; up to 100. Leave it blank to read every subscription of the tenant the app registration can see. |
3. Verify
Recreate the API, worker and beat containers and choose Admin → Ingest runners → Run Microsoft Entra ID and Azure, then open the Microsoft vendor's Cloud posture tab. A check that reads Not established names its reason: not allowed means a Graph permission is missing or lacks admin consent, or the app registration lacks Reader or Security Reader on the subscription; the plan does not include it means the tenant has no Microsoft Entra ID P1 or P2; not set up, or the credentials were not accepted covers a missing setting, an expired secret, and a listed subscription that belongs to another tenant or cannot be found.
4. Rotate or revoke
Add a new client secret before the old one expires, update AZURE_POSTURE_CLIENT_SECRET, recreate the containers and delete the old secret. To disconnect, turn Microsoft posture off and delete the app registration's secrets and role assignments, or the app registration.