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/manage-apps/manage-consent-requests.md
+83-1Lines changed: 83 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,7 +95,7 @@ See [Grant tenant-wide admin consent to an application](grant-admin-consent.md)
95
95
96
96
### Granting consent on behalf of a specific user
97
97
98
-
Instead of granting consent for the entire organization, an administrator can also use the [Microsoft Graph API](/graph/use-the-api) to grant consent to delegated permissions on behalf of a single user. For more information, see [Get access on behalf of a user](/graph/auth-v2-user).
98
+
Instead of granting consent for the entire organization, an administrator can also use the [Microsoft Graph API](/graph/use-the-api) to grant consent to delegated permissions on behalf of a single user. For a detailed example using Microsoft Graph PowerShell, see [Grant consent on behalf of a single user using PowerShell](#grant-consent-on-behalf-of-a-single-user-using-powershell).
99
99
100
100
## Limiting user access to applications
101
101
@@ -116,6 +116,88 @@ To disable all future user consent operations in your entire directory, follow t
116
116
:::image type="content" source="media/manage-consent-requests/disable-user-consent-operations.png" alt-text="disabling user consent operations for all apps.":::
117
117
5. Disable all future user consent operations by setting the **Users can consent to apps accessing company data on their behalf** toggle to **No** and click the **Save** button.
118
118
119
+
## Grant consent on behalf of a single user using PowerShell
120
+
121
+
When a user grants consent on behalf of themselves, the following happens:
122
+
123
+
1. A service principal for the client application is created, if does not already exist. A service principal is the instance of an application or a service, in your Azure AD tenant. Access granted to the app or service is associated with this service principal object.
124
+
1. For each API to which the application requires access, a delegated permission grant is created for the permissions needed by the application to that API, for access on behalf of the user. A delegated permission grant authorizes an application to access an API on behalf of a user, when that user has signed in.
125
+
1. The user is assigned the client application. Assigning the application to the user ensures the application is listed in the My Apps page for that user, allowing them to review and revoke the access granted an their behalf.
126
+
127
+
To manually perform the steps which are equivalent to granting consent to an application on behalf of one user, you will need the following details:
128
+
129
+
* The app ID for app for which you are granting consent (we'll call this the "client application").
130
+
* The API permissions required by the client application. You will need to know the app ID of the API and the permission IDs or claim values.
131
+
* The username or object ID for the user on behalf of who access will be granted.
132
+
133
+
In the following example, we will use [Microsoft Graph PowerShell](/graph/powershell/get-started) to perform the three steps listed above to grant consent on behalf of a single user. For this example, the client application will be [Microsoft Graph Explorer](https://aka.ms/ge), and we will be granting access to the Microsoft Graph API.
134
+
135
+
```powershell
136
+
# The app for which consent is being granted. In this example, we're granting access
137
+
# to Microsoft Graph Explorer, an application published by Microsoft.
138
+
$clientAppId = "de8bc8b5-d9f9-48b1-a8ad-b748da725064" # Microsoft Graph Explorer
139
+
140
+
# The API to which access will be granted. Microsoft Graph Explorer makes API
141
+
# requests to the Microsoft Graph API, so we'll use that here.
142
+
$resourceAppId = "00000003-0000-0000-c000-000000000000" # Microsoft Graph API
143
+
144
+
# The permissions to grant. Here we're including "openid", "profile", "User.Read"
145
+
# and "offline_access" (for basic sign-in), as well as "User.ReadBasic.All" (for
*[Five steps to securing your identity infrastructure](../../security/fundamentals/steps-secure-identity.md#before-you-begin-protect-privileged-accounts-with-mfa)
0 commit comments