Connect Microsoft Azure and Entra ID (read-only)
TrustEvidence reads Azure and Entra ID through an app registration (service principal) that you create in your own tenant, with read-only Azure roles and three read-only Microsoft Graph permissions.
Before you start
Use Azure Cloud Shell (Bash) or the Azure CLI, signed in as someone who can create app registrations, assign roles on the subscriptions and grant admin consent (for example a Global Administrator or a Privileged Role Administrator).
1. App registration and secret
APP_ID=$(az ad app create --display-name "TrustEvidence (read-only)" --sign-in-audience AzureADMyOrg --query appId -o tsv) az ad sp create --id $APP_ID echo "Tenant ID: $(az account show --query tenantId -o tsv)" echo "Client ID: $APP_ID" echo "Client secret: $(az ad app credential reset --id $APP_ID --display-name trustevidence --years 1 --query password -o tsv)"
Keep the three values for step 4. The secret expires after one year: put the date in your calendar (see Rotate or remove access).
2. Azure roles on the subscriptions
This gives the app Reader and Security Reader on every enabled subscription you can see. To limit it, replace the list after in with the subscription IDs you want assessed.
for SUB in $(az account list --query "[?state=='Enabled'].id" -o tsv); do az role assignment create --assignee $APP_ID --role "Reader" --scope /subscriptions/$SUB az role assignment create --assignee $APP_ID --role "Security Reader" --scope /subscriptions/$SUB done
3. Microsoft Graph permissions
| Permission (application) | Used for |
|---|---|
Policy.Read.All | Security defaults, Conditional Access, and the authorisation policy (guest invitations) |
Directory.Read.All | Who holds the Global Administrator role |
AuditLog.Read.All | The authentication-methods registration report (which users have registered MFA) |
GRAPH=00000003-0000-0000-c000-000000000000 az ad app permission add --id $APP_ID --api $GRAPH --api-permissions \ 246dd0d5-5bd0-4def-940b-0421030a5b68=Role \ 7ab1d382-f21e-4acd-a863-ba3e13f7da61=Role \ b0afded3-3588-46d8-8b3d-9842eff778da=Role az ad app permission admin-consent --id $APP_ID
The three IDs are Microsoft's identifiers for Policy.Read.All, Directory.Read.All and AuditLog.Read.All. In the Entra admin center, under App registrations, TrustEvidence (read-only), API permissions, check that exactly these three appear and all show Granted.
Conditional Access checks and the MFA registration report need an Entra ID P1 or P2 licence. Without one, those checks report insufficient evidence, never a pass. If you use security defaults instead of Conditional Access, the MFA and legacy-authentication checks can pass on security defaults alone.
4. Connect in TrustEvidence
On the Integrations page, under Connect Microsoft Azure & Entra ID, enter the tenant ID, the client ID and the secret. Optionally list subscription IDs; leave it empty to assess every enabled subscription the app can read. The connection is tested immediately.
All permissions used
Azure RBAC: ReaderAzure RBAC: Security ReaderGraph: AuditLog.Read.AllGraph: Directory.Read.AllGraph: Policy.Read.All
What is read and what is never touched
What TrustEvidence reads
- Entra ID: security defaults, Conditional Access policies, the guest invitation policy
- Entra ID: members of the Global Administrator role, and each user's MFA registration status
- Storage accounts: secure transfer, minimum TLS version and anonymous blob access settings
- Network security groups: inbound rules
- Microsoft Defender for Cloud: which plans are on, and the security contact settings
What it never touches
- Data in storage accounts, databases, disks or key vaults
- Email, files, Teams messages or any Microsoft 365 content
- Passwords, keys or secret values
- Any write: the roles and permissions are read-only, and nothing is changed
Checks
| Check | What it reads | Passes when |
|---|---|---|
| All member users have MFA registered | Reads the authentication-methods registration report and lists member users with no MFA method registered. The report requires an Entra ID P1 or P2 licence. | Every member user has an MFA method registered. |
| Global Administrator count is limited | Counts enabled users with an active Global Administrator assignment. More than four fails; fewer than two needs review (no break-glass redundancy). | Two to four Global Administrators. |
| Guest invitations are restricted | Reads the authorization policy's allowInvitesFrom setting. | Not 'everyone'. |
| Legacy authentication is blocked | Passes when security defaults are enabled or an enabled Conditional Access policy for all users blocks the 'Exchange ActiveSync' and 'Other clients' client app types. | Legacy authentication blocked for all users. |
| MFA is enforced for all Entra ID users | Passes when security defaults are enabled, or an enabled Conditional Access policy covering all users and all apps requires MFA or an authentication strength. Report-only policies do not count. | Security defaults on, or an enforcing all-users MFA policy. |
| Microsoft Defender for Cloud plans are enabled | Reads Defender for Cloud pricing per subscription; fails when any of VirtualMachines, StorageAccounts, KeyVaults, Arm is on the Free tier. | Core plans on the Standard tier. |
| No admin/database ports open to the internet (NSGs) | Evaluates every custom inbound Allow rule in every network security group for Internet/Any/0.0.0.0/0 sources on SSH, RDP and database ports (including '*' and port ranges). | No such rule. |
| Security alerts reach a named contact | Reads Defender for Cloud security contacts per subscription and requires an email with alert notifications on. | A security contact email with alert notifications enabled. |
| Storage accounts disallow anonymous blob access | Evaluates allowBlobPublicAccess on every storage account. Anything other than an explicit false fails. | allowBlobPublicAccess = false. |
| Storage accounts require HTTPS and TLS 1.2+ | Evaluates supportsHttpsTrafficOnly and minimumTlsVersion on every storage account in the assessed subscriptions. | HTTPS only and minimum TLS 1.2. |
10 checks. A check that cannot read what it needs reports insufficient evidence, never a pass.
Rotate or remove access
- Find the app again in a new Cloud Shell session:
APP_ID=$(az ad app list --display-name "TrustEvidence (read-only)" --query "[0].appId" -o tsv) - Rotate the secret:
az ad app credential reset --id $APP_ID --display-name trustevidence --years 1 --append --query password -o tsv, reconnect the integration with the new secret, run a scan, then delete the old secret in the app registration. - Remove access: disconnect the integration in TrustEvidence (stored credentials are deleted at once), then delete the app registration with
az ad app delete --id $APP_ID.
Verification status
The Azure and Graph clients follow Microsoft's documented APIs and are tested against simulated responses. They have not yet been run against a live tenant, so connect a non-production tenant first and compare the results with the Azure portal.