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

app-service-environments.mddocs/

0

# App Service Environments

1

2

Management of App Service Environments (ASE) for isolated, high-scale application hosting with advanced networking and security features.

3

4

## Package Information

5

6

- **Package**: azure-mgmt-web

7

- **Module**: `azure.mgmt.web.operations.AppServiceEnvironmentsOperations`

8

- **Access**: `client.app_service_environments`

9

10

## Core Imports

11

12

```python

13

from azure.mgmt.web import WebSiteManagementClient

14

from azure.mgmt.web.models import (

15

AppServiceEnvironment, AppServiceEnvironmentResource,

16

VirtualNetworkProfile, WorkerPool, HostingEnvironmentProfile

17

)

18

from azure.identity import DefaultAzureCredential

19

```

20

21

## Basic Usage

22

23

```python

24

from azure.mgmt.web import WebSiteManagementClient

25

from azure.identity import DefaultAzureCredential

26

27

credential = DefaultAzureCredential()

28

client = WebSiteManagementClient(credential, subscription_id)

29

30

# List all App Service Environments

31

ases = client.app_service_environments.list()

32

for ase in ases:

33

print(f"ASE: {ase.name}, Location: {ase.location}, Status: {ase.status}")

34

35

# Get specific ASE details

36

ase_details = client.app_service_environments.get(

37

resource_group_name="my-resource-group",

38

name="my-ase"

39

)

40

print(f"ASE Kind: {ase_details.kind}, Max Workers: {ase_details.maximum_number_of_machines}")

41

```

42

43

## App Service Environment Management

44

45

### Create or Update App Service Environment

46

47

Create a new ASE or update an existing one.

48

49

```python { .api }

50

def create_or_update(

51

self,

52

resource_group_name: str,

53

name: str,

54

hosting_environment_envelope: AppServiceEnvironment,

55

**kwargs

56

) -> AppServiceEnvironment:

57

"""

58

Create or update an App Service Environment.

59

60

Args:

61

resource_group_name: Name of the resource group

62

name: Name of the App Service Environment

63

hosting_environment_envelope: ASE configuration

64

65

Returns:

66

AppServiceEnvironment object

67

"""

68

```

69

70

**Usage Example:**

71

72

```python

73

from azure.mgmt.web.models import (

74

AppServiceEnvironment, VirtualNetworkProfile, WorkerPool

75

)

76

77

# Configure ASE settings

78

vnet_profile = VirtualNetworkProfile(

79

id="/subscriptions/{subscription-id}/resourceGroups/{rg}/providers/Microsoft.Network/virtualNetworks/{vnet-name}",

80

subnet="/subscriptions/{subscription-id}/resourceGroups/{rg}/providers/Microsoft.Network/virtualNetworks/{vnet-name}/subnets/{subnet-name}"

81

)

82

83

worker_pools = [

84

WorkerPool(

85

worker_size_id=0, # Small

86

compute_mode="Shared", # Shared or Dedicated

87

worker_size="Small",

88

worker_count=2

89

),

90

WorkerPool(

91

worker_size_id=1, # Medium

92

compute_mode="Dedicated",

93

worker_size="Medium",

94

worker_count=0

95

),

96

WorkerPool(

97

worker_size_id=2, # Large

98

compute_mode="Dedicated",

99

worker_size="Large",

100

worker_count=0

101

)

102

]

103

104

ase_config = AppServiceEnvironment(

105

location="East US",

106

kind="ASEV2", # ASEV2 or ASEV3

107

virtual_network=vnet_profile,

108

internal_load_balancing_mode="Web", # None, Web, Publishing, or WebPublishing

109

multi_size="Standard_D1_v2",

110

multi_role_count=2,

111

worker_pools=worker_pools,

112

dns_suffix="myase.appserviceenvironment.net",

113

network_access_control_list=[

114

{

115

"action": "Permit",

116

"description": "Allow management traffic",

117

"order": 100,

118

"remote_subnet": "10.0.0.0/24"

119

}

120

]

121

)

122

123

# Create ASE (this is a long-running operation)

124

ase = client.app_service_environments.create_or_update(

125

resource_group_name="my-resource-group",

126

name="my-ase",

127

hosting_environment_envelope=ase_config

128

)

129

```

130

131

### Get App Service Environment

132

133

Retrieve details for a specific ASE.

134

135

```python { .api }

136

def get(

137

self,

138

resource_group_name: str,

139

name: str,

140

**kwargs

141

) -> AppServiceEnvironment:

142

"""

143

Get App Service Environment details.

144

145

Args:

146

resource_group_name: Name of the resource group

147

name: Name of the App Service Environment

148

149

Returns:

150

AppServiceEnvironment object

151

"""

152

```

153

154

### List App Service Environments

155

156

Get all ASEs in a subscription or resource group.

157

158

```python { .api }

159

def list(self, **kwargs) -> List[AppServiceEnvironment]:

160

"""

161

List all App Service Environments in the subscription.

162

163

Returns:

164

List of AppServiceEnvironment objects

165

"""

166

167

def list_by_resource_group(

168

self,

169

resource_group_name: str,

170

**kwargs

171

) -> List[AppServiceEnvironment]:

172

"""

173

List App Service Environments in a resource group.

174

175

Args:

176

resource_group_name: Name of the resource group

177

178

Returns:

179

List of AppServiceEnvironment objects

180

"""

181

```

182

183

### Delete App Service Environment

184

185

Remove an App Service Environment.

186

187

```python { .api }

188

def delete(

189

self,

190

resource_group_name: str,

191

name: str,

192

**kwargs

193

) -> None:

194

"""

195

Delete an App Service Environment.

196

197

Args:

198

resource_group_name: Name of the resource group

199

name: Name of the App Service Environment

200

"""

201

```

202

203

## Worker Pool Management

204

205

### List Worker Pools

206

207

Get all worker pools in an ASE.

208

209

```python { .api }

210

def list_worker_pools(

211

self,

212

resource_group_name: str,

213

name: str,

214

**kwargs

215

) -> List[WorkerPoolResource]:

216

"""

217

List worker pools in the App Service Environment.

218

219

Args:

220

resource_group_name: Name of the resource group

221

name: Name of the App Service Environment

222

223

Returns:

224

List of WorkerPoolResource objects

225

"""

226

```

227

228

### Get Worker Pool

229

230

Retrieve details for a specific worker pool.

231

232

```python { .api }

233

def get_worker_pool(

234

self,

235

resource_group_name: str,

236

name: str,

237

worker_pool_name: str,

238

**kwargs

239

) -> WorkerPoolResource:

240

"""

241

Get worker pool details.

242

243

Args:

244

resource_group_name: Name of the resource group

245

name: Name of the App Service Environment

246

worker_pool_name: Name of the worker pool

247

248

Returns:

249

WorkerPoolResource object

250

"""

251

```

252

253

### Update Worker Pool

254

255

Modify worker pool configuration.

256

257

```python { .api }

258

def create_or_update_worker_pool(

259

self,

260

resource_group_name: str,

261

name: str,

262

worker_pool_name: str,

263

worker_pool_envelope: WorkerPoolResource,

264

**kwargs

265

) -> WorkerPoolResource:

266

"""

267

Create or update a worker pool.

268

269

Args:

270

resource_group_name: Name of the resource group

271

name: Name of the App Service Environment

272

worker_pool_name: Name of the worker pool

273

worker_pool_envelope: Worker pool configuration

274

275

Returns:

276

WorkerPoolResource object

277

"""

278

```

279

280

**Usage Example:**

281

282

```python

283

# List worker pools

284

worker_pools = client.app_service_environments.list_worker_pools(

285

resource_group_name="my-resource-group",

286

name="my-ase"

287

)

288

289

for pool in worker_pools:

290

print(f"Pool: {pool.name}, Size: {pool.worker_size}, Count: {pool.worker_count}")

291

292

# Update worker pool to scale up

293

from azure.mgmt.web.models import WorkerPoolResource

294

295

updated_pool = WorkerPoolResource(

296

worker_size="Medium",

297

worker_count=4,

298

compute_mode="Dedicated"

299

)

300

301

client.app_service_environments.create_or_update_worker_pool(

302

resource_group_name="my-resource-group",

303

name="my-ase",

304

worker_pool_name="1", # Worker pool ID (0, 1, 2)

305

worker_pool_envelope=updated_pool

306

)

307

```

308

309

## Multi-Role Pool Management

310

311

### Get Multi-Role Pool

312

313

Retrieve the multi-role pool configuration.

314

315

```python { .api }

316

def get_multi_role_pool(

317

self,

318

resource_group_name: str,

319

name: str,

320

**kwargs

321

) -> WorkerPoolResource:

322

"""

323

Get multi-role pool details.

324

325

Args:

326

resource_group_name: Name of the resource group

327

name: Name of the App Service Environment

328

329

Returns:

330

WorkerPoolResource object representing the multi-role pool

331

"""

332

```

333

334

### Update Multi-Role Pool

335

336

Modify the multi-role pool configuration.

337

338

```python { .api }

339

def create_or_update_multi_role_pool(

340

self,

341

resource_group_name: str,

342

name: str,

343

multi_role_pool_envelope: WorkerPoolResource,

344

**kwargs

345

) -> WorkerPoolResource:

346

"""

347

Create or update the multi-role pool.

348

349

Args:

350

resource_group_name: Name of the resource group

351

name: Name of the App Service Environment

352

multi_role_pool_envelope: Multi-role pool configuration

353

354

Returns:

355

WorkerPoolResource object

356

"""

357

```

358

359

## ASE Networking

360

361

### List Inbound Network Dependencies

362

363

Get inbound network dependencies for the ASE.

364

365

```python { .api }

366

def list_inbound_network_dependencies_endpoints(

367

self,

368

resource_group_name: str,

369

name: str,

370

**kwargs

371

) -> List[InboundEnvironmentEndpoint]:

372

"""

373

List inbound network dependencies.

374

375

Args:

376

resource_group_name: Name of the resource group

377

name: Name of the App Service Environment

378

379

Returns:

380

List of InboundEnvironmentEndpoint objects

381

"""

382

```

383

384

### List Outbound Network Dependencies

385

386

Get outbound network dependencies for the ASE.

387

388

```python { .api }

389

def list_outbound_network_dependencies_endpoints(

390

self,

391

resource_group_name: str,

392

name: str,

393

**kwargs

394

) -> List[OutboundEnvironmentEndpoint]:

395

"""

396

List outbound network dependencies.

397

398

Args:

399

resource_group_name: Name of the resource group

400

name: Name of the App Service Environment

401

402

Returns:

403

List of OutboundEnvironmentEndpoint objects

404

"""

405

```

406

407

**Usage Example:**

408

409

```python

410

# Check inbound network dependencies

411

inbound_deps = client.app_service_environments.list_inbound_network_dependencies_endpoints(

412

resource_group_name="my-resource-group",

413

name="my-ase"

414

)

415

416

for dep in inbound_deps:

417

print(f"Inbound: {dep.description}")

418

for endpoint in dep.endpoints:

419

print(f" - {endpoint}")

420

421

# Check outbound network dependencies

422

outbound_deps = client.app_service_environments.list_outbound_network_dependencies_endpoints(

423

resource_group_name="my-resource-group",

424

name="my-ase"

425

)

426

427

for dep in outbound_deps:

428

print(f"Outbound: {dep.category}")

429

for endpoint in dep.endpoints:

430

print(f" - {endpoint.domain_name}:{endpoint.port}")

431

```

432

433

## ASE Operations

434

435

### Suspend App Service Environment

436

437

Temporarily suspend an ASE.

438

439

```python { .api }

440

def suspend(

441

self,

442

resource_group_name: str,

443

name: str,

444

**kwargs

445

) -> List[Site]:

446

"""

447

Suspend an App Service Environment.

448

449

Args:

450

resource_group_name: Name of the resource group

451

name: Name of the App Service Environment

452

453

Returns:

454

List of Site objects (apps in the ASE)

455

"""

456

```

457

458

### Resume App Service Environment

459

460

Resume a suspended ASE.

461

462

```python { .api }

463

def resume(

464

self,

465

resource_group_name: str,

466

name: str,

467

**kwargs

468

) -> List[Site]:

469

"""

470

Resume an App Service Environment.

471

472

Args:

473

resource_group_name: Name of the resource group

474

name: Name of the App Service Environment

475

476

Returns:

477

List of Site objects (apps in the ASE)

478

"""

479

```

480

481

### Reboot ASE

482

483

Restart an App Service Environment.

484

485

```python { .api }

486

def reboot(

487

self,

488

resource_group_name: str,

489

name: str,

490

**kwargs

491

) -> None:

492

"""

493

Reboot an App Service Environment.

494

495

Args:

496

resource_group_name: Name of the resource group

497

name: Name of the App Service Environment

498

"""

499

```

500

501

**Usage Example:**

502

503

```python

504

# Suspend ASE for maintenance

505

suspended_apps = client.app_service_environments.suspend(

506

resource_group_name="my-resource-group",

507

name="my-ase"

508

)

509

print(f"Suspended ASE with {len(suspended_apps)} apps")

510

511

# Resume ASE after maintenance

512

resumed_apps = client.app_service_environments.resume(

513

resource_group_name="my-resource-group",

514

name="my-ase"

515

)

516

print(f"Resumed ASE with {len(resumed_apps)} apps")

517

```

518

519

## ASE App Management

520

521

### List Apps in ASE

522

523

Get all applications hosted in the ASE.

524

525

```python { .api }

526

def list_web_apps(

527

self,

528

resource_group_name: str,

529

name: str,

530

**kwargs

531

) -> List[Site]:

532

"""

533

List web apps in the App Service Environment.

534

535

Args:

536

resource_group_name: Name of the resource group

537

name: Name of the App Service Environment

538

539

Returns:

540

List of Site objects

541

"""

542

```

543

544

### List App Service Plans in ASE

545

546

Get all App Service Plans in the ASE.

547

548

```python { .api }

549

def list_app_service_plans(

550

self,

551

resource_group_name: str,

552

name: str,

553

**kwargs

554

) -> List[AppServicePlan]:

555

"""

556

List App Service Plans in the App Service Environment.

557

558

Args:

559

resource_group_name: Name of the resource group

560

name: Name of the App Service Environment

561

562

Returns:

563

List of AppServicePlan objects

564

"""

565

```

566

567

## Types

568

569

### AppServiceEnvironment

570

571

```python { .api }

572

class AppServiceEnvironment:

573

"""Represents an App Service Environment."""

574

id: Optional[str]

575

name: Optional[str]

576

type: Optional[str]

577

location: str

578

tags: Optional[Dict[str, str]]

579

kind: Optional[str] # ASEV2, ASEV3

580

provisioning_state: Optional[str]

581

status: Optional[str] # Preparing, Ready, Scaling, Deleting

582

virtual_network: Optional[VirtualNetworkProfile]

583

internal_load_balancing_mode: Optional[str] # None, Web, Publishing, WebPublishing

584

multi_size: Optional[str] # VM size for multi-role pool

585

multi_role_count: Optional[int]

586

worker_pools: Optional[List[WorkerPool]]

587

ipssl_address_count: Optional[int]

588

dns_suffix: Optional[str]

589

maximum_number_of_machines: Optional[int]

590

front_end_scale_factor: Optional[int]

591

network_access_control_list: Optional[List[NetworkAccessControlEntry]]

592

user_whitelisted_ip_ranges: Optional[List[str]]

593

has_linux_workers: Optional[bool]

594

upgrade_preference: Optional[str] # None, Early, Late, Manual

595

```

596

597

### WorkerPool

598

599

```python { .api }

600

class WorkerPool:

601

"""Represents a worker pool in an ASE."""

602

worker_size_id: Optional[int] # 0=Small, 1=Medium, 2=Large

603

compute_mode: Optional[str] # Shared, Dedicated

604

worker_size: Optional[str] # Small, Medium, Large, ExtraLarge

605

worker_count: Optional[int]

606

instance_names: Optional[List[str]]

607

```

608

609

### VirtualNetworkProfile

610

611

```python { .api }

612

class VirtualNetworkProfile:

613

"""Virtual network configuration for ASE."""

614

id: Optional[str] # Virtual network resource ID

615

name: Optional[str]

616

type: Optional[str]

617

subnet: Optional[str] # Subnet resource ID

618

```

619

620

### WorkerPoolResource

621

622

```python { .api }

623

class WorkerPoolResource:

624

"""Worker pool resource representation."""

625

id: Optional[str]

626

name: Optional[str]

627

type: Optional[str]

628

worker_size_id: Optional[int]

629

compute_mode: Optional[str]

630

worker_size: Optional[str]

631

worker_count: Optional[int]

632

instance_names: Optional[List[str]]

633

sku: Optional[SkuDescription]

634

```

635

636

### InboundEnvironmentEndpoint

637

638

```python { .api }

639

class InboundEnvironmentEndpoint:

640

"""Inbound network endpoint information."""

641

description: Optional[str]

642

endpoints: Optional[List[str]]

643

ports: Optional[List[str]]

644

```

645

646

### OutboundEnvironmentEndpoint

647

648

```python { .api }

649

class OutboundEnvironmentEndpoint:

650

"""Outbound network endpoint information."""

651

category: Optional[str]

652

endpoints: Optional[List[EndpointDependency]]

653

```

654

655

### EndpointDependency

656

657

```python { .api }

658

class EndpointDependency:

659

"""Network endpoint dependency."""

660

domain_name: Optional[str]

661

endpoint_details: Optional[List[EndpointDetail]]

662

```