class TenantInformation
A data class representing publicly displayed information about an Azure AD tenant, including domain name, display name, federation brand name, and tenant ID.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/tenant_information.py
4 - 23
simple
Purpose
This class serves as a data container (value object) for Azure AD tenant information that is publicly visible to users in other Azure AD tenants. It inherits from ClientValue, which likely provides serialization/deserialization capabilities for API communication. The class is used to encapsulate tenant metadata when interacting with Microsoft 365/Azure AD services through the Office365 Python SDK.
Source Code
class TenantInformation(ClientValue):
"""Information about your Azure AD tenant that is publicly displayed to users in other Azure AD tenants."""
def __str__(
self,
default_domain_name=None,
display_name=None,
federation_brand_name=None,
tenant_id=None,
):
"""
:param str default_domain_name: Primary domain name of an Azure AD tenant.
:param str display_name: Display name of an Azure AD tenant.
:param str federation_brand_name: Name shown to users that sign in to an Azure AD tenant.
:param str tenant_id: Unique identifier of an Azure AD tenant.
"""
self.defaultDomainName = default_domain_name
self.displayName = display_name
self.federationBrandName = federation_brand_name
self.tenantId = tenant_id
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
default_domain_name: The primary domain name of the Azure AD tenant (e.g., 'contoso.onmicrosoft.com'). This is the default domain used for user accounts in the tenant. Optional parameter, defaults to None.
display_name: The human-readable display name of the Azure AD tenant (e.g., 'Contoso Corporation'). This is shown in various Azure AD interfaces. Optional parameter, defaults to None.
federation_brand_name: The brand name shown to users during sign-in to the Azure AD tenant. This is typically used for federated authentication scenarios. Optional parameter, defaults to None.
tenant_id: The unique identifier (GUID) of the Azure AD tenant. This is a globally unique identifier that distinguishes this tenant from all others. Optional parameter, defaults to None.
Return Value
The __str__ method (which appears to be incorrectly named and should be __init__) returns None as it initializes the instance. When instantiated, the class returns a TenantInformation object with four instance attributes: defaultDomainName, displayName, federationBrandName, and tenantId. These attributes store the tenant information in camelCase format, likely for JSON serialization compatibility with Microsoft APIs.
Class Interface
Methods
__str__(self, default_domain_name=None, display_name=None, federation_brand_name=None, tenant_id=None) -> None
Purpose: Initializes the TenantInformation instance with Azure AD tenant details. NOTE: This method is incorrectly named and should be __init__. It sets up the instance attributes with tenant information.
Parameters:
default_domain_name: Primary domain name of the Azure AD tenant (e.g., 'contoso.onmicrosoft.com')display_name: Display name of the Azure AD tenant shown in interfacesfederation_brand_name: Brand name shown to users during sign-intenant_id: Unique identifier (GUID) of the Azure AD tenant
Returns: None - this is a constructor-like method that initializes instance attributes
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
defaultDomainName |
str or None | The primary domain name of the Azure AD tenant | instance |
displayName |
str or None | The display name of the Azure AD tenant | instance |
federationBrandName |
str or None | The brand name shown to users during sign-in | instance |
tenantId |
str or None | The unique identifier (GUID) of the Azure AD tenant | instance |
Dependencies
office365-runtime
Required Imports
from office365.runtime.client_value import ClientValue
Usage Example
from office365.runtime.client_value import ClientValue
from office365.directory.tenant_information import TenantInformation
# Create a TenantInformation instance with tenant details
tenant_info = TenantInformation()
tenant_info.__str__(
default_domain_name='contoso.onmicrosoft.com',
display_name='Contoso Corporation',
federation_brand_name='Contoso',
tenant_id='12345678-1234-1234-1234-123456789abc'
)
# Access tenant information
print(tenant_info.defaultDomainName) # 'contoso.onmicrosoft.com'
print(tenant_info.displayName) # 'Contoso Corporation'
print(tenant_info.tenantId) # '12345678-1234-1234-1234-123456789abc'
# Typically used when retrieving tenant information from Azure AD
# tenant_info = context.tenant.get().execute_query()
# print(tenant_info.displayName)
Best Practices
- NOTE: The method is named __str__ but behaves like __init__. This appears to be a bug in the source code. It should be renamed to __init__ for proper constructor behavior.
- This class is a data container and should be treated as immutable after initialization. Avoid modifying attributes after creation.
- The class uses camelCase for attribute names (defaultDomainName, displayName, etc.) to match Microsoft API conventions, even though Python typically uses snake_case.
- When using this class, ensure tenant_id is a valid GUID format if provided.
- This class inherits from ClientValue, which likely provides JSON serialization capabilities. The parent class may handle conversion between Python objects and API payloads.
- Typically instantiated by the Office365 SDK when retrieving tenant information from Azure AD, rather than manually created by developers.
- All parameters are optional (default to None), allowing partial tenant information to be represented.
- The class does not perform validation on input values, so ensure data integrity at the caller level.
Tags
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class TenantAppInformation 75.9% similar
-
class TenantRelationship 68.9% similar
-
class ProvisionedTemporaryAzureContainerInfo 63.5% similar
-
class VerifiedDomain 62.7% similar
-
class SPOTenantWebTemplate 61.2% similar