🔍 Code Extractor

class AppIdPath

Maturity: 48

A specialized ResourcePath subclass for constructing OData-style path segments that address Azure Service Principals or Applications using their appId (Application/client ID).

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/paths/appid.py
Lines:
4 - 14
Complexity:
simple

Purpose

This class provides a specific path formatting mechanism for Microsoft Graph API or Azure AD operations where resources need to be addressed by their Application ID (appId) rather than by object ID. It generates OData filter-style path segments in the format '(appId='value')' which is commonly used in Microsoft Graph API endpoints to query or access Service Principals and Applications by their client ID.

Source Code

class AppIdPath(ResourcePath):
    """Path for addressing a Service Principal or Application by appId where
    appId is referred to as Application (client) ID on the Azure portal"""

    @property
    def segment(self):
        return "(appId='{0}')".format(self._key)

    @property
    def delimiter(self):
        return None

Parameters

Name Type Default Kind
bases ResourcePath -

Parameter Details

_key: The appId (Application/client ID) value that will be used to construct the path segment. This is inherited from the parent ResourcePath class and is passed during instantiation. It should be a valid GUID string representing an Azure Application or Service Principal's client ID.

Return Value

Instantiation returns an AppIdPath object that can be used to construct resource paths. The segment property returns a formatted string in the format '(appId='<appId_value>')'. The delimiter property returns None, indicating no delimiter should be used when combining path segments.

Class Interface

Methods

@property segment(self) -> str property

Purpose: Returns the formatted OData-style path segment containing the appId filter expression

Returns: A string in the format '(appId='<appId_value>')' where <appId_value> is the Application ID provided during instantiation

@property delimiter(self) -> None property

Purpose: Returns the delimiter to be used when combining this path segment with others

Returns: None, indicating no delimiter should be used for this path segment type

Attributes

Name Type Description Scope
_key str Stores the appId (Application/client ID) value. Inherited from ResourcePath parent class. Used to construct the path segment. instance

Dependencies

  • office365

Required Imports

from office365.runtime.paths.resource_path import ResourcePath

Usage Example

from office365.runtime.paths.resource_path import ResourcePath
from office365.runtime.paths.app_id_path import AppIdPath

# Create a path for a Service Principal using its appId
app_id = '12345678-1234-1234-1234-123456789abc'
path = AppIdPath(app_id)

# Get the formatted segment
segment = path.segment
print(segment)  # Output: (appId='12345678-1234-1234-1234-123456789abc')

# Check the delimiter
delimiter = path.delimiter
print(delimiter)  # Output: None

# Typically used in conjunction with Microsoft Graph API client
# Example: client.service_principals.get_by_path(AppIdPath(app_id))

Best Practices

  • Always provide a valid GUID string as the appId parameter when instantiating this class
  • This class is typically used internally by Microsoft Graph API client libraries rather than directly by end users
  • The appId should correspond to an actual Application or Service Principal in Azure AD
  • Use this class when you need to query or access resources by Application ID rather than Object ID
  • The generated path segment follows OData filter syntax conventions used by Microsoft Graph API
  • This class is immutable once created - the appId cannot be changed after instantiation
  • The delimiter property returning None indicates this path segment should not have separators when combined with other path components

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class ApplicationServicePrincipal 63.1% similar

    Represents the concatenation of an Azure AD application and servicePrincipal object created when an application instance is added from the Azure AD application gallery.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/applications/service_principal.py
  • class ServicePrincipal 60.2% similar

    Represents an instance of an application in a directory, providing methods to manage service principal credentials, permissions, and role assignments in Azure Active Directory.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/serviceprincipals/service_principal.py
  • class Application 59.0% similar

    Represents an Azure Active Directory (Azure AD) application registration, providing methods to manage application credentials, certificates, passwords, and publisher verification.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/applications/application.py
  • class AppIdentity 58.5% similar

    A data class representing the identity of an Azure Active Directory application that performed an action or was changed, used in directory audit operations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/applications/app_identity.py
  • class EntityPath 57.8% similar

    EntityPath is a specialized ResourcePath subclass that represents a path for addressing a single entity using a key, formatting the path segment with appropriate syntax based on the key type.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/runtime/paths/v3/entity.py
← Back to Browse