- Place these files in a folder for execution.
- Install Node.js from the Windows x64 MSI at https://nodejs.org/. Keep npm enabled and add Node.js to the system
PATH. - Close and reopen PowerShell, then verify
node --versionandnpm --versionwork. Node.js must be 23.6 or newer. - Install Visual Studio Code from https://code.visualstudio.com/ if you need an editor on the server. It is a lightweight option for editing this folder and can validate
local.settings.jsonagainstlocal.settings.schema.json. - Run
npm ci. This installs exactly what is inpackage-lock.json. If the server cannot reach the public npm registry, configure npm to use your internal package registry first. - Run
npm run configure, choosewindows, and verify the requiredValuesinlocal.settings.json. - Edit
src/config/windows-service.tsand choose a deployment-specific service name and description. The installer refuses the defaultrename meplaceholder. - Run
npm run windows-installfrom an elevated PowerShell to install the Windows service. - Configure the service in
services.msc, setting the user. - Inspect
eventvwr.exeApplication Log for service events. Restart the service after config changes.
Install from the final folder location. The service points at src/server.ts in this tree, so moving the folder later means uninstalling and reinstalling the service.
After npm run configure, verify local.settings.json:
FN_SERVICE_TYPEiswindows, notdev.FN_AUTH_HEADERandFN_AUTH_KEYare set to generated or rotated secrets.FN_BIND_HOSTis127.0.0.1if a co-located proxy is the only intended caller; otherwise leave the default and control access with Windows Firewall / network policy.FN_CORS_ORIGINSlists exact browser origins if SPFx / Power Apps / browser callers are used.
Use a least-privilege service account with access only to the databases, file shares, certificates, and proxies the actions need. Windows services do not reliably inherit mapped drives; use UNC paths for file shares.
Restart the service after editing local.settings.json, rotating secrets, changing action code, or changing schedules.
Common mistakes:
- Node.js must be 23.6 or newer because the service runs TypeScript directly with native type stripping.
local.settings.jsonwins over environment variables. If a value looks ignored, check the file first.- Keep
local.settings.jsonprivate; it contains live secrets. - Do not deploy with
FN_SERVICE_TYPE=dev; loopback requests bypass auth in dev mode. - Scheduled actions run in the server's local timezone. Use 6-field NCRONTAB for Azure Timer portability.
- For scheduled actions that mutate external systems, set
concurrency: 1unless overlap is safe. - If the service is exposed beyond localhost, verify firewall rules, App Proxy / reverse proxy behavior, CORS, and auth headers before adding real data.
Uninstall with:
npm run windows-uninstall