or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.mdkey-management.mdnetwork-security.mdprivate-networking.mdservice-management.mdusage-monitoring.md
tile.json

tessl/pypi-azure-mgmt-search

Microsoft Azure Search Management Client Library for Python

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/azure-mgmt-search@9.2.x

To install, run

npx @tessl/cli install tessl/pypi-azure-mgmt-search@9.2.0

index.mddocs/

Azure Search Management Client

A comprehensive Python client library for managing Azure Search (now Azure Cognitive Search) services through the Azure Resource Manager. This library enables developers to programmatically create, configure, and manage Azure Cognitive Search services, including operations for service provisioning, scaling, monitoring, and administrative tasks such as managing search indexes, data sources, indexers, and skillsets.

Package Information

  • Package Name: azure-mgmt-search
  • Language: Python
  • Installation: pip install azure-mgmt-search azure-identity

Core Imports

from azure.mgmt.search import SearchManagementClient
from azure.identity import DefaultAzureCredential

For async operations:

from azure.mgmt.search.aio import SearchManagementClient

Basic Usage

from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
import os

# Initialize client with Azure credentials
credential = DefaultAzureCredential()
subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = SearchManagementClient(credential, subscription_id)

# Create a search service
from azure.mgmt.search.models import SearchService, Sku, SkuName

search_service = SearchService(
    location="East US",
    sku=Sku(name=SkuName.BASIC),
    replica_count=1,
    partition_count=1
)

# Deploy the service (long-running operation)
operation = client.services.begin_create_or_update(
    resource_group_name="my-resource-group",
    search_service_name="my-search-service",
    service=search_service
)
service = operation.result()

# List all search services in subscription
services = client.services.list_by_subscription()
for service in services:
    print(f"Service: {service.name}, Status: {service.status}")

# Get admin keys for the service
admin_keys = client.admin_keys.get("my-resource-group", "my-search-service")
print(f"Primary Key: {admin_keys.primary_key}")

Architecture

The Azure Search Management Client follows Azure SDK design patterns with:

  • SearchManagementClient: Main client class providing access to all operations
  • Operation Groups: Logical groupings of related operations (services, keys, networking, etc.)
  • Model Classes: Strongly-typed data models for requests and responses
  • Long-Running Operations (LRO): Support for async operations with polling
  • Authentication: Integration with Azure Identity for credential management
  • Error Handling: Comprehensive exception types for different error scenarios

The client supports both synchronous and asynchronous programming models, automatic retry policies, distributed tracing, and follows Azure SDK guidelines for consistent developer experience across Azure services.

Capabilities

Search Service Management

Core operations for creating, updating, deleting, and configuring Azure Search services. Includes service provisioning, scaling, status monitoring, name availability checking, and service upgrades.

def create_or_update(resource_group_name: str, search_service_name: str, service: SearchService, **kwargs) -> LROPoller[SearchService]: ...
def get(resource_group_name: str, search_service_name: str, **kwargs) -> SearchService: ...
def delete(resource_group_name: str, search_service_name: str, **kwargs) -> None: ...
def list_by_resource_group(resource_group_name: str, **kwargs) -> ItemPaged[SearchService]: ...
def list_by_subscription(**kwargs) -> ItemPaged[SearchService]: ...
def check_name_availability(name: str, **kwargs) -> CheckNameAvailabilityOutput: ...
def begin_upgrade(resource_group_name: str, search_service_name: str, **kwargs) -> LROPoller[SearchService]: ...

Service Management

Authentication Key Management

Management of admin and query keys for search service authentication. Admin keys provide full access to the search service, while query keys provide read-only access for search operations.

def get(resource_group_name: str, search_service_name: str, **kwargs) -> AdminKeyResult: ...
def regenerate(resource_group_name: str, search_service_name: str, key_kind: AdminKeyKind, **kwargs) -> AdminKeyResult: ...
def create(resource_group_name: str, search_service_name: str, name: str, **kwargs) -> QueryKey: ...
def list_by_search_service(resource_group_name: str, search_service_name: str, **kwargs) -> ItemPaged[QueryKey]: ...
def delete(resource_group_name: str, search_service_name: str, key: str, **kwargs) -> None: ...

Key Management

Private Networking

Configuration of private endpoints, private link resources, and shared private link resources for secure network connectivity to search services.

def list_supported(resource_group_name: str, search_service_name: str, **kwargs) -> ItemPaged[PrivateLinkResource]: ...
def update(resource_group_name: str, search_service_name: str, private_endpoint_connection_name: str, private_endpoint_connection: PrivateEndpointConnection, **kwargs) -> PrivateEndpointConnection: ...
def create_or_update(resource_group_name: str, search_service_name: str, shared_private_link_resource_name: str, shared_private_link_resource: SharedPrivateLinkResource, **kwargs) -> LROPoller[SharedPrivateLinkResource]: ...

Private Networking

Network Security

Management of network security perimeter configurations for enhanced security and compliance in enterprise environments.

def list_by_service(resource_group_name: str, search_service_name: str, **kwargs) -> ItemPaged[NetworkSecurityPerimeterConfiguration]: ...
def get(resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs) -> NetworkSecurityPerimeterConfiguration: ...
def reconcile(resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs) -> LROPoller[NetworkSecurityPerimeterConfiguration]: ...

Network Security

Usage and Monitoring

Operations for querying usage statistics, quota information, and available Azure operations for monitoring and capacity planning.

def list_by_subscription(location: str, **kwargs) -> ItemPaged[QuotaUsageResult]: ...
def list(**kwargs) -> ItemPaged[Operation]: ...

Usage and Monitoring

Core Data Models

SearchService

Primary model representing an Azure Search service instance.

class SearchService:
    """
    Represents an Azure Search service.
    
    Attributes:
        name (str): Service name
        location (str): Azure region location
        tags (Dict[str, str]): Resource tags
        sku (Sku): Service pricing tier and capacity
        replica_count (int): Number of search replicas (1-12)
        partition_count (int): Number of search partitions (1-12)
        hosting_mode (HostingMode): Hosting mode (default or high_density)
        public_network_access (PublicNetworkAccess): Public network access setting
        status (SearchServiceStatus): Current service status
        status_details (str): Additional status information
        provisioning_state (ProvisioningState): Resource provisioning state
        network_rule_set (NetworkRuleSet): Network access rules
        identity (Identity): Managed identity configuration
        encryption_with_cmk (EncryptionWithCmk): Customer-managed key encryption
        disable_local_auth (bool): Disable local authentication
        auth_options (DataPlaneAuthOptions): Data plane authentication options
        data_exfiltration_protection (SearchDataExfiltrationProtection): Data exfiltration protection
        semantic_search (SearchSemanticSearch): Semantic search capability
    """

Sku

Service pricing tier and capacity configuration.

class Sku:
    """
    SKU configuration for search service.
    
    Attributes:
        name (SkuName): SKU tier name
    """

class SkuName(str, Enum):
    """Available SKU tiers."""
    FREE = "free"
    BASIC = "basic"
    STANDARD = "standard"
    STANDARD2 = "standard2"
    STANDARD3 = "standard3"
    STORAGE_OPTIMIZED_L1 = "storage_optimized_l1"
    STORAGE_OPTIMIZED_L2 = "storage_optimized_l2"

AdminKeyResult

Container for admin API keys.

class AdminKeyResult:
    """
    Admin keys for full service access.
    
    Attributes:
        primary_key (str): Primary admin key
        secondary_key (str): Secondary admin key
    """

QueryKey

Query API key for read-only access.

class QueryKey:
    """
    Query key for read-only search access.
    
    Attributes:
        name (str): Key name/identifier
        key (str): API key value
    """

NetworkRuleSet

Network access control configuration.

class NetworkRuleSet:
    """
    Network access rules for the search service.
    
    Attributes:
        ip_rules (List[IpRule]): IP-based access rules
        bypass (SearchBypass): Bypass options for Azure services
    """

class IpRule:
    """
    IP access rule.
    
    Attributes:
        value (str): IP address or CIDR range
    """

Identity

Managed identity configuration for Azure resources.

class Identity:
    """
    Managed identity configuration.
    
    Attributes:
        type (IdentityType): Identity type
        principal_id (str): Principal ID (read-only)
        tenant_id (str): Tenant ID (read-only)
        user_assigned_identities (Dict[str, UserAssignedIdentity]): User-assigned identities
    """

class IdentityType(str, Enum):
    """Identity types."""
    NONE = "none"
    SYSTEM_ASSIGNED = "system_assigned"
    USER_ASSIGNED = "user_assigned"
    SYSTEM_ASSIGNED_USER_ASSIGNED = "system_assigned_user_assigned"

Error Handling

The library uses standard Azure SDK exceptions for error handling:

from azure.core.exceptions import (
    ClientAuthenticationError,
    HttpResponseError,
    ResourceExistsError,
    ResourceNotFoundError,
    ResourceNotModifiedError
)

try:
    service = client.services.get("my-rg", "my-service")
except ResourceNotFoundError:
    print("Search service not found")
except ClientAuthenticationError:
    print("Authentication failed")
except HttpResponseError as e:
    print(f"HTTP error: {e.status_code} - {e.message}")

Async Support

All operations support async/await patterns:

import asyncio
from azure.mgmt.search.aio import SearchManagementClient
from azure.identity.aio import DefaultAzureCredential

async def main():
    credential = DefaultAzureCredential()
    client = SearchManagementClient(credential, subscription_id)
    
    async with client:
        services = client.services.list_by_subscription()
        async for service in services:
            print(f"Service: {service.name}")

asyncio.run(main())