class AppConsentRequest
Represents a user's request to a tenant admin for consent to access an app or grant permissions to an app, used in Microsoft Graph API identity governance workflows.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/identitygovernance/appconsent/request.py
8 - 26
moderate
Purpose
This class models an app consent request entity in Microsoft's identity governance system. It encapsulates the details of a user's request for admin authorization to access an app or grant specific permissions. The class is used when the admin consent workflow is enabled and an app or permission requires administrative approval. It provides access to associated user consent requests through a collection property.
Source Code
class AppConsentRequest(Entity):
"""
Represents the request that a user creates when they request the tenant admin for consent to access an app or
to grant permissions to an app. The details include the app that the user wants access to be granted to on their
behalf and the permissions that the user is requesting.
The user can create a consent request when an app or a permission requires admin authorization and only when
the admin consent workflow is enabled.
"""
@property
def user_consent_requests(self):
"""A list of pending user consent requests."""
return self.properties.get(
"userConsentRequests",
UserConsentRequestCollection(
self.context, ResourcePath("userConsentRequests", self.resource_path)
),
)
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
context: The execution context inherited from Entity base class, typically containing authentication and API connection information for Microsoft Graph API calls
resource_path: The resource path inherited from Entity base class that identifies the location of this consent request in the Microsoft Graph API hierarchy
Return Value
Instantiation returns an AppConsentRequest object that inherits from Entity. The user_consent_requests property returns a UserConsentRequestCollection object containing pending user consent requests associated with this app consent request.
Class Interface
Methods
@property user_consent_requests(self) -> UserConsentRequestCollection
property
Purpose: Provides access to the collection of pending user consent requests associated with this app consent request
Returns: A UserConsentRequestCollection object containing all pending user consent requests. If not previously accessed, creates a new collection with the appropriate context and resource path.
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
properties |
dict | Inherited from Entity base class. Dictionary that stores cached property values, including the user_consent_requests collection after first access | instance |
context |
ClientContext | Inherited from Entity base class. The execution context containing authentication and API connection information for Microsoft Graph API operations | instance |
resource_path |
ResourcePath | Inherited from Entity base class. The path identifying this resource's location in the Microsoft Graph API hierarchy | instance |
Dependencies
office365office365.directory.identitygovernance.userconsent.request_collectionoffice365.entityoffice365.runtime.paths.resource_path
Required Imports
from office365.directory.identitygovernance.userconsent.request_collection import UserConsentRequestCollection
from office365.entity import Entity
from office365.runtime.paths.resource_path import ResourcePath
Usage Example
# Assuming you have a configured context object with Microsoft Graph API authentication
from office365.directory.identitygovernance.appconsent.request import AppConsentRequest
from office365.runtime.paths.resource_path import ResourcePath
# Instantiate an AppConsentRequest (typically done through Graph API client)
app_consent_request = AppConsentRequest(context, resource_path)
# Access the collection of user consent requests
user_requests = app_consent_request.user_consent_requests
# Iterate through pending user consent requests
for user_request in user_requests:
print(f"User request ID: {user_request.id}")
print(f"Status: {user_request.status}")
Best Practices
- This class should typically be instantiated through the Microsoft Graph API client rather than directly, as it requires proper context and resource path initialization
- The user_consent_requests property uses lazy loading - it creates the collection only when first accessed and caches it in the properties dictionary
- Ensure the admin consent workflow is enabled in your Microsoft 365 tenant before working with AppConsentRequest objects
- The class inherits from Entity, so it has access to standard entity operations like get(), update(), and delete() through the base class
- Always verify that the authenticated user has appropriate permissions to access and manage app consent requests
- The properties dictionary is used for caching, so subsequent accesses to user_consent_requests will return the same collection instance
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class UserConsentRequest 90.7% similar
-
class AppConsentRequestCollection 81.8% similar
-
class AppConsentApprovalRoute 77.0% similar
-
class UserConsentRequestCollection 76.2% similar
-
class AppRole 60.7% similar