🔍 Code Extractor

class AuthenticationMethodsPolicy

Maturity: 39

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).

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/policies/authentication_methods.py
Lines:
4 - 7
Complexity:
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

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class AuthenticationMethod 78.8% similar

    Represents an authentication method registered to a user in Azure Active Directory, providing functionality to manage authentication credentials such as passwords, phone numbers, and FIDO2 security keys.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/authentication/methods/method.py
  • class AuthenticationStrengthPolicy 77.0% similar

    Represents an Azure AD authentication strength policy that defines specific combinations of authentication methods and metadata for Conditional Access scenarios.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/policies/authentication_strength.py
  • class AuthenticationMethodsRoot 69.9% similar

    A container class for navigating and accessing Azure AD authentication methods resources, providing access to user registration details and authentication method statistics.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/authentication/methods/root.py
  • class PasswordAuthenticationMethod 69.9% similar

    A class representing a user's password authentication method in Microsoft 365/Office 365 directory services. This class provides a secure abstraction for password management without exposing the actual password value.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/authentication/methods/password.py
  • class PhoneAuthenticationMethod 68.3% similar

    Represents a phone authentication method registered to a user in Microsoft Graph API, managing phone-based authentication including SMS sign-in capabilities.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/authentication/methods/phone.py
← Back to Browse