class AuthenticationStrengthPolicy
Represents an Azure AD authentication strength policy that defines specific combinations of authentication methods and metadata for Conditional Access scenarios.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/policies/authentication_strength.py
9 - 28
moderate
Purpose
This class models an Azure AD authentication strength policy used in Conditional Access scenarios. It defines which authentication methods must be used to authenticate in specific scenarios and can be either built-in or custom (tenant-defined). The policy may or may not fulfill requirements to grant an MFA claim. The class extends Entity and provides functionality to query which Conditional Access policies reference this authentication strength policy.
Source Code
class AuthenticationStrengthPolicy(Entity):
"""
A collection of settings that define specific combinations of authentication methods and metadata.
The authentication strength policy, when applied to a given scenario using Azure AD Conditional Access,
defines which authentication methods must be used to authenticate in that scenario. An authentication strength
may be built-in or custom (defined by the tenant) and may or may not fulfill the requirements to grant an MFA claim.
"""
def usage(self):
"""
Allows the caller to see which Conditional Access policies reference a specified authentication strength policy.
The policies are returned in two collections, one containing Conditional Access policies that require an
MFA claim and the other containing Conditional Access policies that do not require such a claim.
Policies in the former category are restricted in what kinds of changes may be made to them to prevent
undermining the MFA requirement of those policies.
"""
return_type = ClientResult(self.context, AuthenticationStrengthUsage())
qry = FunctionQuery(self, "usage", None, return_type)
self.context.add_query(qry)
return return_type
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
bases: Inherits from Entity class, which provides base functionality for Microsoft Graph API entities including context management and query execution capabilities
Return Value
Instantiation returns an AuthenticationStrengthPolicy object that represents an Azure AD authentication strength policy. The usage() method returns a ClientResult containing an AuthenticationStrengthUsage object that provides information about which Conditional Access policies reference this authentication strength policy, separated into those requiring MFA claims and those that don't.
Class Interface
Methods
usage(self) -> ClientResult
Purpose: Retrieves information about which Conditional Access policies reference this authentication strength policy, separated into MFA-requiring and non-MFA-requiring categories
Returns: ClientResult object containing an AuthenticationStrengthUsage instance with two collections: one for Conditional Access policies requiring MFA claims and another for policies not requiring MFA claims
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
context |
ClientContext | The client context inherited from Entity base class, used for executing queries against the Microsoft Graph API | instance |
Dependencies
office365.directory.authentication.strength_usageoffice365.entityoffice365.runtime.client_resultoffice365.runtime.queries.function
Required Imports
from office365.directory.authentication.strength_usage import AuthenticationStrengthUsage
from office365.entity import Entity
from office365.runtime.client_result import ClientResult
from office365.runtime.queries.function import FunctionQuery
Usage Example
from office365.directory.authentication.strength_policy import AuthenticationStrengthPolicy
from office365.graph_client import GraphClient
# Initialize Graph client with credentials
client = GraphClient(credentials)
# Get an authentication strength policy by ID
policy = client.policies.authentication_strength_policies.get_by_id('policy_id')
client.execute_query()
# Check which Conditional Access policies use this authentication strength
usage_result = policy.usage()
client.execute_query()
# Access the usage information
usage = usage_result.value
print(f'MFA policies: {usage.mfa}')
print(f'Non-MFA policies: {usage.none}')
Best Practices
- Always execute queries using context.execute_query() after calling methods that return ClientResult objects
- The usage() method returns a ClientResult that must be executed before accessing the value property
- Be aware that policies requiring MFA claims have restrictions on what changes can be made to prevent undermining MFA requirements
- Ensure proper Azure AD permissions are granted before attempting to query authentication strength policies
- The class inherits from Entity, so it has access to standard entity properties like id, created_datetime, and modified_datetime
- Use the usage() method to understand policy dependencies before making changes to authentication strength policies
- The returned AuthenticationStrengthUsage object separates policies into MFA-requiring and non-MFA categories for easier policy management
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class AuthenticationStrengthUsage 81.6% similar
-
class AuthenticationMethodsPolicy 77.0% similar
-
class ConditionalAccessPolicy 74.3% similar
-
class AuthorizationPolicy 67.6% similar
-
class TenantAppManagementPolicy 66.9% similar