CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-azure-mgmt-trafficmanager

Microsoft Azure Traffic Manager Management Client Library for Python

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

profiles.mddocs/

Profile Management

Complete lifecycle management of Traffic Manager profiles including creation, configuration, updating, deletion, and listing operations. Profiles define the overall traffic routing strategy, DNS configuration, and health monitoring settings for your traffic management solution.

Capabilities

Create or Update Profile

Creates a new Traffic Manager profile or updates an existing one with complete configuration including routing method, DNS settings, monitoring, and endpoints.

def create_or_update(
    resource_group_name: str,
    profile_name: str,
    parameters: Union[Profile, IO]
) -> Profile:
    """
    Creates or updates a Traffic Manager profile.

    Args:
        resource_group_name (str): Name of the resource group
        profile_name (str): Name of the Traffic Manager profile
        parameters (Profile): Profile configuration

    Returns:
        Profile: The created or updated profile
    """

Usage Example:

from azure.mgmt.trafficmanager.models import Profile, DnsConfig, MonitorConfig

profile_config = Profile(
    location="global",
    tags={"environment": "production", "team": "platform"},
    profile_status="Enabled",
    traffic_routing_method="Performance",
    dns_config=DnsConfig(
        relative_name="my-app-tm",
        ttl=60
    ),
    monitor_config=MonitorConfig(
        protocol="HTTPS",
        port=443,
        path="/health",
        interval_in_seconds=30,
        timeout_in_seconds=10,
        tolerated_number_of_failures=3,
        custom_headers=[
            {"name": "Authorization", "value": "Bearer token"},
            {"name": "User-Agent", "value": "TrafficManager/1.0"}
        ],
        expected_status_code_ranges=[
            {"min": 200, "max": 299}
        ]
    ),
    traffic_view_enrollment_status="Enabled",
    allowed_endpoint_record_types=["DomainName", "IPv4Address"],
    max_return=8  # For MultiValue routing
)

profile = client.profiles.create_or_update(
    resource_group_name="my-rg",
    profile_name="my-app-profile",
    parameters=profile_config
)

Get Profile

Retrieves a specific Traffic Manager profile with complete configuration details and current status.

def get(resource_group_name: str, profile_name: str) -> Profile:
    """
    Gets a Traffic Manager profile.

    Args:
        resource_group_name (str): Name of the resource group
        profile_name (str): Name of the Traffic Manager profile

    Returns:
        Profile: The Traffic Manager profile
    """

Update Profile

Updates an existing Traffic Manager profile with partial configuration changes while preserving unchanged settings.

def update(
    resource_group_name: str,
    profile_name: str,
    parameters: Union[Profile, IO]
) -> Profile:
    """
    Updates a Traffic Manager profile.

    Args:
        resource_group_name (str): Name of the resource group
        profile_name (str): Name of the Traffic Manager profile
        parameters (Profile): Updated profile configuration

    Returns:
        Profile: The updated profile
    """

Delete Profile

Deletes a Traffic Manager profile and all its associated endpoints permanently.

def delete(
    resource_group_name: str,
    profile_name: str
) -> Optional[DeleteOperationResult]:
    """
    Deletes a Traffic Manager profile.

    Args:
        resource_group_name (str): Name of the resource group
        profile_name (str): Name of the Traffic Manager profile

    Returns:
        Optional[DeleteOperationResult]: Operation result or None
    """

List Profiles by Resource Group

Lists all Traffic Manager profiles within a specific resource group with pagination support.

def list_by_resource_group(resource_group_name: str) -> Iterable[Profile]:
    """
    Lists all profiles in a resource group.

    Args:
        resource_group_name (str): Name of the resource group

    Returns:
        Iterable[Profile]: Paginated collection of profiles
    """

Usage Example:

# List and filter profiles
profiles = list(client.profiles.list_by_resource_group("my-rg"))
enabled_profiles = [p for p in profiles if p.profile_status == "Enabled"]

for profile in enabled_profiles:
    print(f"Profile: {profile.name}")
    print(f"  FQDN: {profile.dns_config.fqdn}")
    print(f"  Routing: {profile.traffic_routing_method}")
    print(f"  Endpoints: {len(profile.endpoints or [])}")

List Profiles by Subscription

Lists all Traffic Manager profiles within the subscription across all resource groups with pagination support.

def list_by_subscription() -> Iterable[Profile]:
    """
    Lists all profiles in the subscription.

    Returns:
        Iterable[Profile]: Paginated collection of profiles
    """

Check DNS Name Availability

Checks if a Traffic Manager relative DNS name is available for use in profile creation.

def check_traffic_manager_relative_dns_name_availability(
    parameters: Union[CheckTrafficManagerRelativeDnsNameAvailabilityParameters, IO]
) -> TrafficManagerNameAvailability:
    """
    Checks DNS name availability.

    Args:
        parameters: Name availability check parameters

    Returns:
        TrafficManagerNameAvailability: Availability result
    """

Check DNS Name Availability V2

Enhanced version of DNS name availability check with improved validation and subscription context.

def check_traffic_manager_name_availability_v2(
    parameters: Union[CheckTrafficManagerRelativeDnsNameAvailabilityParameters, IO]
) -> TrafficManagerNameAvailability:
    """
    Checks DNS name availability (V2).

    Args:
        parameters: Name availability check parameters

    Returns:
        TrafficManagerNameAvailability: Availability result
    """

Usage Example:

from azure.mgmt.trafficmanager.models import CheckTrafficManagerRelativeDnsNameAvailabilityParameters

# Check name availability before creating profile
check_params = CheckTrafficManagerRelativeDnsNameAvailabilityParameters(
    name="my-new-app-tm",
    type="Microsoft.Network/trafficManagerProfiles"
)

availability = client.profiles.check_traffic_manager_name_availability_v2(check_params)

if availability.name_available:
    print("Name is available")
else:
    print(f"Name unavailable: {availability.reason} - {availability.message}")

Profile Configuration Types

Traffic Routing Methods

class TrafficRoutingMethod(str, Enum):
    """Traffic routing algorithms for load balancing."""
    PERFORMANCE = "Performance"    # Route to closest endpoint
    PRIORITY = "Priority"          # Failover routing
    WEIGHTED = "Weighted"          # Distribute by weight
    GEOGRAPHIC = "Geographic"      # Route by user location
    MULTI_VALUE = "MultiValue"     # Return multiple healthy endpoints
    SUBNET = "Subnet"              # Route by source IP subnet

DNS Configuration

class DnsConfig:
    """DNS configuration for Traffic Manager profiles."""
    relative_name: str      # DNS name (e.g., "my-app")
    fqdn: str              # Full DNS name (read-only, e.g., "my-app.trafficmanager.net")
    ttl: int               # DNS Time-To-Live in seconds (1-2147483647)

Monitor Configuration

class MonitorConfig:
    """Health monitoring configuration for endpoints."""
    profile_monitor_status: ProfileMonitorStatus           # Overall status
    protocol: MonitorProtocol                             # HTTP, HTTPS, or TCP
    port: int                                             # Port number (1-65535)
    path: str                                             # Path for HTTP(S) checks
    interval_in_seconds: int                              # Check interval (30 or 10)
    timeout_in_seconds: int                               # Check timeout (5-10)
    tolerated_number_of_failures: int                     # Allowed failures (0-9)
    custom_headers: List[MonitorConfigCustomHeadersItem]  # Custom HTTP headers
    expected_status_code_ranges: List[MonitorConfigExpectedStatusCodeRangesItem]  # Expected status codes

class MonitorConfigCustomHeadersItem:
    """Custom header for health checks."""
    name: str                      # Header name
    value: str                     # Header value

class MonitorConfigExpectedStatusCodeRangesItem:
    """Expected HTTP status code range."""
    min: int                       # Minimum status code
    max: int                       # Maximum status code

Profile Status Types

class ProfileStatus(str, Enum):
    """Profile operational status."""
    ENABLED = "Enabled"            # Profile is active
    DISABLED = "Disabled"          # Profile is inactive

class ProfileMonitorStatus(str, Enum):
    """Profile health monitoring status."""
    CHECKING_ENDPOINTS = "CheckingEndpoints"    # Checking endpoint health
    ONLINE = "Online"                           # All endpoints healthy
    DEGRADED = "Degraded"                       # Some endpoints unhealthy
    DISABLED = "Disabled"                       # Monitoring disabled
    INACTIVE = "Inactive"                       # Profile inactive

class TrafficViewEnrollmentStatus(str, Enum):
    """Traffic View feature enrollment status."""
    ENABLED = "Enabled"            # Traffic View enabled
    DISABLED = "Disabled"          # Traffic View disabled

Utility Types

class CheckTrafficManagerRelativeDnsNameAvailabilityParameters:
    """Parameters for DNS name availability check."""
    name: str                      # Relative name to check
    type: str                      # Resource type

class TrafficManagerNameAvailability:
    """DNS name availability response."""
    name: str                      # Relative name checked
    type: str                      # Resource type
    name_available: bool           # Whether name is available
    reason: str                    # Reason if unavailable
    message: str                   # Descriptive message

class DeleteOperationResult:
    """Result of delete operations."""
    operation_result: bool         # Success status (read-only)

Install with Tessl CLI

npx tessl i tessl/pypi-azure-mgmt-trafficmanager

docs

analytics.md

client.md

endpoints.md

geographic.md

index.md

profiles.md

tile.json