0
# Azure Web Management Client
1
2
A comprehensive Python client library for managing Azure Web Apps and related web services through the Azure Resource Manager API. This library enables developers to programmatically create, configure, deploy, monitor, and manage web applications, API apps, and function apps on the Azure platform.
3
4
## Package Information
5
6
- **Package Name**: azure-mgmt-web
7
- **Language**: Python
8
- **Installation**: `pip install azure-mgmt-web`
9
- **Python Support**: 3.9+
10
- **Azure API Version**: 2024-11-01
11
12
## Core Imports
13
14
```python
15
from azure.mgmt.web import WebSiteManagementClient
16
from azure.identity import DefaultAzureCredential
17
```
18
19
## Basic Usage
20
21
```python
22
from azure.mgmt.web import WebSiteManagementClient
23
from azure.identity import DefaultAzureCredential
24
import os
25
26
# Authentication setup
27
credential = DefaultAzureCredential()
28
subscription_id = os.getenv("AZURE_SUBSCRIPTION_ID")
29
30
# Create the management client
31
client = WebSiteManagementClient(
32
credential=credential,
33
subscription_id=subscription_id
34
)
35
36
# List all web apps in subscription
37
web_apps = client.web_apps.list()
38
for app in web_apps:
39
print(f"App: {app.name}, Resource Group: {app.resource_group}")
40
41
# Get specific web app details
42
app_details = client.web_apps.get(
43
resource_group_name="my-resource-group",
44
name="my-web-app"
45
)
46
47
# Create a new App Service Plan
48
from azure.mgmt.web.models import AppServicePlan, SkuDescription
49
50
plan_params = AppServicePlan(
51
location="East US",
52
sku=SkuDescription(
53
name="B1",
54
tier="Basic",
55
capacity=1
56
)
57
)
58
59
plan = client.app_service_plans.begin_create_or_update(
60
resource_group_name="my-resource-group",
61
name="my-app-service-plan",
62
app_service_plan=plan_params
63
).result()
64
```
65
66
## Architecture
67
68
The Azure Web Management Client is organized around a main client class that provides access to specialized operation classes:
69
70
- **WebSiteManagementClient**: Main client providing authentication and access to all operations
71
- **Operation Classes**: 29 specialized classes handling different aspects of web service management
72
- **Model Classes**: 500+ data structures representing Azure resources, configurations, and responses
73
- **Authentication**: Integration with Azure Identity for secure access to Azure resources
74
75
The client uses the Azure Resource Manager REST API and provides high-level Python abstractions for managing web workloads at enterprise scale.
76
77
## Capabilities
78
79
### Web Applications Management
80
81
Core functionality for managing web applications, including creation, configuration, deployment, scaling, and monitoring. Handles web apps, API apps, and mobile app backends.
82
83
```python { .api }
84
class WebAppsOperations:
85
def create_or_update(
86
self,
87
resource_group_name: str,
88
name: str,
89
site_envelope: Site,
90
**kwargs
91
) -> Site: ...
92
93
def get(
94
self,
95
resource_group_name: str,
96
name: str,
97
**kwargs
98
) -> Site: ...
99
100
def delete(
101
self,
102
resource_group_name: str,
103
name: str,
104
**kwargs
105
) -> None: ...
106
107
def list(self, **kwargs) -> List[Site]: ...
108
109
def restart(
110
self,
111
resource_group_name: str,
112
name: str,
113
**kwargs
114
) -> None: ...
115
```
116
117
[Web Applications](./web-applications.md)
118
119
### Deleted Web Apps Recovery
120
121
Recovery and management of deleted web applications, providing the ability to restore accidentally deleted apps and manage app lifecycle.
122
123
```python { .api }
124
class DeletedWebAppsOperations:
125
def list(self, **kwargs) -> List[DeletedSite]: ...
126
127
def list_by_location(
128
self,
129
location: str,
130
**kwargs
131
) -> List[DeletedSite]: ...
132
133
def get_deleted_web_app_by_location(
134
self,
135
location: str,
136
deleted_site_id: str,
137
**kwargs
138
) -> DeletedSite: ...
139
```
140
141
### App Service Plans Management
142
143
Management of App Service Plans that define the computing resources, scaling options, and pricing tiers for web applications.
144
145
```python { .api }
146
class AppServicePlansOperations:
147
def begin_create_or_update(
148
self,
149
resource_group_name: str,
150
name: str,
151
app_service_plan: AppServicePlan,
152
**kwargs
153
) -> LROPoller[AppServicePlan]: ...
154
155
def get(
156
self,
157
resource_group_name: str,
158
name: str,
159
**kwargs
160
) -> AppServicePlan: ...
161
162
def list(self, **kwargs) -> List[AppServicePlan]: ...
163
164
def list_web_apps(
165
self,
166
resource_group_name: str,
167
name: str,
168
**kwargs
169
) -> List[Site]: ...
170
```
171
172
[App Service Plans](./app-service-plans.md)
173
174
### Certificate and Domain Management
175
176
Comprehensive SSL/TLS certificate and custom domain management including certificate orders, renewals, bindings, and domain registration.
177
178
```python { .api }
179
class CertificatesOperations:
180
def create_or_update(
181
self,
182
resource_group_name: str,
183
name: str,
184
certificate_envelope: Certificate,
185
**kwargs
186
) -> Certificate: ...
187
188
class DomainsOperations:
189
def create_or_update(
190
self,
191
resource_group_name: str,
192
domain_name: str,
193
domain: Domain,
194
**kwargs
195
) -> Domain: ...
196
```
197
198
[Certificates and Domains](./certificates-domains.md)
199
200
### Application Configuration
201
202
Management of application settings, connection strings, authentication, and site configuration including runtime settings, environment variables, and deployment configurations.
203
204
```python { .api }
205
class WebAppsOperations:
206
def list_application_settings(
207
self,
208
resource_group_name: str,
209
name: str,
210
**kwargs
211
) -> StringDictionary: ...
212
213
def update_application_settings(
214
self,
215
resource_group_name: str,
216
name: str,
217
app_settings: StringDictionary,
218
**kwargs
219
) -> StringDictionary: ...
220
221
def get_configuration(
222
self,
223
resource_group_name: str,
224
name: str,
225
**kwargs
226
) -> SiteConfig: ...
227
```
228
229
[Application Configuration](./application-configuration.md)
230
231
### Deployment Management
232
233
Deployment operations including source control integration, continuous deployment, deployment slots, backups, and application deployment from various sources.
234
235
```python { .api }
236
class WebAppsOperations:
237
def list_deployments(
238
self,
239
resource_group_name: str,
240
name: str,
241
**kwargs
242
) -> List[Deployment]: ...
243
244
def create_deployment(
245
self,
246
resource_group_name: str,
247
name: str,
248
id: str,
249
deployment: Deployment,
250
**kwargs
251
) -> Deployment: ...
252
253
def backup(
254
self,
255
resource_group_name: str,
256
name: str,
257
request: BackupRequest,
258
**kwargs
259
) -> BackupItem: ...
260
```
261
262
[Deployment Management](./deployment-management.md)
263
264
### Static Sites Management
265
266
Management of Azure Static Web Apps including build configuration, custom domains, user authentication, and API integration.
267
268
```python { .api }
269
class StaticSitesOperations:
270
def create_or_update_static_site(
271
self,
272
resource_group_name: str,
273
name: str,
274
static_site_envelope: StaticSiteARMResource,
275
**kwargs
276
) -> StaticSiteARMResource: ...
277
278
def get_static_site(
279
self,
280
resource_group_name: str,
281
name: str,
282
**kwargs
283
) -> StaticSiteARMResource: ...
284
```
285
286
[Static Sites](./static-sites.md)
287
288
### Workflow Management
289
290
Logic Apps workflow management including workflow definitions, runs, triggers, actions, and integration with other Azure services.
291
292
```python { .api }
293
class WorkflowsOperations:
294
def create_or_update(
295
self,
296
resource_group_name: str,
297
name: str,
298
workflow_name: str,
299
workflow: Workflow,
300
**kwargs
301
) -> Workflow: ...
302
303
class WorkflowRunsOperations:
304
def list(
305
self,
306
resource_group_name: str,
307
name: str,
308
workflow_name: str,
309
**kwargs
310
) -> List[WorkflowRun]: ...
311
```
312
313
[Workflow Management](./workflow-management.md)
314
315
### Diagnostics and Monitoring
316
317
Diagnostic capabilities, recommendations, health monitoring, and troubleshooting tools for web applications and services.
318
319
```python { .api }
320
class DiagnosticsOperations:
321
def list_hosting_environment_detector_responses(
322
self,
323
resource_group_name: str,
324
name: str,
325
**kwargs
326
) -> List[DetectorResponse]: ...
327
328
class RecommendationsOperations:
329
def list(self, **kwargs) -> List[Recommendation]: ...
330
```
331
332
[Diagnostics and Monitoring](./diagnostics-monitoring.md)
333
334
### Kubernetes Environments
335
336
Management of Kubernetes environments for container-based applications and microservices hosted on Azure Kubernetes Service integration.
337
338
```python { .api }
339
class KubeEnvironmentsOperations:
340
def create_or_update(
341
self,
342
resource_group_name: str,
343
name: str,
344
kube_environment_envelope: KubeEnvironment,
345
**kwargs
346
) -> KubeEnvironment: ...
347
348
def get(
349
self,
350
resource_group_name: str,
351
name: str,
352
**kwargs
353
) -> KubeEnvironment: ...
354
355
def list_by_resource_group(
356
self,
357
resource_group_name: str,
358
**kwargs
359
) -> List[KubeEnvironment]: ...
360
```
361
362
[Kubernetes Environments](./kubernetes-environments.md)
363
364
### App Service Environments
365
366
Management of App Service Environments (ASE) for isolated, high-scale application hosting with advanced networking and security features.
367
368
```python { .api }
369
class AppServiceEnvironmentsOperations:
370
def create_or_update(
371
self,
372
resource_group_name: str,
373
name: str,
374
hosting_environment_envelope: AppServiceEnvironment,
375
**kwargs
376
) -> AppServiceEnvironment: ...
377
```
378
379
[App Service Environments](./app-service-environments.md)
380
381
## Types
382
383
Core types used across the API:
384
385
```python { .api }
386
class WebSiteManagementClient:
387
def __init__(
388
self,
389
credential: TokenCredential,
390
subscription_id: str,
391
base_url: Optional[str] = None,
392
api_version: str = "2024-11-01",
393
**kwargs
394
): ...
395
396
def close(self) -> None: ...
397
398
class Site:
399
"""Represents a web app or function app resource."""
400
id: Optional[str]
401
name: Optional[str]
402
type: Optional[str]
403
location: str
404
resource_group: Optional[str]
405
server_farm_id: Optional[str]
406
enabled: Optional[bool]
407
host_names: Optional[List[str]]
408
repository_site_name: Optional[str]
409
usage_state: Optional[UsageState]
410
site_config: Optional[SiteConfig]
411
412
class AppServicePlan:
413
"""Represents an App Service plan resource."""
414
id: Optional[str]
415
name: Optional[str]
416
type: Optional[str]
417
location: str
418
sku: Optional[SkuDescription]
419
worker_size: Optional[WorkerSizeOptions]
420
number_of_workers: Optional[int]
421
hosting_environment_profile: Optional[HostingEnvironmentProfile]
422
423
class SiteConfig:
424
"""Configuration settings for a web app."""
425
number_of_workers: Optional[int]
426
default_documents: Optional[List[str]]
427
net_framework_version: Optional[str]
428
php_version: Optional[str]
429
python_version: Optional[str]
430
node_version: Optional[str]
431
linux_fx_version: Optional[str]
432
windows_fx_version: Optional[str]
433
request_tracing_enabled: Optional[bool]
434
http_logging_enabled: Optional[bool]
435
logs_directory_size_limit: Optional[int]
436
detailed_error_logging_enabled: Optional[bool]
437
app_settings: Optional[List[NameValuePair]]
438
connection_strings: Optional[List[ConnStringInfo]]
439
440
class DeletedSite:
441
"""Represents a deleted web application that can be restored."""
442
id: Optional[str]
443
name: Optional[str]
444
type: Optional[str]
445
deleted_site_id: Optional[str]
446
deleted_timestamp: Optional[str]
447
subscription: Optional[str]
448
resource_group: Optional[str]
449
deleted_site_name: Optional[str]
450
slot: Optional[str]
451
kind: Optional[str]
452
geo_region_name: Optional[str]
453
454
class KubeEnvironment:
455
"""Represents a Kubernetes environment for container apps."""
456
id: Optional[str]
457
name: Optional[str]
458
type: Optional[str]
459
location: str
460
kind: Optional[str]
461
provisioning_state: Optional[str]
462
deployment_errors: Optional[str]
463
is_internal: Optional[bool]
464
default_domain: Optional[str]
465
static_ip: Optional[str]
466
container_apps_configuration: Optional[ContainerAppsConfiguration]
467
app_logs_configuration: Optional[AppLogsConfiguration]
468
```