You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/active-directory/develop/howto-add-app-roles-in-azure-ad-apps.md
+6-68Lines changed: 6 additions & 68 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,15 +26,12 @@ Another approach is to use Azure AD Groups and Group Claims as shown in the [act
26
26
27
27
## Declare roles for an application
28
28
29
-
You define app roles by using the [Azure portal](https://portal.azure.com). App roles are usually defined on an application registration representing a service, app or API. When a user signs in to the application, Azure AD emits a `roles` claim for each role that the user or service principal has been granted individually to the user and from their group membership. This can be used to implement claim-based authorization. App roles can be assigned [to a user or a group of users](../manage-apps/add-application-portal-assign-users.md). App roles can also be assigned to the service principal for another application, or [to the service principal for a managed identity](../managed-identities-azure-resources/how-to-assign-app-role-managed-identity-powershell.md).
29
+
You define app roles by using the [Azure portal](https://portal.azure.com) during the [app registration process](quickstart-register-app.md). App roles are defined on an application registration representing a service, app or API. When a user signs in to the application, Azure AD emits a `roles` claim for each role that the user or service principal has been granted individually to the user and the user's group memberships. This can be used to implement claim-based authorization. App roles can be assigned [to a user or a group of users](../manage-apps/add-application-portal-assign-users.md). App roles can also be assigned to the service principal for another application, or [to the service principal for a managed identity](../managed-identities-azure-resources/how-to-assign-app-role-managed-identity-powershell.md).
30
30
31
31
> [!IMPORTANT]
32
32
> Currently if you add a service principal to a group, and then assign an app role to that group, Azure AD does not add the `roles` claim to tokens it issues.
33
33
34
-
There are two ways to declare app roles by using the Azure portal:
35
-
36
-
-[App roles UI](#app-roles-ui)
37
-
-[App manifest editor](#app-manifest-editor)
34
+
App roles are declared using the app roles by using[App roles UI](#app-roles-ui) in the Azure portal:
38
35
39
36
The number of roles you add counts toward application manifest limits enforced by Azure Active Directory. For information about these limits, see the [Manifest limits](./reference-app-manifest.md#manifest-limits) section of [Azure Active Directory app manifest reference](reference-app-manifest.md).
40
37
@@ -64,66 +61,6 @@ To create an app role by using the Azure portal's user interface:
64
61
65
62
1. Select **Apply** to save your changes.
66
63
67
-
### App manifest editor
68
-
69
-
To add roles by editing the manifest directly:
70
-
71
-
1. Sign in to the <ahref="https://portal.azure.com/"target="_blank">Azure portal</a>.
72
-
1. Select the **Directory + subscription** filter in top menu, and then choose the Azure Active Directory tenant that contains the app registration to which you want to add an app role.
73
-
1. Search for and select **Azure Active Directory**.
74
-
1. Under **Manage**, select **App registrations**, and then select the application you want to define app roles in.
75
-
1. Again under **Manage**, select **Manifest**.
76
-
1. Edit the app manifest by locating the `appRoles` setting and adding your application roles. You can define app roles that target `users`, `applications`, or both. The following JSON snippets show examples of both.
77
-
1. Save the manifest.
78
-
79
-
Each app role definition in the manifest must have a unique GUID for its `id` value.
80
-
81
-
The `value` property of each app role definition should exactly match the strings that are used in the code in the application. The `value` property can't contain spaces. If it does, you'll receive an error when you save the manifest.
82
-
83
-
#### Example: User app role
84
-
85
-
This example defines an app role named `Writer` that you can assign to a `User`:
86
-
87
-
```json
88
-
"appId": "8763f1c4-0000-0000-0000-158e9ef97d6a",
89
-
"appRoles": [
90
-
{
91
-
"allowedMemberTypes": [
92
-
"User"
93
-
],
94
-
"displayName": "Writer",
95
-
"id": "d1c2ade8-0000-0000-0000-6d06b947c66f",
96
-
"isEnabled": true,
97
-
"description": "Writers Have the ability to create tasks.",
98
-
"value": "Writer"
99
-
}
100
-
],
101
-
"availableToOtherTenants": false,
102
-
```
103
-
104
-
#### Example: Application app role
105
-
106
-
When available to `applications`, app roles appear as application permissions in an app registration's **Manage** section > **API permissions > Add a permission > My APIs > Choose an API > Application permissions**.
107
-
108
-
This example shows an app role targeted to an `Application`:
109
-
110
-
```json
111
-
"appId": "8763f1c4-0000-0000-0000-158e9ef97d6a",
112
-
"appRoles": [
113
-
{
114
-
"allowedMemberTypes": [
115
-
"Application"
116
-
],
117
-
"displayName": "ConsumerApps",
118
-
"id": "47fbb575-0000-0000-0000-0f7a6c30beac",
119
-
"isEnabled": true,
120
-
"description": "Consumer apps have access to the consumer data.",
121
-
"value": "Consumer"
122
-
}
123
-
],
124
-
"availableToOtherTenants": false,
125
-
```
126
-
127
64
## Assign users and groups to roles
128
65
129
66
Once you've added app roles in your application, you can assign users and groups to the roles. Assignment of users and groups to roles can be done through the portal's UI, or programmatically using [Microsoft Graph](/graph/api/user-post-approleassignments). When the users assigned to the various app roles sign in to the application, their tokens will have their assigned roles in the `roles` claim.
@@ -164,7 +101,7 @@ To assign app roles to an application by using the Azure portal:
164
101
165
102
The newly added roles should appear in your app registration's **API permissions** pane.
166
103
167
-
####Grant admin consent
104
+
### Grant admin consent
168
105
169
106
Because these are _application permissions_, not delegated permissions, an admin must grant consent to use the app roles assigned to the application.
170
107
@@ -176,7 +113,7 @@ The **Status** column should reflect that consent has been **Granted for \<tenan
176
113
<aname="use-app-roles-in-your-web-api"></a>
177
114
## Usage scenario of app roles
178
115
179
-
If you're implementing app role business logic that signs in the users in your application scenario, first define the app roles in **App registration**. Then, an admin assigns them to users and groups in the **Enterprise applications** pane. These assigned app roles are included with any token that's issued for your application, either access tokens when your app is the API being called by an app or ID tokens when your app is signing in a user.
116
+
If you're implementing app role business logic that signs in the users in your application scenario, first define the app roles in **App registration**. Then, an admin assigns them to users and groups in the **Enterprise applications** pane. These assigned app roles are included with any token that's issued for your application, either access tokens when your app is the API being called by an app or ID tokens when your app is signing in a user.
180
117
181
118
If you're implementing app role business logic in an app-calling-API scenario, you have two app registrations. One app registration is for the app, and a second app registration is for the API. In this case, define the app roles and assign them to the user or group in the app registration of the API. When the user authenticates with the app and requests an access token to call the API, a roles claim is included in the access token. Your next step is to add code to your web API to check for those roles when the API is called.
182
119
@@ -194,13 +131,14 @@ Though you can use app roles or groups for authorization, key differences betwee
194
131
195
132
Developers can use app roles to control whether a user can sign in to an app or an app can obtain an access token for a web API. To extend this security control to groups, developers and admins can also assign security groups to app roles.
196
133
197
-
App roles are preferred by developers when they want to describe and control the parameters of authorization in their app themselves. For example, an app using groups for authorization will break in the next tenant as both the group ID and name could be different. An app using app roles remains safe. In fact, assigning groups to app roles is popular with SaaS apps for the same reasons.
134
+
App roles are preferred by developers when they want to describe and control the parameters of authorization in their app themselves. For example, an app using groups for authorization will break in the next tenant as both the group ID and name could be different. An app using app roles remains safe. In fact, assigning groups to app roles is popular with SaaS apps for the very same reasons as it allows the SaaS app to be provisioned in multiple tenants.
198
135
199
136
## Next steps
200
137
201
138
Learn more about app roles with the following resources.
202
139
203
140
- Code samples on GitHub
141
+
-[Add authorization using app roles & roles claims to an ASP\.NET Core web app](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/master/5-WebApp-AuthZ/5-1-Roles/README.md)
204
142
-[Add authorization using groups and group claims to an ASP.NET Core web app](https://aka.ms/groupssample)
205
143
-[Angular single-page application (SPA) calling a .NET Core web API and using app roles and security groups](https://github.com/Azure-Samples/ms-identity-javascript-angular-tutorial/tree/main/5-AccessControl)
206
144
-[React single-page application (SPA) calling a Node.js web API and using app roles and security groups](https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/5-AccessControl)
title: "Tutorial: Govern and monitor applications"
3
+
titleSuffix: Azure AD
4
+
description: In this tutorial, you learn how to govern and monitor an application in Azure Active Directory.
5
+
author: omondiatieno
6
+
manager: CelesteDG
7
+
ms.author: jomondi
8
+
ms.service: active-directory
9
+
ms.subservice: app-mgmt
10
+
ms.topic: tutorial
11
+
ms.date: 02/24/2022
12
+
# Customer intent: As an administrator of an Azure AD tenant, I want to govern and monitor my applications.
13
+
---
14
+
15
+
# Tutorial: Govern and monitor applications
16
+
17
+
The IT administrator at Fabrikam has added and configured an application from the [Azure Active Directory (Azure AD) application gallery](overview-application-gallery.md). They also made sure that access can be managed and that the application is secure by using the information in [Tutorial: Manage application access and security](tutorial-manage-access-security.md). They now need to understand the resources that are available to govern and monitor the application.
18
+
19
+
Using the information in this tutorial, an administrator of the application learns how to:
20
+
21
+
> [!div class="checklist"]
22
+
> * Create an access review
23
+
> * Access the audit logs report
24
+
> * Access the sign-ins report
25
+
> * Send logs to Azure Monitor
26
+
27
+
## Prerequisites
28
+
29
+
- An Azure account with an active subscription. If you don't already have one, [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
30
+
- One of the following roles: Global Administrator, Privileged Role Administrator, Cloud Application Administrator, or Application Administrator.
31
+
- An enterprise application that has been configured in your Azure AD tenant.
32
+
33
+
## Create an access review
34
+
35
+
The administrator wants to make sure that users or guests have appropriate access. They decide to ask users of the application to participate in an access review and recertify or attest to their need for access. When the access review is finished, they can then make changes and remove access from users who no longer need it. For more information, see
36
+
[Manage user and guest user access with access reviews](../governance/manage-access-review.md).
37
+
38
+
To create an access review:
39
+
40
+
1. Sign in to the [Azure portal](https://portal.azure.com/) with one of the roles listed in the prerequisites.
41
+
1. Go to **Azure Active Directory**, and then select **Identity Governance**.
42
+
1. On the left menu, select **Access reviews**.
43
+
1. Select **New access review** to create a new access review.
44
+
1. In **Select what to review**, select **Applications**.
45
+
1. Select **+ Select application(s)**, select the application, and then choose **Select**.
46
+
1. Now you can select a scope for the review. Your options are:
47
+
-**Guest users only** - This option limits the access review to only the Azure AD B2B guest users in your directory.
48
+
-**All users** - This option scopes the access review to all user objects associated with the resource.
49
+
Select **All users**.
50
+
1. Select **Next: Reviews**.
51
+
1. In the **Specify reviewers** section, in the Select reviewers box, select **Selected user(s) or group(s)**, select **+ Select reviewers**, and then select the user account that is assigned to the application.
52
+
1. In the **Specify recurrence of review** section, specify the following selections:
53
+
-**Duration (in days)** - Accept the default value of **3**.
54
+
-**Review recurrence** - select **One time**.
55
+
-**Start date** - Accept today's date as the start date.
56
+
1. Select **Next: Settings**.
57
+
1. In the **Upon completion settings** section, you can specify what happens after the review finishes. Select **Auto apply results to resource**.
58
+
1. Select **Next: Review + Create**.
59
+
1. Name the access review. Optionally, give the review a description. The name and description are shown to the reviewers.
60
+
1. Review the information and select **Create**.
61
+
62
+
### Start the access review
63
+
64
+
After you've specified the settings for an access review, select **Start**. The access review appears in your list with an indicator of its status.
65
+
66
+
By default, Azure AD sends an email to reviewers shortly after the review starts. If you choose not to have Azure AD send the email, be sure to inform the reviewers that an access review is waiting for them to complete. You can show them the instructions for how to review access to groups or applications. If your review is for guests to review their own access, show them the instructions for how to review access for themselves to groups or applications.
67
+
68
+
If you've assigned guests as reviewers and they haven't accepted their invitation to the tenant, they won't receive an email from access reviews. They must first accept the invitation before they can begin reviewing.
69
+
70
+
## Access the audit logs report
71
+
72
+
The audit logs report combines several reports around application activities into a single view for context-based reporting. For more information, see [Audit logs in Azure Active Directory](../reports-monitoring/concept-audit-logs.md).
73
+
74
+
To access the audit logs report, select **Audit logs** from the **Activity** section of the Azure Active Directory page.
75
+
76
+
The audit logs report consolidates the following reports:
77
+
78
+
- Password reset activity
79
+
- Password reset registration activity
80
+
- Self-service groups activity
81
+
- Office365 Group Name Changes
82
+
- Account provisioning activity
83
+
- Password rollover status
84
+
- Account provisioning errors
85
+
86
+
## Access the sign-ins report
87
+
88
+
The Sign-ins view includes all user sign-ins, and the Application Usage report. You also can view application usage information in the Manage section of the Enterprise applications overview. For more information, see [Sign-in logs in Azure Active Directory](../reports-monitoring/concept-sign-ins.md)
89
+
90
+
To access the sign-in logs report, select **Sign-ins** from the **Monitoring** section of the Azure Active Directory blade.
91
+
92
+
## Send logs to Azure Monitor
93
+
94
+
The Azure AD activity logs only store information for a maximum of 30 days. Depending on your needs, you may require extra storage to back up the activity logs data. Using the Azure Monitor, you can archive the audit and sign logs to an Azure storage account to retain the data for a longer time.
95
+
The Azure Monitor is also useful for rich visualization, monitoring and alerting of data. To learn more about the Azure Monitor and the cost considerations for extra storage, see [Azure AD activity logs in Azure Monitor](../reports-monitoring/concept-activity-logs-azure-monitor.md).
96
+
97
+
To send logs to your logs analytics workspace:
98
+
99
+
1. Select **Diagnostic settings**, and then select **Add diagnostic setting**. You can also select Export Settings from the Audit Logs or Sign-ins page to get to the diagnostic settings configuration page.
100
+
1. In the Diagnostic settings menu, select **Send to Log Analytics workspace**, and then select Configure.
101
+
1. Select the Log Analytics workspace you want to send the logs to, or create a new workspace in the provided dialog box.
102
+
1. Select the logs that you would like to send to the workspace.
103
+
1. Select **Save** to save the setting.
104
+
105
+
After about 15 minutes, verify that events are streamed to your Log Analytics workspace.
106
+
107
+
## Next steps
108
+
109
+
Advance to the next article to learn how to...
110
+
> [!div class="nextstepaction"]
111
+
> [Manage consent to applications and evaluate consent requests](manage-consent-requests.md)
0 commit comments