or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

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

index.mddocs/

0

# Azure Search Management Client

1

2

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.

3

4

## Package Information

5

6

- **Package Name**: azure-mgmt-search

7

- **Language**: Python

8

- **Installation**: `pip install azure-mgmt-search azure-identity`

9

10

## Core Imports

11

12

```python

13

from azure.mgmt.search import SearchManagementClient

14

from azure.identity import DefaultAzureCredential

15

```

16

17

For async operations:

18

19

```python

20

from azure.mgmt.search.aio import SearchManagementClient

21

```

22

23

## Basic Usage

24

25

```python

26

from azure.identity import DefaultAzureCredential

27

from azure.mgmt.search import SearchManagementClient

28

import os

29

30

# Initialize client with Azure credentials

31

credential = DefaultAzureCredential()

32

subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")

33

client = SearchManagementClient(credential, subscription_id)

34

35

# Create a search service

36

from azure.mgmt.search.models import SearchService, Sku, SkuName

37

38

search_service = SearchService(

39

location="East US",

40

sku=Sku(name=SkuName.BASIC),

41

replica_count=1,

42

partition_count=1

43

)

44

45

# Deploy the service (long-running operation)

46

operation = client.services.begin_create_or_update(

47

resource_group_name="my-resource-group",

48

search_service_name="my-search-service",

49

service=search_service

50

)

51

service = operation.result()

52

53

# List all search services in subscription

54

services = client.services.list_by_subscription()

55

for service in services:

56

print(f"Service: {service.name}, Status: {service.status}")

57

58

# Get admin keys for the service

59

admin_keys = client.admin_keys.get("my-resource-group", "my-search-service")

60

print(f"Primary Key: {admin_keys.primary_key}")

61

```

62

63

## Architecture

64

65

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

66

67

- **SearchManagementClient**: Main client class providing access to all operations

68

- **Operation Groups**: Logical groupings of related operations (services, keys, networking, etc.)

69

- **Model Classes**: Strongly-typed data models for requests and responses

70

- **Long-Running Operations (LRO)**: Support for async operations with polling

71

- **Authentication**: Integration with Azure Identity for credential management

72

- **Error Handling**: Comprehensive exception types for different error scenarios

73

74

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.

75

76

## Capabilities

77

78

### Search Service Management

79

80

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

81

82

```python { .api }

83

def create_or_update(resource_group_name: str, search_service_name: str, service: SearchService, **kwargs) -> LROPoller[SearchService]: ...

84

def get(resource_group_name: str, search_service_name: str, **kwargs) -> SearchService: ...

85

def delete(resource_group_name: str, search_service_name: str, **kwargs) -> None: ...

86

def list_by_resource_group(resource_group_name: str, **kwargs) -> ItemPaged[SearchService]: ...

87

def list_by_subscription(**kwargs) -> ItemPaged[SearchService]: ...

88

def check_name_availability(name: str, **kwargs) -> CheckNameAvailabilityOutput: ...

89

def begin_upgrade(resource_group_name: str, search_service_name: str, **kwargs) -> LROPoller[SearchService]: ...

90

```

91

92

[Service Management](./service-management.md)

93

94

### Authentication Key Management

95

96

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.

97

98

```python { .api }

99

def get(resource_group_name: str, search_service_name: str, **kwargs) -> AdminKeyResult: ...

100

def regenerate(resource_group_name: str, search_service_name: str, key_kind: AdminKeyKind, **kwargs) -> AdminKeyResult: ...

101

def create(resource_group_name: str, search_service_name: str, name: str, **kwargs) -> QueryKey: ...

102

def list_by_search_service(resource_group_name: str, search_service_name: str, **kwargs) -> ItemPaged[QueryKey]: ...

103

def delete(resource_group_name: str, search_service_name: str, key: str, **kwargs) -> None: ...

104

```

105

106

[Key Management](./key-management.md)

107

108

### Private Networking

109

110

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

111

112

```python { .api }

113

def list_supported(resource_group_name: str, search_service_name: str, **kwargs) -> ItemPaged[PrivateLinkResource]: ...

114

def update(resource_group_name: str, search_service_name: str, private_endpoint_connection_name: str, private_endpoint_connection: PrivateEndpointConnection, **kwargs) -> PrivateEndpointConnection: ...

115

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]: ...

116

```

117

118

[Private Networking](./private-networking.md)

119

120

### Network Security

121

122

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

123

124

```python { .api }

125

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

126

def get(resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs) -> NetworkSecurityPerimeterConfiguration: ...

127

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

128

```

129

130

[Network Security](./network-security.md)

131

132

### Usage and Monitoring

133

134

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

135

136

```python { .api }

137

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

138

def list(**kwargs) -> ItemPaged[Operation]: ...

139

```

140

141

[Usage and Monitoring](./usage-monitoring.md)

142

143

## Core Data Models

144

145

### SearchService

146

147

Primary model representing an Azure Search service instance.

148

149

```python { .api }

150

class SearchService:

151

"""

152

Represents an Azure Search service.

153

154

Attributes:

155

name (str): Service name

156

location (str): Azure region location

157

tags (Dict[str, str]): Resource tags

158

sku (Sku): Service pricing tier and capacity

159

replica_count (int): Number of search replicas (1-12)

160

partition_count (int): Number of search partitions (1-12)

161

hosting_mode (HostingMode): Hosting mode (default or high_density)

162

public_network_access (PublicNetworkAccess): Public network access setting

163

status (SearchServiceStatus): Current service status

164

status_details (str): Additional status information

165

provisioning_state (ProvisioningState): Resource provisioning state

166

network_rule_set (NetworkRuleSet): Network access rules

167

identity (Identity): Managed identity configuration

168

encryption_with_cmk (EncryptionWithCmk): Customer-managed key encryption

169

disable_local_auth (bool): Disable local authentication

170

auth_options (DataPlaneAuthOptions): Data plane authentication options

171

data_exfiltration_protection (SearchDataExfiltrationProtection): Data exfiltration protection

172

semantic_search (SearchSemanticSearch): Semantic search capability

173

"""

174

```

175

176

### Sku

177

178

Service pricing tier and capacity configuration.

179

180

```python { .api }

181

class Sku:

182

"""

183

SKU configuration for search service.

184

185

Attributes:

186

name (SkuName): SKU tier name

187

"""

188

189

class SkuName(str, Enum):

190

"""Available SKU tiers."""

191

FREE = "free"

192

BASIC = "basic"

193

STANDARD = "standard"

194

STANDARD2 = "standard2"

195

STANDARD3 = "standard3"

196

STORAGE_OPTIMIZED_L1 = "storage_optimized_l1"

197

STORAGE_OPTIMIZED_L2 = "storage_optimized_l2"

198

```

199

200

### AdminKeyResult

201

202

Container for admin API keys.

203

204

```python { .api }

205

class AdminKeyResult:

206

"""

207

Admin keys for full service access.

208

209

Attributes:

210

primary_key (str): Primary admin key

211

secondary_key (str): Secondary admin key

212

"""

213

```

214

215

### QueryKey

216

217

Query API key for read-only access.

218

219

```python { .api }

220

class QueryKey:

221

"""

222

Query key for read-only search access.

223

224

Attributes:

225

name (str): Key name/identifier

226

key (str): API key value

227

"""

228

```

229

230

### NetworkRuleSet

231

232

Network access control configuration.

233

234

```python { .api }

235

class NetworkRuleSet:

236

"""

237

Network access rules for the search service.

238

239

Attributes:

240

ip_rules (List[IpRule]): IP-based access rules

241

bypass (SearchBypass): Bypass options for Azure services

242

"""

243

244

class IpRule:

245

"""

246

IP access rule.

247

248

Attributes:

249

value (str): IP address or CIDR range

250

"""

251

```

252

253

### Identity

254

255

Managed identity configuration for Azure resources.

256

257

```python { .api }

258

class Identity:

259

"""

260

Managed identity configuration.

261

262

Attributes:

263

type (IdentityType): Identity type

264

principal_id (str): Principal ID (read-only)

265

tenant_id (str): Tenant ID (read-only)

266

user_assigned_identities (Dict[str, UserAssignedIdentity]): User-assigned identities

267

"""

268

269

class IdentityType(str, Enum):

270

"""Identity types."""

271

NONE = "none"

272

SYSTEM_ASSIGNED = "system_assigned"

273

USER_ASSIGNED = "user_assigned"

274

SYSTEM_ASSIGNED_USER_ASSIGNED = "system_assigned_user_assigned"

275

```

276

277

## Error Handling

278

279

The library uses standard Azure SDK exceptions for error handling:

280

281

```python

282

from azure.core.exceptions import (

283

ClientAuthenticationError,

284

HttpResponseError,

285

ResourceExistsError,

286

ResourceNotFoundError,

287

ResourceNotModifiedError

288

)

289

290

try:

291

service = client.services.get("my-rg", "my-service")

292

except ResourceNotFoundError:

293

print("Search service not found")

294

except ClientAuthenticationError:

295

print("Authentication failed")

296

except HttpResponseError as e:

297

print(f"HTTP error: {e.status_code} - {e.message}")

298

```

299

300

## Async Support

301

302

All operations support async/await patterns:

303

304

```python

305

import asyncio

306

from azure.mgmt.search.aio import SearchManagementClient

307

from azure.identity.aio import DefaultAzureCredential

308

309

async def main():

310

credential = DefaultAzureCredential()

311

client = SearchManagementClient(credential, subscription_id)

312

313

async with client:

314

services = client.services.list_by_subscription()

315

async for service in services:

316

print(f"Service: {service.name}")

317

318

asyncio.run(main())

319

```