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

static-sites.mddocs/

0

# Static Sites Management

1

2

Management of Azure Static Web Apps including build configuration, custom domains, user authentication, and API integration.

3

4

## Package Information

5

6

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

7

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

8

- **Access**: `client.static_sites`

9

10

## Core Imports

11

12

```python

13

from azure.mgmt.web import WebSiteManagementClient

14

from azure.mgmt.web.models import (

15

StaticSiteARMResource, StaticSiteBuildARMResource,

16

StaticSiteUserARMResource, StaticSiteCustomDomainOverviewARMResource

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 static sites in subscription

31

static_sites = client.static_sites.list()

32

for site in static_sites:

33

print(f"Site: {site.name}, Location: {site.location}")

34

35

# Get specific static site details

36

site_details = client.static_sites.get_static_site(

37

resource_group_name="my-resource-group",

38

name="my-static-site"

39

)

40

print(f"Default hostname: {site_details.default_hostname}")

41

```

42

43

## Static Site Management

44

45

### Create or Update Static Site

46

47

Create a new static web app or update an existing one.

48

49

```python { .api }

50

def create_or_update_static_site(

51

self,

52

resource_group_name: str,

53

name: str,

54

static_site_envelope: StaticSiteARMResource,

55

**kwargs

56

) -> StaticSiteARMResource:

57

"""

58

Create or update a static site.

59

60

Args:

61

resource_group_name: Name of the resource group

62

name: Name of the static site

63

static_site_envelope: Static site configuration

64

65

Returns:

66

StaticSiteARMResource object

67

"""

68

```

69

70

**Usage Example:**

71

72

```python

73

from azure.mgmt.web.models import StaticSiteARMResource, StaticSiteBuildProperties

74

75

# Create a new static site

76

static_site_config = StaticSiteARMResource(

77

location="Central US",

78

sku=SkuDescription(name="Free", tier="Free"),

79

repository_url="https://github.com/user/my-static-site",

80

branch="main",

81

build_properties=StaticSiteBuildProperties(

82

app_location="/",

83

api_location="api",

84

output_location="dist"

85

)

86

)

87

88

static_site = client.static_sites.create_or_update_static_site(

89

resource_group_name="my-resource-group",

90

name="my-static-site",

91

static_site_envelope=static_site_config

92

)

93

print(f"Created static site: {static_site.name}")

94

```

95

96

### Get Static Site

97

98

Retrieve details for a specific static site.

99

100

```python { .api }

101

def get_static_site(

102

self,

103

resource_group_name: str,

104

name: str,

105

**kwargs

106

) -> StaticSiteARMResource:

107

"""

108

Get static site details.

109

110

Args:

111

resource_group_name: Name of the resource group

112

name: Name of the static site

113

114

Returns:

115

StaticSiteARMResource object

116

"""

117

```

118

119

### List Static Sites

120

121

Get all static sites in a subscription or resource group.

122

123

```python { .api }

124

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

125

"""

126

List all static sites in the subscription.

127

128

Returns:

129

List of StaticSiteARMResource objects

130

"""

131

132

def list_static_sites_by_resource_group(

133

self,

134

resource_group_name: str,

135

**kwargs

136

) -> List[StaticSiteARMResource]:

137

"""

138

List static sites in a resource group.

139

140

Args:

141

resource_group_name: Name of the resource group

142

143

Returns:

144

List of StaticSiteARMResource objects

145

"""

146

```

147

148

### Delete Static Site

149

150

Remove a static site and all its resources.

151

152

```python { .api }

153

def delete_static_site(

154

self,

155

resource_group_name: str,

156

name: str,

157

**kwargs

158

) -> None:

159

"""

160

Delete a static site.

161

162

Args:

163

resource_group_name: Name of the resource group

164

name: Name of the static site

165

"""

166

```

167

168

## Build Management

169

170

### List Builds

171

172

Get all builds for a static site.

173

174

```python { .api }

175

def get_static_site_builds(

176

self,

177

resource_group_name: str,

178

name: str,

179

**kwargs

180

) -> List[StaticSiteBuildARMResource]:

181

"""

182

List builds for the static site.

183

184

Args:

185

resource_group_name: Name of the resource group

186

name: Name of the static site

187

188

Returns:

189

List of StaticSiteBuildARMResource objects

190

"""

191

```

192

193

### Get Build Details

194

195

Retrieve details for a specific build.

196

197

```python { .api }

198

def get_static_site_build(

199

self,

200

resource_group_name: str,

201

name: str,

202

pr_id: str,

203

**kwargs

204

) -> StaticSiteBuildARMResource:

205

"""

206

Get build details.

207

208

Args:

209

resource_group_name: Name of the resource group

210

name: Name of the static site

211

pr_id: Pull request ID or environment name

212

213

Returns:

214

StaticSiteBuildARMResource object

215

"""

216

```

217

218

### Delete Build

219

220

Remove a specific build environment.

221

222

```python { .api }

223

def delete_static_site_build(

224

self,

225

resource_group_name: str,

226

name: str,

227

pr_id: str,

228

**kwargs

229

) -> None:

230

"""

231

Delete a build environment.

232

233

Args:

234

resource_group_name: Name of the resource group

235

name: Name of the static site

236

pr_id: Pull request ID or environment name

237

"""

238

```

239

240

**Usage Example:**

241

242

```python

243

# List all builds

244

builds = client.static_sites.get_static_site_builds(

245

resource_group_name="my-resource-group",

246

name="my-static-site"

247

)

248

249

for build in builds:

250

print(f"Build: {build.name}, Status: {build.status}")

251

252

# Get specific build details

253

build_details = client.static_sites.get_static_site_build(

254

resource_group_name="my-resource-group",

255

name="my-static-site",

256

pr_id="1"

257

)

258

print(f"Build hostname: {build_details.hostname}")

259

```

260

261

## Custom Domain Management

262

263

### List Custom Domains

264

265

Get all custom domains configured for a static site.

266

267

```python { .api }

268

def list_static_site_custom_domains(

269

self,

270

resource_group_name: str,

271

name: str,

272

**kwargs

273

) -> List[StaticSiteCustomDomainOverviewARMResource]:

274

"""

275

List custom domains for the static site.

276

277

Args:

278

resource_group_name: Name of the resource group

279

name: Name of the static site

280

281

Returns:

282

List of StaticSiteCustomDomainOverviewARMResource objects

283

"""

284

```

285

286

### Create Custom Domain

287

288

Add a custom domain to a static site.

289

290

```python { .api }

291

def create_or_update_static_site_custom_domain(

292

self,

293

resource_group_name: str,

294

name: str,

295

domain_name: str,

296

**kwargs

297

) -> StaticSiteCustomDomainOverviewARMResource:

298

"""

299

Create or update a custom domain.

300

301

Args:

302

resource_group_name: Name of the resource group

303

name: Name of the static site

304

domain_name: Custom domain name

305

306

Returns:

307

StaticSiteCustomDomainOverviewARMResource object

308

"""

309

```

310

311

### Validate Custom Domain

312

313

Check if a custom domain can be added to the static site.

314

315

```python { .api }

316

def validate_custom_domain_can_be_added_to_static_site(

317

self,

318

resource_group_name: str,

319

name: str,

320

domain_name: str,

321

**kwargs

322

) -> None:

323

"""

324

Validate that a custom domain can be added.

325

326

Args:

327

resource_group_name: Name of the resource group

328

name: Name of the static site

329

domain_name: Domain name to validate

330

"""

331

```

332

333

**Usage Example:**

334

335

```python

336

# Validate custom domain

337

client.static_sites.validate_custom_domain_can_be_added_to_static_site(

338

resource_group_name="my-resource-group",

339

name="my-static-site",

340

domain_name="www.mydomain.com"

341

)

342

343

# Add custom domain

344

custom_domain = client.static_sites.create_or_update_static_site_custom_domain(

345

resource_group_name="my-resource-group",

346

name="my-static-site",

347

domain_name="www.mydomain.com"

348

)

349

print(f"Custom domain added: {custom_domain.domain_name}")

350

```

351

352

## User Management

353

354

### List Users

355

356

Get all users with access to the static site.

357

358

```python { .api }

359

def list_static_site_users(

360

self,

361

resource_group_name: str,

362

name: str,

363

authprovider: str,

364

**kwargs

365

) -> List[StaticSiteUserARMResource]:

366

"""

367

List users for the static site.

368

369

Args:

370

resource_group_name: Name of the resource group

371

name: Name of the static site

372

authprovider: Authentication provider name

373

374

Returns:

375

List of StaticSiteUserARMResource objects

376

"""

377

```

378

379

### Update User Roles

380

381

Modify user permissions for the static site.

382

383

```python { .api }

384

def update_static_site_user(

385

self,

386

resource_group_name: str,

387

name: str,

388

authprovider: str,

389

userid: str,

390

static_site_user_envelope: StaticSiteUserARMResource,

391

**kwargs

392

) -> StaticSiteUserARMResource:

393

"""

394

Update user roles and permissions.

395

396

Args:

397

resource_group_name: Name of the resource group

398

name: Name of the static site

399

authprovider: Authentication provider

400

userid: User ID

401

static_site_user_envelope: User configuration

402

403

Returns:

404

Updated StaticSiteUserARMResource object

405

"""

406

```

407

408

### Delete User

409

410

Remove user access from the static site.

411

412

```python { .api }

413

def delete_static_site_user(

414

self,

415

resource_group_name: str,

416

name: str,

417

authprovider: str,

418

userid: str,

419

**kwargs

420

) -> None:

421

"""

422

Delete user access.

423

424

Args:

425

resource_group_name: Name of the resource group

426

name: Name of the static site

427

authprovider: Authentication provider

428

userid: User ID

429

"""

430

```

431

432

## Configuration Management

433

434

### Get Configuration

435

436

Retrieve configuration settings for the static site.

437

438

```python { .api }

439

def get_static_site_functions_app_settings(

440

self,

441

resource_group_name: str,

442

name: str,

443

**kwargs

444

) -> StringDictionary:

445

"""

446

Get function app settings for the static site.

447

448

Args:

449

resource_group_name: Name of the resource group

450

name: Name of the static site

451

452

Returns:

453

StringDictionary with settings

454

"""

455

```

456

457

### Update Configuration

458

459

Modify configuration settings.

460

461

```python { .api }

462

def create_or_update_static_site_functions_app_settings(

463

self,

464

resource_group_name: str,

465

name: str,

466

app_settings: StringDictionary,

467

**kwargs

468

) -> StringDictionary:

469

"""

470

Update function app settings.

471

472

Args:

473

resource_group_name: Name of the resource group

474

name: Name of the static site

475

app_settings: Application settings

476

477

Returns:

478

Updated StringDictionary

479

"""

480

```

481

482

**Usage Example:**

483

484

```python

485

from azure.mgmt.web.models import StringDictionary

486

487

# Get current settings

488

current_settings = client.static_sites.get_static_site_functions_app_settings(

489

resource_group_name="my-resource-group",

490

name="my-static-site"

491

)

492

493

# Update settings

494

new_settings = StringDictionary(

495

properties={

496

"API_KEY": "your-api-key",

497

"DATABASE_URL": "your-database-url",

498

"ENVIRONMENT": "production"

499

}

500

)

501

502

updated_settings = client.static_sites.create_or_update_static_site_functions_app_settings(

503

resource_group_name="my-resource-group",

504

name="my-static-site",

505

app_settings=new_settings

506

)

507

```

508

509

## Types

510

511

### StaticSiteARMResource

512

513

```python { .api }

514

class StaticSiteARMResource:

515

"""Represents a static site resource."""

516

id: Optional[str]

517

name: Optional[str]

518

type: Optional[str]

519

location: str

520

tags: Optional[Dict[str, str]]

521

sku: Optional[SkuDescription]

522

default_hostname: Optional[str]

523

repository_url: Optional[str]

524

branch: Optional[str]

525

custom_domains: Optional[List[str]]

526

private_endpoint_connections: Optional[List[ResponseMessageEnvelopeRemotePrivateEndpointConnection]]

527

build_properties: Optional[StaticSiteBuildProperties]

528

content_distribution_endpoint: Optional[str]

529

key_vault_reference_identity: Optional[str]

530

user_provided_function_apps: Optional[List[StaticSiteUserProvidedFunctionApp]]

531

```

532

533

### StaticSiteBuildARMResource

534

535

```python { .api }

536

class StaticSiteBuildARMResource:

537

"""Represents a static site build."""

538

id: Optional[str]

539

name: Optional[str]

540

type: Optional[str]

541

build_id: Optional[str]

542

hostname: Optional[str]

543

created_time_utc: Optional[datetime]

544

last_updated_on: Optional[datetime]

545

status: Optional[str]

546

user_provided_function_apps: Optional[List[StaticSiteUserProvidedFunctionApp]]

547

```

548

549

### StaticSiteCustomDomainOverviewARMResource

550

551

```python { .api }

552

class StaticSiteCustomDomainOverviewARMResource:

553

"""Represents a custom domain for a static site."""

554

id: Optional[str]

555

name: Optional[str]

556

type: Optional[str]

557

domain_name: Optional[str]

558

created_date: Optional[datetime]

559

status: Optional[str]

560

validation_token: Optional[str]

561

error_message: Optional[str]

562

```

563

564

### StaticSiteUserARMResource

565

566

```python { .api }

567

class StaticSiteUserARMResource:

568

"""Represents a user with access to a static site."""

569

id: Optional[str]

570

name: Optional[str]

571

type: Optional[str]

572

provider: Optional[str]

573

user_id: Optional[str]

574

display_name: Optional[str]

575

roles: Optional[str]

576

```