or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

app-service-environments.mdapp-service-plans.mdapplication-configuration.mdcertificates-domains.mddeployment-management.mddiagnostics-monitoring.mdindex.mdkubernetes-environments.mdstatic-sites.mdweb-applications.mdworkflow-management.md

web-applications.mddocs/

0

# Web Applications Management

1

2

Core functionality for managing Azure Web Apps, API Apps, and mobile app backends. This includes creation, configuration, deployment, scaling, monitoring, and lifecycle management of web applications hosted on Azure App Service.

3

4

## Capabilities

5

6

### Application Lifecycle Management

7

8

Create, update, delete, and manage the lifecycle of web applications with comprehensive configuration options.

9

10

```python { .api }

11

def create_or_update(

12

resource_group_name: str,

13

name: str,

14

site_envelope: Site,

15

**kwargs

16

) -> Site:

17

"""

18

Creates a new web app or updates an existing one.

19

20

Parameters:

21

- resource_group_name (str): Name of the resource group

22

- name (str): Name of the web app

23

- site_envelope (Site): Web app configuration and properties

24

25

Returns:

26

Site: The created or updated web app resource

27

"""

28

29

def get(

30

resource_group_name: str,

31

name: str,

32

**kwargs

33

) -> Site:

34

"""

35

Gets details of a specific web app.

36

37

Parameters:

38

- resource_group_name (str): Name of the resource group

39

- name (str): Name of the web app

40

41

Returns:

42

Site: Web app details and configuration

43

"""

44

45

def delete(

46

resource_group_name: str,

47

name: str,

48

delete_metrics: Optional[bool] = None,

49

delete_empty_server_farm: Optional[bool] = None,

50

**kwargs

51

) -> None:

52

"""

53

Deletes a web app, deployment slot, or specific version.

54

55

Parameters:

56

- resource_group_name (str): Name of the resource group

57

- name (str): Name of the web app

58

- delete_metrics (bool, optional): Delete metrics if true

59

- delete_empty_server_farm (bool, optional): Delete server farm if empty

60

"""

61

62

def list(

63

**kwargs

64

) -> List[Site]:

65

"""

66

Lists all web apps in the subscription.

67

68

Returns:

69

List[Site]: List of all web apps

70

"""

71

72

def list_by_resource_group(

73

resource_group_name: str,

74

include_slots: Optional[bool] = None,

75

**kwargs

76

) -> List[Site]:

77

"""

78

Lists web apps in a specific resource group.

79

80

Parameters:

81

- resource_group_name (str): Name of the resource group

82

- include_slots (bool, optional): Include deployment slots

83

84

Returns:

85

List[Site]: List of web apps in the resource group

86

"""

87

88

def update(

89

resource_group_name: str,

90

name: str,

91

site_envelope: SitePatchResource,

92

**kwargs

93

) -> Site:

94

"""

95

Updates an existing web app with patch operations.

96

97

Parameters:

98

- resource_group_name (str): Name of the resource group

99

- name (str): Name of the web app

100

- site_envelope (SitePatchResource): Properties to update

101

102

Returns:

103

Site: Updated web app resource

104

"""

105

```

106

107

### Application Control Operations

108

109

Start, stop, restart web applications and manage their operational state.

110

111

```python { .api }

112

def start(

113

resource_group_name: str,

114

name: str,

115

**kwargs

116

) -> None:

117

"""

118

Starts a stopped web app.

119

120

Parameters:

121

- resource_group_name (str): Name of the resource group

122

- name (str): Name of the web app

123

"""

124

125

def stop(

126

resource_group_name: str,

127

name: str,

128

**kwargs

129

) -> None:

130

"""

131

Stops a running web app.

132

133

Parameters:

134

- resource_group_name (str): Name of the resource group

135

- name (str): Name of the web app

136

"""

137

138

def restart(

139

resource_group_name: str,

140

name: str,

141

soft_restart: Optional[bool] = None,

142

synchronous: Optional[bool] = None,

143

**kwargs

144

) -> None:

145

"""

146

Restarts a web app.

147

148

Parameters:

149

- resource_group_name (str): Name of the resource group

150

- name (str): Name of the web app

151

- soft_restart (bool, optional): Perform soft restart if true

152

- synchronous (bool, optional): Wait for restart completion if true

153

"""

154

```

155

156

### Application Settings and Configuration

157

158

Manage application settings, connection strings, and site configuration.

159

160

```python { .api }

161

def list_application_settings(

162

resource_group_name: str,

163

name: str,

164

**kwargs

165

) -> StringDictionary:

166

"""

167

Gets application settings for a web app.

168

169

Parameters:

170

- resource_group_name (str): Name of the resource group

171

- name (str): Name of the web app

172

173

Returns:

174

StringDictionary: Application settings key-value pairs

175

"""

176

177

def update_application_settings(

178

resource_group_name: str,

179

name: str,

180

app_settings: StringDictionary,

181

**kwargs

182

) -> StringDictionary:

183

"""

184

Updates application settings for a web app.

185

186

Parameters:

187

- resource_group_name (str): Name of the resource group

188

- name (str): Name of the web app

189

- app_settings (StringDictionary): New application settings

190

191

Returns:

192

StringDictionary: Updated application settings

193

"""

194

195

def list_connection_strings(

196

resource_group_name: str,

197

name: str,

198

**kwargs

199

) -> ConnectionStringDictionary:

200

"""

201

Gets connection strings for a web app.

202

203

Parameters:

204

- resource_group_name (str): Name of the resource group

205

- name (str): Name of the web app

206

207

Returns:

208

ConnectionStringDictionary: Connection strings configuration

209

"""

210

211

def update_connection_strings(

212

resource_group_name: str,

213

name: str,

214

connection_strings: ConnectionStringDictionary,

215

**kwargs

216

) -> ConnectionStringDictionary:

217

"""

218

Updates connection strings for a web app.

219

220

Parameters:

221

- resource_group_name (str): Name of the resource group

222

- name (str): Name of the web app

223

- connection_strings (ConnectionStringDictionary): New connection strings

224

225

Returns:

226

ConnectionStringDictionary: Updated connection strings

227

"""

228

229

def get_configuration(

230

resource_group_name: str,

231

name: str,

232

**kwargs

233

) -> SiteConfig:

234

"""

235

Gets site configuration for a web app.

236

237

Parameters:

238

- resource_group_name (str): Name of the resource group

239

- name (str): Name of the web app

240

241

Returns:

242

SiteConfig: Site configuration settings

243

"""

244

245

def update_configuration(

246

resource_group_name: str,

247

name: str,

248

site_config: SiteConfig,

249

**kwargs

250

) -> SiteConfig:

251

"""

252

Updates site configuration for a web app.

253

254

Parameters:

255

- resource_group_name (str): Name of the resource group

256

- name (str): Name of the web app

257

- site_config (SiteConfig): New site configuration settings

258

259

Returns:

260

SiteConfig: Updated site configuration

261

"""

262

```

263

264

### Deployment Operations

265

266

Manage application deployments, source control, and backup operations.

267

268

```python { .api }

269

def list_deployments(

270

resource_group_name: str,

271

name: str,

272

**kwargs

273

) -> List[Deployment]:

274

"""

275

Lists deployments for a web app.

276

277

Parameters:

278

- resource_group_name (str): Name of the resource group

279

- name (str): Name of the web app

280

281

Returns:

282

List[Deployment]: List of deployments

283

"""

284

285

def create_deployment(

286

resource_group_name: str,

287

name: str,

288

id: str,

289

deployment: Deployment,

290

**kwargs

291

) -> Deployment:

292

"""

293

Creates a deployment for a web app.

294

295

Parameters:

296

- resource_group_name (str): Name of the resource group

297

- name (str): Name of the web app

298

- id (str): Deployment ID

299

- deployment (Deployment): Deployment configuration

300

301

Returns:

302

Deployment: Created deployment

303

"""

304

305

def sync_repository(

306

resource_group_name: str,

307

name: str,

308

**kwargs

309

) -> None:

310

"""

311

Synchronizes repository for continuous deployment.

312

313

Parameters:

314

- resource_group_name (str): Name of the resource group

315

- name (str): Name of the web app

316

"""

317

318

def backup(

319

resource_group_name: str,

320

name: str,

321

request: BackupRequest,

322

**kwargs

323

) -> BackupItem:

324

"""

325

Creates a backup of a web app.

326

327

Parameters:

328

- resource_group_name (str): Name of the resource group

329

- name (str): Name of the web app

330

- request (BackupRequest): Backup configuration

331

332

Returns:

333

BackupItem: Backup information

334

"""

335

336

def restore(

337

resource_group_name: str,

338

name: str,

339

backup_id: str,

340

request: RestoreRequest,

341

**kwargs

342

) -> None:

343

"""

344

Restores a web app from backup.

345

346

Parameters:

347

- resource_group_name (str): Name of the resource group

348

- name (str): Name of the web app

349

- backup_id (str): Backup identifier

350

- request (RestoreRequest): Restore configuration

351

"""

352

```

353

354

### Deployment Slots Management

355

356

Manage deployment slots for staging and production deployments.

357

358

```python { .api }

359

def create_or_update_slot(

360

resource_group_name: str,

361

name: str,

362

slot: str,

363

site_envelope: Site,

364

**kwargs

365

) -> Site:

366

"""

367

Creates or updates a deployment slot.

368

369

Parameters:

370

- resource_group_name (str): Name of the resource group

371

- name (str): Name of the web app

372

- slot (str): Name of the deployment slot

373

- site_envelope (Site): Slot configuration

374

375

Returns:

376

Site: Created or updated deployment slot

377

"""

378

379

def get_slot(

380

resource_group_name: str,

381

name: str,

382

slot: str,

383

**kwargs

384

) -> Site:

385

"""

386

Gets details of a deployment slot.

387

388

Parameters:

389

- resource_group_name (str): Name of the resource group

390

- name (str): Name of the web app

391

- slot (str): Name of the deployment slot

392

393

Returns:

394

Site: Deployment slot details

395

"""

396

397

def swap_slot(

398

resource_group_name: str,

399

name: str,

400

slot_swap_entity: CsmSlotEntity,

401

**kwargs

402

) -> None:

403

"""

404

Swaps deployment slots (e.g., staging to production).

405

406

Parameters:

407

- resource_group_name (str): Name of the resource group

408

- name (str): Name of the web app

409

- slot_swap_entity (CsmSlotEntity): Slot swap configuration

410

"""

411

```

412

413

## Deleted Web Apps Recovery

414

415

Azure provides the ability to recover accidentally deleted web applications within a retention period.

416

417

### List Deleted Web Apps

418

419

Retrieve all deleted web applications available for recovery.

420

421

```python { .api }

422

def list_deleted(self, **kwargs) -> List[DeletedSite]:

423

"""

424

List all deleted web apps in the subscription.

425

426

Returns:

427

List of DeletedSite objects

428

"""

429

430

def list_deleted_by_location(

431

self,

432

location: str,

433

**kwargs

434

) -> List[DeletedSite]:

435

"""

436

List deleted web apps in a specific location.

437

438

Args:

439

location: Azure region name

440

441

Returns:

442

List of DeletedSite objects

443

"""

444

```

445

446

### Get Deleted Web App Details

447

448

Retrieve details for a specific deleted web application.

449

450

```python { .api }

451

def get_deleted_web_app_by_location(

452

self,

453

location: str,

454

deleted_site_id: str,

455

**kwargs

456

) -> DeletedSite:

457

"""

458

Get details for a deleted web app.

459

460

Args:

461

location: Azure region where the app was deleted

462

deleted_site_id: ID of the deleted site

463

464

Returns:

465

DeletedSite object with recovery information

466

"""

467

```

468

469

**Usage Example:**

470

471

```python

472

# List all deleted web apps

473

deleted_apps = client.deleted_web_apps.list_deleted()

474

475

for app in deleted_apps:

476

print(f"Deleted App: {app.deleted_site_name}")

477

print(f"Deleted Time: {app.deleted_timestamp}")

478

print(f"Resource Group: {app.resource_group}")

479

print(f"Location: {app.geo_region_name}")

480

481

# List deleted apps in specific region

482

deleted_east_us = client.deleted_web_apps.list_deleted_by_location(

483

location="East US"

484

)

485

486

# Get specific deleted app details

487

deleted_app_details = client.deleted_web_apps.get_deleted_web_app_by_location(

488

location="East US",

489

deleted_site_id="deleted-app-12345"

490

)

491

492

# To restore a deleted web app, use the regular create_or_update operation

493

# with the same name and resource group as the deleted app

494

```

495

496

**Note:** Deleted web apps are retained for approximately 30 days and can be restored by creating a new web app with the same name in the same resource group and location. The restoration process will automatically recover the app's configuration and content if still available.

497

498

## Types

499

500

```python { .api }

501

class Site:

502

"""Represents a web app resource."""

503

id: Optional[str]

504

name: Optional[str]

505

type: Optional[str]

506

location: str

507

tags: Optional[Dict[str, str]]

508

server_farm_id: Optional[str]

509

enabled: Optional[bool]

510

host_names: Optional[List[str]]

511

host_names_disabled: Optional[bool]

512

enabled_host_names: Optional[List[str]]

513

availability_state: Optional[SiteAvailabilityState]

514

state: Optional[str]

515

usage_state: Optional[UsageState]

516

site_config: Optional[SiteConfig]

517

reserved: Optional[bool]

518

is_xenon: Optional[bool]

519

hyper_v: Optional[bool]

520

client_affinity_enabled: Optional[bool]

521

client_cert_enabled: Optional[bool]

522

https_only: Optional[bool]

523

redundancy_mode: Optional[RedundancyMode]

524

525

class SitePatchResource:

526

"""Properties for updating a web app."""

527

enabled: Optional[bool]

528

host_names_disabled: Optional[bool]

529

server_farm_id: Optional[str]

530

site_config: Optional[SiteConfig]

531

client_affinity_enabled: Optional[bool]

532

client_cert_enabled: Optional[bool]

533

https_only: Optional[bool]

534

535

class StringDictionary:

536

"""Dictionary of string key-value pairs."""

537

properties: Optional[Dict[str, str]]

538

539

class ConnectionStringDictionary:

540

"""Dictionary of connection strings."""

541

properties: Optional[Dict[str, ConnStringValueTypePair]]

542

543

class ConnStringValueTypePair:

544

"""Connection string value and type pair."""

545

value: str

546

type: ConnectionStringType

547

548

class BackupRequest:

549

"""Request for creating a backup."""

550

backup_name: Optional[str]

551

enabled: Optional[bool]

552

storage_account_url: str

553

backup_schedule: Optional[BackupSchedule]

554

555

class RestoreRequest:

556

"""Request for restoring from backup."""

557

storage_account_url: str

558

blob_name: Optional[str]

559

overwrite: bool

560

site_name: Optional[str]

561

operation_type: BackupRestoreOperationType

562

563

class CsmSlotEntity:

564

"""Slot swap configuration."""

565

target_slot: str

566

preserve_vnet: bool

567

568

class DeletedSite:

569

"""Represents a deleted web application that can be restored."""

570

id: Optional[str]

571

name: Optional[str]

572

type: Optional[str]

573

deleted_site_id: Optional[str]

574

deleted_timestamp: Optional[str]

575

subscription: Optional[str]

576

resource_group: Optional[str]

577

deleted_site_name: Optional[str]

578

slot: Optional[str]

579

kind: Optional[str]

580

geo_region_name: Optional[str]

581

```