class AuthenticationMethodsPolicy
A class representing Azure Active Directory authentication methods policy that defines which authentication methods users can use for sign-in and multi-factor authentication (MFA).
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/policies/authentication_methods.py
4 - 7
simple
Purpose
This class serves as a data model for managing authentication methods policies in Azure Active Directory. It inherits from Entity and represents the configuration that controls which authentication methods (like SMS, phone call, authenticator app, FIDO2 keys, etc.) are available to users for signing in and performing MFA. This class is part of the Microsoft Graph API integration for managing Azure AD authentication policies.
Source Code
class AuthenticationMethodsPolicy(Entity):
"""Defines authentication methods and the users that are allowed to use them to sign in and perform multi-factor
authentication (MFA) in Azure Active Directory (Azure AD).
"""
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
Entity | - |
Parameter Details
bases: Inherits from Entity class, which provides base functionality for Microsoft Graph API entities including property management, serialization, and API interaction capabilities
Return Value
Instantiation returns an AuthenticationMethodsPolicy object that represents an Azure AD authentication methods policy. The object can be used to read, update, or manage authentication method configurations for an Azure AD tenant.
Class Interface
Dependencies
office365
Required Imports
from office365.entity import Entity
from office365.directory.authentication.methods.policy import AuthenticationMethodsPolicy
Usage Example
from office365.directory.authentication.methods.policy import AuthenticationMethodsPolicy
from office365.graph_client import GraphClient
# Initialize Graph client with credentials
client = GraphClient.with_client_secret(tenant_id, client_id, client_secret)
# Get the authentication methods policy
auth_policy = client.policies.authentication_methods_policy.get().execute_query()
# Access policy properties (inherited from Entity)
print(auth_policy.id)
print(auth_policy.properties)
# Update policy (if permissions allow)
auth_policy.set_property('description', 'Updated policy description')
auth_policy.update().execute_query()
Best Practices
- Always authenticate with appropriate Microsoft Graph API permissions before accessing authentication policies
- Use proper error handling when querying or updating policies as they require elevated permissions
- The class inherits from Entity, so use Entity methods like get(), update(), and delete() for API operations
- Execute queries using execute_query() method to actually perform API calls
- Cache policy objects when possible to reduce API calls, but refresh when policy changes are expected
- Ensure the authenticated user or application has Policy.ReadWrite.AuthenticationMethod permission for write operations
- This class represents a singleton resource in Azure AD (one policy per tenant), so there's typically only one instance per tenant
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class AuthenticationMethod 78.8% similar
-
class AuthenticationStrengthPolicy 77.0% similar
-
class AuthenticationMethodsRoot 69.9% similar
-
class PasswordAuthenticationMethod 69.9% similar
-
class PhoneAuthenticationMethod 68.3% similar