# Non-human identities from Microsoft Entra ID

Besides people, your Entra ID tenant holds identities that software uses: service
principals, managed identities and agent identities. The
Microsoft Entra ID connector adds them to your non-human identity inventory in
Mesh, along with who owns them, where they run, whether they can still sign in,
and what they are allowed to do.

This page explains what you see and what each part needs. The connector itself
is set up as described in [Set up Microsoft Entra ID](./entra-portal-setup.mdx)
and [Add the connector in Mesh](./mesh-setup.mdx).

## What you see in Mesh

| In Mesh | What it shows | What it needs |
| --- | --- | --- |
| **Owners** | Every owner that is a user or a group. Owners that are other service principals are not shown | `Application.Read.All` (already part of the standard setup) |
| **Disabled state** | A service principal whose sign-in is disabled in Entra ID shows as disabled | The **Roles, permissions and usage** option and `Application.Read.All` |
| **App-only permissions** | Each permission a service principal holds on another API, by name | The **Roles, permissions and usage** option and `Application.Read.All` |
| **Workloads** | Each virtual machine, App Service app and Function app, linked to the managed identities it runs as | The **Roles, permissions and usage** option and the Azure **Reader** role on your subscriptions |
| **Agent sponsors** | The sponsors of each agent identity, shown as its business owners | The **Agent sponsors** option and `AgentIdentity.ReadWrite.All` |

To see these identities in Mesh, open the **Security Operations** view and
select **Service principals** in the **NHIs by type** widget.

![The Service principals list under Non-human identities, showing service principals from Microsoft Entra ID with their risk severity and when each was last updated](/img/connectors/entra-id/entra-service-principals.png)

### Owners

Mesh shows every owner that is a user or a group, not only the first. A service
principal shows its own owners and the owners of the app registration it was
created from. Owners that are other service principals are not shown.

An identity with no owners in Entra ID has no stated owner in Mesh, which makes
ownerless identities easy to find. Mesh may suggest one. See
[Suggested owners](../../../concepts/non-human-identity-data.md#suggested-owners).

> **note**
If Mesh cannot get an identity's complete owner list from Entra ID during a
collection, it keeps the owners it already has. Owners that were removed in
Entra ID disappear from Mesh after the next collection that gets the complete
list. If you remove every owner of an identity in Entra ID, Mesh keeps showing
the last owner it collected.

### Disabled state

When **Enabled for users to sign-in?** is set to **No** on a service principal,
it can no longer get tokens. Mesh shows it as disabled, and as active again
once it is re-enabled.

### App-only permissions

With **Roles, permissions and usage** on, Mesh lists the application permissions each
service principal and managed identity holds on other APIs — for example a
Microsoft Graph permission such as `User.Read.All` — by the name the API gives
it, not by its ID.

A service principal assigned to an API without a specific role appears with
**Default access**. Default access grants no privileges on its own; it only
records that the assignment exists.

Microsoft's own first-party applications are not listed. A permission granted
or removed in Entra ID can take up to a day to appear in Mesh.

### Workloads and the managed identities they run as

With **Roles, permissions and usage** on and the **Reader** role granted, Mesh lists
the virtual machines, App Service apps and Function apps in each subscription
it can see, and links each one to every managed identity it runs as, whether
system-assigned or user-assigned. Those managed identities appear in your
non-human identity inventory too.

Without the **Reader** role, Mesh sees no subscriptions and lists no
workloads. The rest of the collection is unaffected.

### Agent sponsors

The **Agent sponsors** option shows the sponsors of each agent identity as its
business owners, alongside its owners. It needs the **Agent identities**
option on.

> **warning**
Microsoft lists only `AgentIdentity.ReadWrite.All` for reading agent sponsors,
and that permission can also modify agent identities. Mesh only reads with it,
but the option is off by default so you can decide whether to grant it.

## Grant the extra permissions

`Application.Read.All` is already part of the
[standard setup](./entra-portal-setup.mdx#add-api-permissions). The other two
are needed only for the options that use them.

> **warning**
These steps are Axiad's current understanding of the Microsoft configuration.
Because Entra ID and Azure are third-party products, your screens may differ
slightly from what this guide describes. If you find a difference, contact
Axiad support so we can update this article.

### Azure Reader role, for workloads

Repeat these steps for each subscription whose workloads you want in Mesh.

To assign a role, you need permission to write role assignments at the
subscription, such as the **Role Based Access Control Administrator** or
**Owner** role. This applies to you as the administrator, not to the Mesh
application. If **Add role assignment** is unavailable, ask a subscription
administrator to do these steps.

1. Sign in to the Azure portal and open **Subscriptions**.
2. Select the subscription, then select **Access control (IAM)**.
3. Select **Add > Add role assignment**.
4. On the **Role** tab, select **Reader**, then select **Next**.
5. On the **Members** tab, choose **User, group, or service principal**, select
   **Select members**, and select the application you registered for Mesh.
6. Select **Review + assign**.

Reader is read-only: it lets Mesh list the subscription's resources and change
nothing.

### AgentIdentity.ReadWrite.All, for agent sponsors

Add this permission the same way as the others, in
[Add API permissions](./entra-portal-setup.mdx#add-api-permissions), and grant
admin consent again.

## Turn the options on in Mesh

1. On the **Connectors** page, open your Microsoft Entra ID connector for
   editing.
2. Turn on **Roles, permissions and usage** for app-only permissions and workloads.
3. To show agent sponsors, open **Advanced** and turn on **Agent identities**
   and **Agent sponsors**.
4. Save the connector.

![The Microsoft Entra ID connector's edit form, showing the Roles, permissions and usage checkbox and, under Advanced, the Agent identities and Agent sponsors checkboxes](/img/connectors/entra-id/entra-options.png)

The **Roles, permissions and usage** option also reads who holds directory roles
and Azure roles, and whether those permissions are used. For that, it needs
`RoleManagement.Read.Directory`, `AuditLog.Read.All`, the Azure **Reader** role and
an Entra ID P1 license. A read that is refused is reported as not collected,
and everything else is still collected.

## Troubleshooting

| Symptom | Likely cause | What to do |
| --- | --- | --- |
| No workloads, and no managed identities linked to virtual machines or apps | The application has no **Reader** role on any subscription, or **Roles, permissions and usage** is off | Grant **Reader** on each subscription and turn the option on |
| The collection reports **Partial** with an **Azure workloads** note | **Reader** is granted, but a custom role lacks permission to read virtual machines or sites, or a very large number of workloads, throttling or a timeout stopped the read | Grant read access to virtual machines and sites, then collect again |
| Some subscriptions' workloads are missing | **Reader** was granted on some subscriptions only | Grant **Reader** on the remaining subscriptions |
| No app-only permissions on service principals | **Roles, permissions and usage** is off | Turn the option on. Permissions can take up to a day to appear |
| No agent sponsors | **Agent sponsors** or **Agent identities** is off, or `AgentIdentity.ReadWrite.All` was not consented | Turn both options on, grant the permission and consent again |
| An owner removed in Entra ID still shows in Mesh | The last collection could not get that identity's complete owner list, or it was the identity's only owner | A removed owner disappears after the next collection that gets the complete list. If it was the only owner, Mesh keeps showing it |
