# Azure Functions

`--preset azure-functions` builds the same Functions app without the static config. It is chosen by name only: the variables of the Functions host exist at run time, not in the build.

## Reference

|                      |                      |
| -------------------- | -------------------- |
| Preset               | `azure-functions`    |
| Runs on              | Azure Functions      |
| `event.runtime.name` | `azure`              |
| Server target        | `node`               |
| Lifetime, startup    | `request`, `request` |

### Output

```text
.output/
  hamur.json
  server/                    an Azure Functions v4 app: host.json, package.json, functions.mjs, index.mjs
```

### Config keys

This preset has no key of its own.

### Detection

None. Name it with `--preset`, `preset` in the config or `HAMUR_PRESET`; no environment variable selects it.

### Deploy command

No `hamur deploy` command: it exits 1 for this preset. Deploy `.output/server/` with Azure Functions Core Tools or your pipeline. The preview command of the preset, which `hamur preview` runs or prints, is `cd .output/server && func start`.

### Limits

- Runs: private `app/env.ts` entries read at run time.
- Experimental: streamed answers.
- Does not run: WebSockets and `server.syncedState`, `server.pubsub`, `server.metrics`, image transforms at run time, Durable Object classes.

The levels are the `features` of the preset: `hamur build` warns or fails when the app uses a feature the preset does not run (see [Preset features](/deploy#preset-features)).

`host.json` sets `extensions.http.routePrefix` to `""`, so the function answers at the root of the app instead of under `/api`. Public files are not served; put `.output/public/` on Blob Storage or a CDN. Run it locally with `cd .output/server && func start`, deploy `.output/server` with `func azure functionapp publish`. The function does not read `x-ms-original-url`, so a client cannot change the path the app sees.
