Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
05698fd
feat(azure): add Azure provider foundation with ResourceGroup and Use…
bjorntechTobbe Nov 29, 2025
a502670
feat(azure): add Storage resources (StorageAccount, BlobContainer) - …
bjorntechTobbe Nov 29, 2025
2b53a37
chore: update bun.lock with Azure SDK dev dependencies
bjorntechTobbe Nov 29, 2025
488dc27
feat(azure): add Compute resources (FunctionApp, StaticWebApp, AppSer…
bjorntechTobbe Nov 29, 2025
371f266
feat(azure): add Database resources (CosmosDBAccount, SqlServer, SqlD…
bjorntechTobbe Nov 29, 2025
4fee4ff
feat(azure): add Networking resources (VirtualNetwork, NetworkSecurit…
bjorntechTobbe Nov 29, 2025
cc19a5d
feat(azure): add PublicIPAddress resource for external IPs
bjorntechTobbe Nov 29, 2025
08a94d7
feat(azure): add ContainerInstance resource for serverless containers…
bjorntechTobbe Nov 29, 2025
ca62d2d
fix(azure): improve ResourceGroup test cleanup and validation
bjorntechTobbe Nov 29, 2025
b1d8146
fix(azure): properly clean up state in ResourceGroup adoption test
bjorntechTobbe Nov 29, 2025
1b254db
docs(azure): clarify SDK strategy and update implementation examples
bjorntechTobbe Nov 29, 2025
6294817
docs(azure): enhance progress tracking with detailed phase overview a…
bjorntechTobbe Nov 29, 2025
34bab4a
feat(azure): add KeyVault resource for secrets and key management - P…
bjorntechTobbe Nov 29, 2025
ded0cc5
fix(azure): improve KeyVault tenant ID resolution and test names
bjorntechTobbe Nov 29, 2025
e5e06de
feat(azure): add automatic tenant ID detection from Azure CLI and tokens
bjorntechTobbe Nov 29, 2025
b0c04bf
fix(azure): KeyVault tests now pass and clean up properly
bjorntechTobbe Nov 29, 2025
baaf751
feat(azure): complete Phase 5 with ServiceBus and CDN resources
bjorntechTobbe Nov 29, 2025
c97ce57
docs(examples): add Azure container with firewall example
bjorntechTobbe Nov 29, 2025
7f31522
fix(azure): correct Container Instance API structure and environment …
bjorntechTobbe Nov 29, 2025
9fef09c
feat(azure): auto-detect subscription ID from Azure CLI
bjorntechTobbe Nov 29, 2025
a68fffd
refactor(azure): centralize tenant ID auto-detection in client.ts
bjorntechTobbe Nov 29, 2025
850f5b0
fix(azure): improve KeyVault test reliability with soft-delete disabled
bjorntechTobbe Nov 29, 2025
af297bd
docs(examples): add Azure Function App and Static Web App examples
bjorntechTobbe Nov 29, 2025
bac2d70
fix(examples): add password and fix storage name in Azure examples
bjorntechTobbe Nov 29, 2025
e44b5d9
feat(azure): add BlobStateStore for Azure Blob Storage state management
bjorntechTobbe Nov 29, 2025
6890e61
fix(azure): require pre-existing container in BlobStateStore to align…
bjorntechTobbe Nov 29, 2025
b559887
feat(azure): add CognitiveServices resource and complete Phase 5 docu…
bjorntechTobbe Nov 30, 2025
008026c
test(azure): add CDN tests and complete Phase 5 with KeyVault docs
bjorntechTobbe Nov 30, 2025
3e2dc9b
docs(azure): add comprehensive test guide for cost optimization and s…
bjorntechTobbe Nov 30, 2025
c975bec
refactor(azure): replace 'any' types with proper TypeScript typing th…
bjorntechTobbe Nov 30, 2025
5cab711
docs(examples): add Azure App Service and SQL Database examples
bjorntechTobbe Nov 30, 2025
8afaf0a
docs(examples): add Azure AI Services example with OpenAI, Vision, Sp…
bjorntechTobbe Nov 30, 2025
93e38c2
docs(azure): add comprehensive Azure OpenAI access and pricing guide
bjorntechTobbe Nov 30, 2025
a507603
fix(azure): resolve test failures in Storage, VNet, App Service, and …
bjorntechTobbe Nov 30, 2025
044b559
fix(azure): update CDN Profile to use Azure Front Door SKUs as defaul…
bjorntechTobbe Nov 30, 2025
496049d
refactor(azure): remove unnecessary inline comments from Azure compon…
bjorntechTobbe Nov 30, 2025
36522f5
fix(azure): resolve TypeScript errors with proper type assertions and…
bjorntechTobbe Nov 30, 2025
b4566e7
fix(azure): resolve all remaining TypeScript errors in Azure source f…
bjorntechTobbe Nov 30, 2025
462f97e
refactor(azure): improve type safety by using type guards and proper …
bjorntechTobbe Nov 30, 2025
4856100
fix(azure): move validation checks after delete phase in blob-contain…
bjorntechTobbe Nov 30, 2025
38eaa44
fix(azure/test): enable public access on storage accounts and fix err…
bjorntechTobbe Nov 30, 2025
ce41874
docs(azure): add comprehensive testing status documentation for all 1…
bjorntechTobbe Dec 4, 2025
e3996fb
fix(azure): apply systematic test fixes and improvements across all A…
bjorntechTobbe Dec 4, 2025
d8c416c
feat(azure): add subnet delegation support to VirtualNetwork
bjorntechTobbe Dec 4, 2025
4231db6
docs(azure): add comprehensive sprint progress report
bjorntechTobbe Dec 4, 2025
132da9e
refactor(azure/test): reduce test count to match Cloudflare standards…
bjorntechTobbe Dec 4, 2025
c08c4f4
refactor(azure/test): reduce test count to match Cloudflare standards…
bjorntechTobbe Dec 4, 2025
3ce0da7
test: reduce Azure tests Part 3/3 - high priority files
bjorntechTobbe Dec 4, 2025
f5763ae
test: reduce Azure tests Part 4/6 - medium priority storage/network
bjorntechTobbe Dec 4, 2025
ee1500a
test: reduce Azure tests Part 5/6 - medium priority compute/security
bjorntechTobbe Dec 4, 2025
f8bb444
test: reduce Azure tests Part 6/6 - lower priority database/compute
bjorntechTobbe Dec 4, 2025
a5e2811
test(azure): standardize all tests to use eastus region
bjorntechTobbe Dec 4, 2025
2d3d24f
refactor(azure): consolidate test assertion helpers
bjorntechTobbe Dec 4, 2025
ec72e81
test(azure): remove public blob access tests and old docs
bjorntechTobbe Dec 4, 2025
a38781a
docs(azure): add comprehensive test results documentation
bjorntechTobbe Dec 4, 2025
640c110
feat(azure): add nuke script for resource cleanup
bjorntechTobbe Dec 4, 2025
da15d87
fix(azure): fix AppService AlwaysOn for Basic tier
bjorntechTobbe Dec 4, 2025
069e048
fix(azure): fix AppService identity reference and ContainerInstance t…
bjorntechTobbe Dec 4, 2025
c71edca
refactor(azure): simplify StaticWebApp resource existence check
bjorntechTobbe Dec 4, 2025
5e2902a
fix(azure): update StaticWebApp tests to use eastus2 region
bjorntechTobbe Dec 4, 2025
2872b16
refactor(azure): add retry logic for StaticWebApp ResourceGroup event…
bjorntechTobbe Dec 14, 2025
b6a1f6f
refactor(azure): replace console.* with logger for runtime logging
bjorntechTobbe Dec 14, 2025
a4ea948
refactor(azure): remove unnecessary comments to match codebase style
bjorntechTobbe Dec 14, 2025
d6d9a96
chore: remove internal tracking documentation
bjorntechTobbe Dec 14, 2025
4f99a6e
docs: replace personal prefix 'tobbe' with generic 'dev' in examples
bjorntechTobbe Dec 14, 2025
1b410ee
chore: remove session tracking documentation from src/azure
bjorntechTobbe Dec 14, 2025
4627091
docs(azure): add provider overview and getting started guide
bjorntechTobbe Dec 14, 2025
31f4379
docs(azure): add resource provider registration instructions
bjorntechTobbe Dec 14, 2025
b3d74b1
style: apply oxfmt formatting to Azure files
bjorntechTobbe Dec 14, 2025
f0b29e1
fix(azure): prioritize output values during delete phase to prevent s…
bjorntechTobbe Dec 14, 2025
4d9c44c
fix(azure): store resourceGroup as string instead of object in resour…
bjorntechTobbe Dec 14, 2025
6e64e1a
docs(azure): mark VirtualNetwork and StaticWebApp as tested and passing
bjorntechTobbe Dec 14, 2025
3921682
docs(azure): mark NetworkSecurityGroup, PublicIPAddress, and KeyVault…
bjorntechTobbe Dec 14, 2025
6738842
fix(azure): move location validation after delete phase in CognitiveS…
bjorntechTobbe Dec 14, 2025
f5c0ae7
docs(azure): update test verification summary with CognitiveServices,…
bjorntechTobbe Dec 14, 2025
4dcb61b
docs(azure): mark AppService and FunctionApp as tested (were already …
bjorntechTobbe Dec 14, 2025
cb0d9eb
fix(azure): move location validation after delete phase in CDNProfile
bjorntechTobbe Dec 14, 2025
85d0966
refactor(azure): update CDN tests to use modern Azure Front Door SKUs
bjorntechTobbe Dec 14, 2025
a315324
docs(azure): update CDNProfile test status - investigating deletion t…
bjorntechTobbe Dec 14, 2025
4a80d5f
fix(azure): resolve location normalization and SKU handling bugs, com…
bjorntechTobbe Dec 14, 2025
4213b41
test(azure): skip CDN tests by default - too slow for automated testing
bjorntechTobbe Dec 14, 2025
3554072
test(azure): skip SQL and CosmosDB tests by default - too slow for CI/CD
bjorntechTobbe Dec 14, 2025
79780bc
docs(azure): update test documentation to reflect skipped tests
bjorntechTobbe Dec 14, 2025
0580337
fix(azure): preserve restartPolicy in ContainerInstance output
bjorntechTobbe Dec 14, 2025
cfd5dde
fix: restore CLAUDE.md symlink
bjorntechTobbe Dec 14, 2025
472b697
fix(azure): update examples to work with current subscription limits
bjorntechTobbe Dec 14, 2025
3baf3c8
docs(azure): update test verification with example projects results
bjorntechTobbe Dec 14, 2025
518b182
chore: add missing Azure example references to tsconfig
bjorntechTobbe Dec 14, 2025
9cebeb3
chore: remove internal test verification doc
bjorntechTobbe Dec 14, 2025
ef8b7c1
fix(azure): resolve TypeScript type errors in resource implementations
bjorntechTobbe Dec 14, 2025
f7c3bfb
chore: format code with oxfmt
bjorntechTobbe Dec 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
420 changes: 420 additions & 0 deletions alchemy-web/src/content/docs/guides/azure.mdx

Large diffs are not rendered by default.

388 changes: 388 additions & 0 deletions alchemy-web/src/content/docs/providers/azure/app-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,388 @@
---
title: AppService
description: Azure App Service - PaaS web hosting for containers and code
---

# AppService

Azure App Service is a fully managed platform for building, deploying, and scaling web apps. It's equivalent to AWS Elastic Beanstalk and supports multiple languages and frameworks without managing infrastructure.

Key features:
- **Fully managed** - no server management required
- **Multiple runtimes** - Node.js, Python, .NET, Java, PHP, Ruby
- **Built-in autoscaling** based on demand
- **Deployment slots** for staging and blue-green deployments
- **CI/CD integration** with Azure DevOps and GitHub Actions
- **Custom domains** and SSL certificates
- **VNet integration** for private connectivity

## Properties

### Input Properties

| Property | Type | Required | Description |
|----------|------|----------|-------------|
| `name` | `string` | No | Name of the app service. Must be 2-60 characters, alphanumeric and hyphens only. Must be globally unique (creates `{name}.azurewebsites.net`). Defaults to `${app}-${stage}-${id}` |
| `resourceGroup` | `string \| ResourceGroup` | Yes | The resource group to create this app service in |
| `location` | `string` | No | Azure region for the app service. Defaults to the resource group's location |
| `sku` | `string` | No | The pricing tier. Options: `F1` (Free), `D1` (Shared), `B1-B3` (Basic), `S1-S3` (Standard), `P1V2-P3V2` (Premium V2), `P1V3-P3V3` (Premium V3). Defaults to `B1` |
| `runtime` | `string` | No | The runtime stack. Options: `node`, `python`, `dotnet`, `java`, `php`, `ruby`. Defaults to `node` |
| `runtimeVersion` | `string` | No | Runtime version (e.g., `"18"`, `"20"` for Node.js, `"3.9"`, `"3.11"` for Python). Defaults to `"20"` for Node.js |
| `os` | `string` | No | Operating system. Options: `linux`, `windows`. Defaults to `linux` |
| `identity` | `UserAssignedIdentity` | No | User-assigned managed identity for secure access to Azure resources |
| `appSettings` | `Record<string, string \| Secret>` | No | Application settings (environment variables) |
| `httpsOnly` | `boolean` | No | Enable HTTPS only (redirect HTTP to HTTPS). Defaults to `true` |
| `alwaysOn` | `boolean` | No | Keep the app loaded even when idle (not available on Free tier). Defaults to `true` |
| `localMySqlEnabled` | `boolean` | No | Enable local MySQL in-app database (Windows only). Defaults to `false` |
| `ftpsState` | `string` | No | FTP deployment state. Options: `AllAllowed`, `FtpsOnly`, `Disabled`. Defaults to `Disabled` |
| `minTlsVersion` | `string` | No | Minimum TLS version. Options: `1.0`, `1.1`, `1.2`, `1.3`. Defaults to `1.2` |
| `tags` | `Record<string, string>` | No | Tags to apply to the app service |
| `adopt` | `boolean` | No | Whether to adopt an existing app service. Defaults to `false` |
| `delete` | `boolean` | No | Whether to delete the app service when removed from Alchemy. Defaults to `true` |

### Output Properties

All input properties plus:

| Property | Type | Description |
|----------|------|-------------|
| `id` | `string` | The Alchemy resource ID |
| `defaultHostname` | `string` | The default hostname (e.g., `my-app-service.azurewebsites.net`) |
| `url` | `string` | The app service URL (e.g., `https://my-app-service.azurewebsites.net`) |
| `outboundIpAddresses` | `string` | The outbound IP addresses |
| `possibleOutboundIpAddresses` | `string` | The possible outbound IP addresses |
| `type` | `"azure::AppService"` | Resource type identifier |

## Usage

### Basic App Service

Create a Node.js app service on Linux:

```typescript
import { alchemy } from "alchemy";
import { ResourceGroup, AppService } from "alchemy/azure";

const app = await alchemy("my-app", {
azure: {
subscriptionId: process.env.AZURE_SUBSCRIPTION_ID!
}
});

const rg = await ResourceGroup("main", {
location: "eastus"
});

const appService = await AppService("web", {
resourceGroup: rg,
runtime: "node",
runtimeVersion: "20",
sku: "B1"
});

console.log(`App Service URL: ${appService.url}`);

await app.finalize();
```

### App Service with Managed Identity

Use managed identity to securely access other Azure resources:

```typescript
const identity = await UserAssignedIdentity("app-identity", {
resourceGroup: rg
});

const appService = await AppService("secure-web", {
resourceGroup: rg,
runtime: "node",
identity: identity,
sku: "S1"
});

// The app service can now access other Azure resources
// without storing connection strings or keys
```

### App Service with App Settings

Configure environment variables and secrets:

```typescript
const appService = await AppService("configured-web", {
resourceGroup: rg,
runtime: "node",
sku: "B1",
appSettings: {
NODE_ENV: "production",
DATABASE_URL: alchemy.secret.env.DATABASE_URL,
API_KEY: alchemy.secret.env.API_KEY,
CUSTOM_SETTING: "value"
}
});

// App settings are available as environment variables
// Secrets are encrypted in the Alchemy state file
```

### Python App Service

Create a Python web application:

```typescript
const pythonApp = await AppService("python-web", {
resourceGroup: rg,
runtime: "python",
runtimeVersion: "3.11",
os: "linux",
sku: "B1"
});

// Deploy Flask, Django, FastAPI, or any Python web framework
```

### .NET App Service

Create a .NET web application:

```typescript
const dotnetApp = await AppService("dotnet-web", {
resourceGroup: rg,
runtime: "dotnet",
runtimeVersion: "8.0",
os: "linux",
sku: "B1"
});

// Deploy ASP.NET Core applications
```

### Premium App Service

Use Premium tier for production workloads:

```typescript
const premiumApp = await AppService("prod-web", {
resourceGroup: rg,
runtime: "node",
runtimeVersion: "20",
sku: "P1V3", // Premium V3
alwaysOn: true,
httpsOnly: true,
minTlsVersion: "1.3"
});

// Premium features:
// - VNet integration
// - Better performance
// - More memory and CPU
// - Advanced scaling options
```

### Windows App Service

Create a Windows-based app service:

```typescript
const windowsApp = await AppService("windows-web", {
resourceGroup: rg,
runtime: "dotnet",
runtimeVersion: "8.0",
os: "windows",
sku: "B1",
localMySqlEnabled: true // Windows-only feature
});
```

### Multi-Region Deployment

Deploy app services across multiple regions:

```typescript
const eastRg = await ResourceGroup("east", { location: "eastus" });
const westRg = await ResourceGroup("west", { location: "westus" });

const eastApp = await AppService("east-web", {
resourceGroup: eastRg,
runtime: "node",
sku: "S1"
});

const westApp = await AppService("west-web", {
resourceGroup: westRg,
runtime: "node",
sku: "S1"
});

// Use Azure Traffic Manager or Front Door to distribute traffic
```

### Adopt Existing App Service

Adopt and manage an existing app service:

```typescript
const existingApp = await AppService("existing-web", {
name: "my-existing-app-service",
resourceGroup: rg,
runtime: "node",
sku: "B1",
adopt: true
});

// The app service is now managed by Alchemy
```

## Pricing Tiers

| Tier | Type | Features | Use Case |
|------|------|----------|----------|
| **F1** | Free | 1GB disk, 60 CPU mins/day, no Always On | Development, testing |
| **D1** | Shared | 1GB disk, 240 CPU mins/day, no Always On | Small personal projects |
| **B1-B3** | Basic | Dedicated instances, custom domains, SSL | Small production apps |
| **S1-S3** | Standard | Autoscaling, staging slots, daily backups | Production apps |
| **P1V2-P3V2** | Premium V2 | Better performance, VNet integration | High-traffic production |
| **P1V3-P3V3** | Premium V3 | Latest hardware, best performance | Enterprise apps |

## Runtime Versions

### Node.js (Linux)
- `18`: Node.js 18 LTS
- `20`: Node.js 20 LTS (recommended)

### Python (Linux)
- `3.9`: Python 3.9
- `3.10`: Python 3.10
- `3.11`: Python 3.11 (recommended)
- `3.12`: Python 3.12

### .NET (Linux/Windows)
- `6.0`: .NET 6 LTS
- `8.0`: .NET 8 LTS (recommended)

### Java (Linux)
- `11`: Java 11 LTS
- `17`: Java 17 LTS
- `21`: Java 21 LTS

### PHP (Linux)
- `8.0`: PHP 8.0
- `8.1`: PHP 8.1
- `8.2`: PHP 8.2

## Important Notes

### Global Naming

App service names must be globally unique across all of Azure because they create a `{name}.azurewebsites.net` subdomain.

### Immutable Properties

The following properties cannot be changed after creation:
- `name` - changing the name creates a new app service
- `location` - changing the location creates a new app service

### Always On

The `alwaysOn` property keeps your app loaded even when idle, preventing cold starts. It's:
- **Not available** on Free (F1) tier
- **Recommended** for production apps
- **Default**: `true` (except on Free tier)

### HTTPS Only

By default, app services redirect HTTP traffic to HTTPS (`httpsOnly: true`). This is a security best practice and recommended for all production apps.

### Operating System

- **Linux**: More cost-effective, supports containers, better for Node.js/Python
- **Windows**: Required for .NET Framework, supports in-app MySQL

## Common Patterns

### Express.js API

```typescript
const api = await AppService("express-api", {
resourceGroup: rg,
runtime: "node",
runtimeVersion: "20",
sku: "B1",
appSettings: {
NODE_ENV: "production",
PORT: "8080"
}
});

// Deploy Express.js app
// App listens on process.env.PORT
```

### Django Application

```typescript
const djangoApp = await AppService("django-app", {
resourceGroup: rg,
runtime: "python",
runtimeVersion: "3.11",
os: "linux",
sku: "B1",
appSettings: {
DJANGO_SETTINGS_MODULE: "myproject.settings",
SECRET_KEY: alchemy.secret.env.DJANGO_SECRET_KEY
}
});
```

### ASP.NET Core Web App

```typescript
const aspnetApp = await AppService("aspnet-web", {
resourceGroup: rg,
runtime: "dotnet",
runtimeVersion: "8.0",
os: "linux",
sku: "S1",
alwaysOn: true
});
```

### Container Deployment

```typescript
const containerApp = await AppService("container-web", {
resourceGroup: rg,
runtime: "node", // Base runtime
os: "linux",
sku: "B1"
});

// Configure container settings separately
// Or use Azure Container Apps for better container support
```

## Deployment

Deploy your application using:
- **Azure CLI**: `az webapp up`
- **GitHub Actions**: Built-in deployment workflow
- **Azure DevOps**: Azure Pipelines
- **FTP/FTPS**: Direct file upload (if enabled)
- **Local Git**: Push to Azure remote
- **ZIP Deploy**: Upload zip file

## Related Resources

- [ResourceGroup](./resource-group) - Logical container for Azure resources
- [UserAssignedIdentity](./user-assigned-identity) - Managed identity for secure access
- [FunctionApp](./function-app) - Serverless alternative for event-driven workloads
- [StaticWebApp](./static-web-app) - Static site hosting alternative

## Official Documentation

- [Azure App Service Overview](https://docs.microsoft.com/azure/app-service/overview)
- [Configure Runtime](https://docs.microsoft.com/azure/app-service/configure-language-nodejs)
- [Configure App Settings](https://docs.microsoft.com/azure/app-service/configure-common)
- [Deployment Best Practices](https://docs.microsoft.com/azure/app-service/deploy-best-practices)
- [Scaling](https://docs.microsoft.com/azure/app-service/manage-scale-up)
Loading