|
| 1 | +--- |
| 2 | +title: Security contexts in Azure SRE Agent (preview) |
| 3 | +description: Learn how SRE Agent uses different security contexts to handle agent creation and execution. |
| 4 | +author: craigshoemaker |
| 5 | +ms.author: cshoe |
| 6 | +ms.topic: tutorial |
| 7 | +ms.date: 07/16/2025 |
| 8 | +ms.service: azure |
| 9 | +--- |
| 10 | + |
| 11 | +# Security contexts in Azure SRE Agent (preview) |
| 12 | + |
| 13 | +This article explains the different security contexts involved in Azure SRE Agent operations. The security contexts include the user account that creates the agent, user accounts that interact with the agent, and the agent's own managed identity. Each context has specific permission requirements and serves different purposes in maintaining a secure environment. |
| 14 | + |
| 15 | +Microsoft Entra enforces security policies that govern identity assignments as you associate resource groups with the agent's managed identity. |
| 16 | + |
| 17 | +## Prerequisites |
| 18 | + |
| 19 | +You need to grant your agent the correct permissions and access to the right namespace. |
| 20 | + |
| 21 | +* **Security context**: Before you create a new agent, make sure your user account has the `Microsoft.Authorization/roleAssignments/write` permissions using either [Role Based Access Control Administrator](/azure/role-based-access-control/built-in-roles) or [User Access Administrator](/azure/role-based-access-control/built-in-roles). |
| 22 | + |
| 23 | +* **Sweden Central region access**: During preview, the only allowed region for SRE Agent is Sweden Central. Make sure your user account has *owner* or *admin* permissions and permissions to create resources in the Sweden Central region. |
| 24 | + |
| 25 | +## User security context |
| 26 | + |
| 27 | +The security requirements for users are different depending on if you're creating or using the agent. |
| 28 | + |
| 29 | +| Action | User account requirements | |
| 30 | +|---|---| |
| 31 | +| Create agent | The user account needs to be in the *Owner* or *User Access Administrator* role with *Owner* or *Admin* permissions in the subscription. | |
| 32 | +| Access/run the agent | The user account must have *Contributor* permissions to the resource group the agent is running in, or for the agent instance.<br><br>**Note**: This requirement doesn't mean the user account needs *Contributor* access to the entire subscription or all resource groups.| |
| 33 | + |
| 34 | +## Agent security context |
| 35 | + |
| 36 | +Azure SRE Agent has its own managed identity that gives the agent the required credentials to act on your behalf as it manages assigned resource groups. You have full control over the roles and permissions applied to the managed identity. |
| 37 | + |
| 38 | +When you create the agent from the portal, you can select from different permissions levels best suited for your situation. When you create an agent, you can apply the *Reader* or *Privileged* permission level. |
| 39 | + |
| 40 | +The following table describes the difference between the two levels. |
| 41 | + |
| 42 | +| Permission level | Description | |
| 43 | +|---|---| |
| 44 | +| Reader | Initially configured with read-only permissions on the resource groups it manages. When an action is required that requires elevated permissions, the agent prompts the user for temporary to complete the action. | |
| 45 | +| Privileged | Initially configured to take approved actions on resources and resource types detected in its assigned resource groups. | |
| 46 | + |
| 47 | +At any time, you can change which permissions are available to the agent's managed identity by modifying the access control (IAM) settings of a resource group manged by the agent. |
| 48 | + |
| 49 | +As resource groups are added or removed from the agent's scope, the managed identity's permissions are updated accordingly. Removing a resource group revokes the agent's access to the group entirely. |
| 50 | + |
| 51 | +> [!NOTE] |
| 52 | +> You can't directly remove specific permissions from the agent. To restrict the agent's access, you must remove the entire resource group from the agent's scope. |
| 53 | +
|
| 54 | +### Roles |
| 55 | + |
| 56 | +The agent's managed identity is often preconfigured with the following role assignments for a managed resource group: |
| 57 | + |
| 58 | +* Log Analytics Reader |
| 59 | +* Azure Reader |
| 60 | +* Monitoring Reader |
| 61 | + |
| 62 | +Plus any required roles related to specific Azure services in resource groups managed by the agent. |
| 63 | + |
| 64 | +## Agent behavior |
| 65 | + |
| 66 | +The agent behaves differently depending on the permissions assigned, the execution mode, and the type of action it attempts to make. The following tables list how the agent responds in different scenarios. |
| 67 | + |
| 68 | +### Read-only actions |
| 69 | + |
| 70 | +The following table details how the agent behaves when attempting to conduct a read-only operation that requires elevated permissions. |
| 71 | + |
| 72 | +| Agent has permission? | Execution mode | Agent behavior | |
| 73 | +|---|---|---| |
| 74 | +| Yes | Review | Reads required data and doesn't prompt for approval | |
| 75 | +| No | Review | Prompts for approval to take action | |
| 76 | +| Yes | Auto | Executes action without requiring approval | |
| 77 | +| No | Auto | Prompts for approval, and executes action based on approval status | |
| 78 | + |
| 79 | +### Write actions |
| 80 | + |
| 81 | +The following table details how the agent behaves when attempting to conduct a write operation. |
| 82 | + |
| 83 | +| Agent has permission? | Execution mode | Agent behavior | |
| 84 | +|---|---|---| |
| 85 | +| Yes | Review | Prompts for approval to take action | |
| 86 | +| No | Review | Prompts for approval to take action, if granted the agent temporarily inherits the required permissions from the user | |
| 87 | +| Yes | Auto | Executes action without requiring approval | |
| 88 | +| No | Auto | Prompts for approval, and executes action based on approval status | |
| 89 | + |
| 90 | +## Related content |
| 91 | + |
| 92 | +* [Troubleshoot common errors](./troubleshoot.md) |
0 commit comments