0
# Private Networking
1
2
Configuration of private endpoints, private link resources, and shared private link resources for secure network connectivity to search services. This enables private communication between search services and other Azure resources without traversing the public internet.
3
4
## Capabilities
5
6
### Private Link Resources
7
8
Discover and list the types of private link resources supported by the search service, which defines what Azure resources can establish private connections.
9
10
```python { .api }
11
def list_supported(
12
resource_group_name: str,
13
search_service_name: str,
14
*,
15
client_request_id: Optional[str] = None,
16
**kwargs
17
) -> ItemPaged[PrivateLinkResource]:
18
"""
19
List supported private link resource types for the search service.
20
21
Parameters:
22
resource_group_name (str): Resource group name
23
search_service_name (str): Search service name
24
client_request_id (str, optional): Client-generated request ID
25
26
Returns:
27
ItemPaged[PrivateLinkResource]: Supported private link resource types
28
29
Raises:
30
ResourceNotFoundError: Service does not exist
31
"""
32
```
33
34
### Private Endpoint Connections
35
36
Manage private endpoint connections that allow other Azure resources to connect privately to the search service through Azure Private Link.
37
38
```python { .api }
39
def update(
40
resource_group_name: str,
41
search_service_name: str,
42
private_endpoint_connection_name: str,
43
private_endpoint_connection: PrivateEndpointConnection,
44
*,
45
client_request_id: Optional[str] = None,
46
**kwargs
47
) -> PrivateEndpointConnection:
48
"""
49
Update a private endpoint connection.
50
51
Parameters:
52
resource_group_name (str): Resource group name
53
search_service_name (str): Search service name
54
private_endpoint_connection_name (str): Private endpoint connection name
55
private_endpoint_connection (PrivateEndpointConnection): Connection configuration
56
client_request_id (str, optional): Client-generated request ID
57
58
Returns:
59
PrivateEndpointConnection: Updated connection configuration
60
61
Raises:
62
ResourceNotFoundError: Service or connection does not exist
63
"""
64
65
def get(
66
resource_group_name: str,
67
search_service_name: str,
68
private_endpoint_connection_name: str,
69
*,
70
client_request_id: Optional[str] = None,
71
**kwargs
72
) -> PrivateEndpointConnection:
73
"""
74
Get a private endpoint connection by name.
75
76
Parameters:
77
resource_group_name (str): Resource group name
78
search_service_name (str): Search service name
79
private_endpoint_connection_name (str): Connection name
80
client_request_id (str, optional): Client-generated request ID
81
82
Returns:
83
PrivateEndpointConnection: Connection details and status
84
85
Raises:
86
ResourceNotFoundError: Service or connection does not exist
87
"""
88
89
def delete(
90
resource_group_name: str,
91
search_service_name: str,
92
private_endpoint_connection_name: str,
93
*,
94
client_request_id: Optional[str] = None,
95
**kwargs
96
) -> PrivateEndpointConnection:
97
"""
98
Delete a private endpoint connection.
99
100
Parameters:
101
resource_group_name (str): Resource group name
102
search_service_name (str): Search service name
103
private_endpoint_connection_name (str): Connection name to delete
104
client_request_id (str, optional): Client-generated request ID
105
106
Returns:
107
PrivateEndpointConnection: Deleted connection details
108
109
Raises:
110
ResourceNotFoundError: Service or connection does not exist
111
"""
112
113
def list_by_service(
114
resource_group_name: str,
115
search_service_name: str,
116
*,
117
client_request_id: Optional[str] = None,
118
**kwargs
119
) -> ItemPaged[PrivateEndpointConnection]:
120
"""
121
List all private endpoint connections for a search service.
122
123
Parameters:
124
resource_group_name (str): Resource group name
125
search_service_name (str): Search service name
126
client_request_id (str, optional): Client-generated request ID
127
128
Returns:
129
ItemPaged[PrivateEndpointConnection]: All private endpoint connections
130
"""
131
```
132
133
### Shared Private Link Resources
134
135
Manage shared private link resources that allow the search service to connect privately to other Azure resources like storage accounts, Cosmos DB, or SQL databases.
136
137
```python { .api }
138
def create_or_update(
139
resource_group_name: str,
140
search_service_name: str,
141
shared_private_link_resource_name: str,
142
shared_private_link_resource: SharedPrivateLinkResource,
143
*,
144
client_request_id: Optional[str] = None,
145
**kwargs
146
) -> LROPoller[SharedPrivateLinkResource]:
147
"""
148
Create or update a shared private link resource.
149
150
Parameters:
151
resource_group_name (str): Resource group name
152
search_service_name (str): Search service name
153
shared_private_link_resource_name (str): Shared resource name
154
shared_private_link_resource (SharedPrivateLinkResource): Resource configuration
155
client_request_id (str, optional): Client-generated request ID
156
157
Returns:
158
LROPoller[SharedPrivateLinkResource]: Long-running operation for resource creation
159
160
Raises:
161
HttpResponseError: Invalid configuration or quota exceeded
162
"""
163
164
def get(
165
resource_group_name: str,
166
search_service_name: str,
167
shared_private_link_resource_name: str,
168
*,
169
client_request_id: Optional[str] = None,
170
**kwargs
171
) -> SharedPrivateLinkResource:
172
"""
173
Get a shared private link resource by name.
174
175
Parameters:
176
resource_group_name (str): Resource group name
177
search_service_name (str): Search service name
178
shared_private_link_resource_name (str): Resource name
179
client_request_id (str, optional): Client-generated request ID
180
181
Returns:
182
SharedPrivateLinkResource: Resource configuration and status
183
184
Raises:
185
ResourceNotFoundError: Service or resource does not exist
186
"""
187
188
def delete(
189
resource_group_name: str,
190
search_service_name: str,
191
shared_private_link_resource_name: str,
192
*,
193
client_request_id: Optional[str] = None,
194
**kwargs
195
) -> LROPoller[None]:
196
"""
197
Delete a shared private link resource.
198
199
Parameters:
200
resource_group_name (str): Resource group name
201
search_service_name (str): Search service name
202
shared_private_link_resource_name (str): Resource name to delete
203
client_request_id (str, optional): Client-generated request ID
204
205
Returns:
206
LROPoller[None]: Long-running operation for resource deletion
207
"""
208
209
def list_by_service(
210
resource_group_name: str,
211
search_service_name: str,
212
*,
213
client_request_id: Optional[str] = None,
214
**kwargs
215
) -> ItemPaged[SharedPrivateLinkResource]:
216
"""
217
List all shared private link resources for a search service.
218
219
Parameters:
220
resource_group_name (str): Resource group name
221
search_service_name (str): Search service name
222
client_request_id (str, optional): Client-generated request ID
223
224
Returns:
225
ItemPaged[SharedPrivateLinkResource]: All shared private link resources
226
"""
227
```
228
229
**Usage Example:**
230
231
```python
232
from azure.mgmt.search.models import (
233
SharedPrivateLinkResource,
234
SharedPrivateLinkResourceProperties,
235
PrivateEndpointConnection,
236
PrivateEndpointConnectionProperties,
237
PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState,
238
PrivateLinkServiceConnectionStatus
239
)
240
241
# List supported private link resource types
242
supported_resources = client.private_link_resources.list_supported(
243
"my-resource-group",
244
"my-search-service"
245
)
246
for resource in supported_resources:
247
print(f"Supported: {resource.name} - {resource.properties.shareable_private_link_resource_types}")
248
249
# Create shared private link to storage account
250
storage_private_link = SharedPrivateLinkResource(
251
properties=SharedPrivateLinkResourceProperties(
252
private_link_resource_id="/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Storage/storageAccounts/mystorage",
253
group_id="blob",
254
request_message="Please approve this connection for search service"
255
)
256
)
257
258
# Start creation operation
259
create_operation = client.shared_private_link_resources.begin_create_or_update(
260
resource_group_name="my-resource-group",
261
search_service_name="my-search-service",
262
shared_private_link_resource_name="storage-connection",
263
shared_private_link_resource=storage_private_link
264
)
265
266
# Wait for completion
267
shared_resource = create_operation.result()
268
print(f"Shared resource created: {shared_resource.name}")
269
print(f"Status: {shared_resource.properties.status}")
270
271
# List all private endpoint connections
272
pe_connections = client.private_endpoint_connections.list_by_service(
273
"my-resource-group",
274
"my-search-service"
275
)
276
for connection in pe_connections:
277
print(f"PE Connection: {connection.name} - {connection.properties.private_link_service_connection_state.status}")
278
```
279
280
## Data Models
281
282
### PrivateLinkResource
283
284
Describes the types of private link resources supported by the search service.
285
286
```python { .api }
287
class PrivateLinkResource:
288
"""
289
Private link resource type supported by the search service.
290
291
Attributes:
292
id (str): Resource ID
293
name (str): Resource name
294
type (str): Resource type
295
properties (PrivateLinkResourceProperties): Resource properties
296
"""
297
298
class PrivateLinkResourceProperties:
299
"""
300
Properties of a private link resource.
301
302
Attributes:
303
group_id (str): Group ID for the private link resource
304
required_members (List[str]): Required members for the resource
305
required_zone_names (List[str]): Required DNS zone names
306
shareable_private_link_resource_types (List[ShareablePrivateLinkResourceType]): Shareable resource types
307
"""
308
```
309
310
### PrivateEndpointConnection
311
312
Represents a private endpoint connection to the search service.
313
314
```python { .api }
315
class PrivateEndpointConnection:
316
"""
317
Private endpoint connection configuration.
318
319
Attributes:
320
id (str): Connection resource ID
321
name (str): Connection name
322
type (str): Resource type
323
properties (PrivateEndpointConnectionProperties): Connection properties
324
"""
325
326
class PrivateEndpointConnectionProperties:
327
"""
328
Private endpoint connection properties.
329
330
Attributes:
331
private_endpoint (PrivateEndpointConnectionPropertiesPrivateEndpoint): Private endpoint info
332
private_link_service_connection_state (PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState): Connection state
333
provisioning_state (PrivateLinkServiceConnectionProvisioningState): Provisioning state
334
"""
335
336
class PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState:
337
"""
338
Private link service connection state.
339
340
Attributes:
341
status (PrivateLinkServiceConnectionStatus): Connection status
342
description (str): Connection description
343
actions_required (str): Required actions
344
"""
345
```
346
347
### SharedPrivateLinkResource
348
349
Configuration for shared private link resources that connect the search service to other Azure resources.
350
351
```python { .api }
352
class SharedPrivateLinkResource:
353
"""
354
Shared private link resource configuration.
355
356
Attributes:
357
id (str): Resource ID
358
name (str): Resource name
359
type (str): Resource type
360
properties (SharedPrivateLinkResourceProperties): Resource properties
361
"""
362
363
class SharedPrivateLinkResourceProperties:
364
"""
365
Shared private link resource properties.
366
367
Attributes:
368
private_link_resource_id (str): Target resource ID to connect to
369
group_id (str): Group ID of the target resource
370
request_message (str): Message for connection approval
371
resource_region (str): Target resource region
372
status (SharedPrivateLinkResourceStatus): Connection status
373
provisioning_state (SharedPrivateLinkResourceProvisioningState): Provisioning state
374
"""
375
```
376
377
### Connection Status Enums
378
379
```python { .api }
380
class PrivateLinkServiceConnectionStatus(str, Enum):
381
"""Private endpoint connection status values."""
382
PENDING = "pending"
383
APPROVED = "approved"
384
REJECTED = "rejected"
385
DISCONNECTED = "disconnected"
386
387
class PrivateLinkServiceConnectionProvisioningState(str, Enum):
388
"""Private endpoint connection provisioning states."""
389
CREATING = "creating"
390
RUNNING = "running"
391
DELETING = "deleting"
392
FAILED = "failed"
393
SUCCEEDED = "succeeded"
394
INCOMPLETE = "incomplete"
395
UPDATING = "updating"
396
CANCELED = "canceled"
397
398
class SharedPrivateLinkResourceStatus(str, Enum):
399
"""Shared private link resource status values."""
400
PENDING = "pending"
401
APPROVED = "approved"
402
REJECTED = "rejected"
403
DISCONNECTED = "disconnected"
404
405
class SharedPrivateLinkResourceProvisioningState(str, Enum):
406
"""Shared private link resource provisioning states."""
407
UPDATING = "updating"
408
DELETING = "deleting"
409
FAILED = "failed"
410
SUCCEEDED = "succeeded"
411
INCOMPLETE = "incomplete"
412
```
413
414
## Private Networking Scenarios
415
416
### Inbound Private Connectivity
417
418
Allow other Azure resources to connect privately to your search service:
419
420
```python
421
# 1. Check supported private link resource types
422
supported = client.private_link_resources.list_supported("rg", "search-service")
423
424
# 2. Create private endpoint from another resource (typically done via ARM template or Portal)
425
# 3. Monitor and approve private endpoint connections
426
connections = client.private_endpoint_connections.list_by_service("rg", "search-service")
427
for conn in connections:
428
if conn.properties.private_link_service_connection_state.status == "Pending":
429
# Approve the connection
430
conn.properties.private_link_service_connection_state.status = "Approved"
431
conn.properties.private_link_service_connection_state.description = "Approved by automation"
432
433
updated_conn = client.private_endpoint_connections.update(
434
"rg", "search-service", conn.name, conn
435
)
436
```
437
438
### Outbound Private Connectivity
439
440
Allow your search service to connect privately to other Azure resources:
441
442
```python
443
# Connect to Azure Storage for datasource operations
444
storage_connection = SharedPrivateLinkResource(
445
properties=SharedPrivateLinkResourceProperties(
446
private_link_resource_id="/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.Storage/storageAccounts/storage",
447
group_id="blob",
448
request_message="Search service needs access to blob storage"
449
)
450
)
451
452
# Connect to Cosmos DB for datasource operations
453
cosmos_connection = SharedPrivateLinkResource(
454
properties=SharedPrivateLinkResourceProperties(
455
private_link_resource_id="/subscriptions/{sub}/resourceGroups/{rg}/providers/Microsoft.DocumentDB/databaseAccounts/cosmos",
456
group_id="Sql",
457
request_message="Search service needs access to Cosmos DB"
458
)
459
)
460
461
# Create the connections
462
storage_op = client.shared_private_link_resources.begin_create_or_update(
463
"rg", "search-service", "storage-connection", storage_connection
464
)
465
cosmos_op = client.shared_private_link_resources.begin_create_or_update(
466
"rg", "search-service", "cosmos-connection", cosmos_connection
467
)
468
469
# Wait for completion and check status
470
storage_result = storage_op.result()
471
cosmos_result = cosmos_op.result()
472
```