Skip to content
Platform · Azure Functions

Add e-signatures and clickwrap to an Azure Functions app

To add e-signatures and clickwrap to an Azure Functions app, run the esigncomply package in HTTP functions on the Node.js v4 model and keep the secret key in an application setting. One function creates the session, another confirms the record, and Azure Table Storage keeps the pinned versions and the receipt for every instance. Esign Comply seals each acceptance.

Follow the quickstart and each signature is a valid electronic signature under the U.S. ESIGN Act, state UETA laws and New York's ESRA, and each clickwrap is built the way courts require: clear notice of the terms, an unmistakable act of assent, and a sealed record of both.

$npm install @azure/functions esigncomply @azure/data-tables
Azure Functions quickstart

Free plan: 10 live signatures a month and a full test mode. No card required.

Last updated

Run locally for Azure Functions before publishing
src/functions/signup.js (excerpt)
// Step 4: create the session with the secret key. The browser gets the client token only.
app.http("ceremony", {
  methods: ["POST"],
  authLevel: "anonymous",
  route: "api/ceremony",
  handler: async (request) => {
    // The page that runs the ceremony: the origin the browser reports, plus its path.
    const origin = request.headers.get("origin") ?? new URL(request.url).origin;
    const { data: session, error } = await esc.sessions.create(
      {
        profile: process.env.ESIGNCOMPLY_PROFILE_ID,
        signer,
        documents: [
          { document: DOCUMENTS.terms, version: "current" },
          { document: DOCUMENTS.privacy, version: "current" },
        ],
        context: { url: `${origin}/signup`, locale: "en-US", purpose: "account_signup" },
      },
      { idempotencyKey: `signup-${signer.external_id}-${randomUUID()}` },
    );
    if (error) return { status: 502, jsonBody: { error: error.code } };
    // In Table Storage, not in memory: the confirmation can reach another instance.
    await savePinned(signer.external_id, session.documents.map((d) => d.version_id).sort());
    return { jsonBody: { clientToken: session.client_token, apiUrl: session.api_url, documents: session.documents } };
  },
});
Integrate with Azure Functions

How do you integrate Esign Comply with Azure Functions?

On Azure Functions the server half is four HTTP functions registered with app.http() on the Node.js v4 model. host.json sets the route prefix to an empty string, so the page is at /signup and not at /api/signup. Instances share no memory and an idle app can scale to zero, so the pinned versions go to a table in Azure Table Storage.

Azure Functions is a serverless solution that allows you to build robust apps while using less code, and with less infrastructure and lower costs.

Source: Microsoft Learn, Azure Functions overview, read on .
Where each part lives on Azure Functions
  • Session functionsrc/functions/signup.js
  • host.jsonhost.json
  • Confirm functionsrc/functions/signup.js
  • Table storesrc/store.js

Run on 2026-11-26 under Azure Functions Core Tools 4.17.0 (func start, Functions runtime 4.1055.300.26527) on the Node.js v4 programming model, with @azure/functions 4.17.1 on Node.js 24.22.1, a table in the Azurite emulator 3.38.0 in Docker through @azure/data-tables 13.3.2, esigncomply 1.0.4, the browser SDK script build and the conformance check from esigncomply 1.0.4, against the API in test mode. Two hosts shared the table, and func pack built the deployment package. Azurite listened on other ports than its defaults on the test machine, named in an explicit connection string. The Azure settings are from Microsoft's documentation as of that date, and the az and func azure commands in step 8 were not run. Nothing has been deployed to Azure yet.

Three steps

How does Esign Comply fit with Azure Functions?

Each step uses a feature Azure Functions already has. The secret key stays on the server side of Azure Functions in all three.

  1. 01
    An application setting holds the keySet ESIGNCOMPLY_API_KEY as an application setting of the function app, or put a Key Vault reference in that setting. Microsoft's documentation says application settings are stored encrypted and reach the code as environment variables, so the SDK reads the key from process.env. Source: Microsoft Learn, Configure function app settings, read on .
  2. 02
    An HTTP function creates the sessionapp.http() registers POST /api/ceremony on the Node.js v4 model. The function calls esc.sessions.create and returns the client token. Another function serves the signup page from the same origin, and the browser SDK records the ceremony from the signer's device. Source: Microsoft Learn, Functions Node.js developer guide, read on .
  3. 03
    A table keeps the receiptThe session function stores the pinned versions in a table in Azure Table Storage, through @azure/data-tables. The confirm function reads the record with the secret key, compares it with the entity, and writes the record ID and the receipt into it. Source: Microsoft Learn, Azure Table storage overview, read on .
Azure Functions setup

Where do the key, the preview hosts and the webhook go on Azure Functions?

Four settings carry an Esign Comply integration on Azure Functions. What is said here about Azure Functions was read from its own documentation, and the quickstart has each command.

Application settings and Key Vault

Local settings are not published: set each value on the function app, in the portal or with az functionapp config appsettings set. Changing a setting restarts the app. A Key Vault reference needs a managed identity that may read the secret. Microsoft's documentation says an unresolved reference is used as its own string: in the test that string as the key gave invalid_api_key.

Source: Microsoft Learn, Key Vault references as app settings, read on .

host.json and the routes

Set extensions.http.routePrefix to an empty string, or every route starts with /api. With an empty prefix no route may begin with admin or runtime: Microsoft reserves both. Give all four functions authLevel: "anonymous", because a browser has no function key to send.

Source: Microsoft Learn, Azure Functions HTTP trigger, read on .

A test app, slots and test mode

Keep the test key in a function app or a slot of its own. Microsoft's documentation says the Flex Consumption plan has no deployment slots, and that a deployment slot setting stays with its slot in a swap. The host is under azurewebsites.net: list that exact host under Domains in the Esign Comply dashboard as a test origin, never the shared suffix.

Source: Microsoft Learn, Azure Functions deployment slots, read on .

The registered domain and the webhook

Go live on a domain you own: azurewebsites.net is not a suffix that verifies with a file. Map the domain to the function app with a CNAME record and the asuid TXT record, then register it with Esign Comply and verify it with one DNS record. For the record.completed webhook, add an HTTP function and register its production URL under Webhooks in the Esign Comply dashboard.

Source: Microsoft Learn, App Service custom domains, read on .

Read on : Microsoft Learn, Functions Node.js developer guide, Microsoft Learn, Azure Functions HTTP trigger, Microsoft Learn, Functions HTTP triggers and bindings, Microsoft Learn, Develop Functions locally, Core Tools, Microsoft Learn, Code and test Azure Functions locally, Microsoft Learn, Configure function app settings, Microsoft Learn, Key Vault references as app settings, Microsoft Learn, Event-driven scaling in Functions, Microsoft Learn, Azure Functions hosting options, Microsoft Learn, Azure Functions deployment slots, Microsoft Learn, App Service custom domains, Microsoft Learn, Use the Azurite emulator, Microsoft Learn, Azure Table storage overview.

Copy-paste prompt

What prompt adds Esign Comply clickwrap to a Azure Functions app?

Paste this into Cursor, Claude Code or the AI coding tool that is open on your project. It names the packages that exist, where the secret key goes on Azure Functions, what to build and what never to do, and it ends with the rules block for your project.

The rules block lives at /rules.md. Added to your project's instruction file, it makes every later session build signing and acceptance flows the same way. The prompt generator writes the long version, with your own document and profile IDs.

Pages for each AI tool
Prompt: Esign Comply clickwrap on Azure Functions
Add Esign Comply clickwrap to my app on Azure Functions: a signup form where the user accepts the Terms of Service and the Privacy Notice with a checkbox and a button.

Read these first and follow them exactly. If something conflicts with existing code, or you are unsure how to implement a step, stop and ask. Do not invent API methods, packages or legal wording.
- https://esigncomply.com/docs/quickstart/azure-functions.md (the steps and the tested code for Azure Functions)
- https://esigncomply.com/setup.md (the order of API calls)
- https://esigncomply.com/auth.md (how to handle the keys)

Azure Functions facts
- Packages (the only ones that exist): esigncomply (server, Node.js 20.19 or later, an ES module) and @esigncomply/browser. Without a bundler, load the browser SDK from https://esigncomply.com/sdk/v1/esigncomply.js.
- Use the Node.js v4 programming model: app.http() in files under src/functions, and "main": "src/functions/*.js" in package.json. Do not write function.json files.
- The secret key is the application setting ESIGNCOMPLY_API_KEY of the function app, or a Key Vault reference in that setting. On the machine it is in local.settings.json, which is never committed and never published. Never print it.
- Set extensions.http.routePrefix to "" in host.json. The default prefix is "api", which puts the page at /api/signup. With an empty prefix, no route may start with admin or runtime.
- Set authLevel "anonymous" on all four functions: a browser has no function key. Core Tools does not ask for keys locally, so a route that needs one works on the machine and answers 401 on Azure.
- Instances share no memory and the app can scale to zero. Keep the pinned version IDs in Azure Table Storage, or in the database the app already has, never in a variable of the module.
- If the project has a .env file, list it in .funcignore: the deployment package takes every file that .funcignore does not name.
- Expect live records only where the application setting ESIGNCOMPLY_LIVE is "true": the production function app.
- The page is on screen before the script has a session: render the checkbox disabled and enable it when observeAssent has resolved.

Build
1. Verify the key: GET /v1/usage with ESIGNCOMPLY_API_KEY. Stop if it fails.
2. Register the Terms of Service and the Privacy Notice as documents and publish one version of each from the documents in this project. If the project has none, register short sample documents and say so in your report. Never write or change the wording of the real documents. Create a profile: jurisdictions ["US-FED"], method "checkbox", assurance_level "L1".
3. Function for POST /api/ceremony: create the session with esc.sessions.create and an Idempotency-Key, save the signer ID and the pinned version IDs in Table Storage, and return only clientToken, apiUrl and documents.
4. Function for GET /legal/{slug}: render the registered version from esc.documents.versions.getContent inside <article data-esc-document>, unmodified.
5. Browser: EsignComply.attach({ clientToken, apiUrl }), presentDocument for each link, observeAssent({ region, checkbox, submit }), then complete() from the user's real click.
6. Function for POST /api/signup/confirm: read the record with esc.records.get and require: status is "recorded", "timestamped" or "anchored"; livemode is as expected; the signer ID and version IDs equal the entity in Table Storage. Only then create the account, and store the record ID and the receipt in the same entity.

Never
- Never pre-check the box, auto-submit, or call .click() on the user's behalf.
- Never use "By continuing" or "By clicking below" wording. The notice names the button by its label and each document by its registered name.
- Never put the secret key, or any call that uses it, in code that reaches the browser.
- Never show "signed" or "accepted" before the server has confirmed the record.
- Never fall back to an acceptance with no record when a session is refused.

Check before you report success
- Run: npx esigncomply check --url http://localhost:7071/signup --callback http://localhost:7071/api/signup/confirm
  Fix every finding marked "block". List every finding marked "warn".
- Report the files you created or changed, anything you did not implement and why, and the conformance summary.

Then add the rules block to this project's instruction file: https://esigncomply.com/rules.md
3 things to watch

What goes wrong when you add e-signatures on Azure Functions?

These are specific to Azure Functions. Each one was seen while the quickstart's code was run, or is in Azure Functions's own documentation.

  • 01

    The default route prefix puts the page at /api/signup

    Microsoft's documentation says all function routes are prefixed with api by default, and that an empty routePrefix in host.json removes the prefix. In the test without that setting, Core Tools 4.17.0 listed the page at /api/signup and the session route at /api/api/ceremony, and /signup answered 404. The quickstart's host.json sets the prefix to an empty string.

    Source: Microsoft Learn, Azure Functions HTTP trigger, read on .
  • 02

    Core Tools does not ask for function keys, and Azure does

    Microsoft's documentation says authorization is not enforced locally, and that the requirements you configure are still enforced when the app is hosted. In the test a confirm function with authLevel: "function" ran for a request with no key under func start, and answered 401 under func start --enableAuth. A browser has no key to send: the quickstart sets anonymous on all four functions.

    Source: Microsoft Learn, Develop Functions locally, Core Tools, read on .
  • 03

    The deployment package takes .env unless .funcignore names it

    The .funcignore that func init writes names local.settings.json and Core Tools, not .env. In the test, func pack from Core Tools 4.17.0 built a package that held the quickstart's .env, key included. With .env added to .funcignore, the package held neither file. The quickstart's .funcignore carries that line.

Verifiable

What does Esign Comply record for a signature on Azure Functions?

The same record on every stack and platform. Your Azure Functions code creates the session and confirms the record, and the browser SDK reports what happened on the page. Esign Comply seals the result where your code cannot change it. The record itself is described on Evidence and verification.

  • Observed and asserted fields

    Every field is tagged. Observed is what the browser SDK and the API saw: the box unchecked at load, the tick from a trusted user event, the notice text, the terms version by hash, the server time. Asserted is what your app said, such as the user's email.

  • A signed receipt

    complete() returns a receipt signed with ES256, using keys you do not hold. Your server stores it next to the user, and GET /v1/records/{id}/receipt returns it again.

  • An external timestamp

    An outside authority timestamps the hash of every live record (RFC 3161), so the time on the record does not rest on your clock or on ours.

  • An offline verifier

    Each record has an evidence report (PDF) and an evidence package (ZIP). Anyone you send the package to checks the acceptance with the open-source esigncomply-verify, without an account.

Recordrec_Z4m8
simple · L1
RecordedWritten durably, receipt signed with ES256
TimestampedExternal RFC 3161 token over the record hash
AnchoredPublic anchor pending
Checkbox changed by a trusted user eventobserved
Terms of Service, version dv_3kT9observed
Server time 2026-11-21T15:03:20.291Zobserved
Signer email dana@example.orgasserted
record_hash sha256:5be7…example record

Questions about e-signatures on Azure Functions

How does test mode work on Azure Functions slots and test apps?

A slot or a second function app answers on a host of its own under azurewebsites.net, which a test key refuses until you list that exact host under Domains as a test origin. Keep the test key in the settings of that app or slot. On localhost, under func start, a test key works with no setup.

Where should the receipt be stored on Azure Functions?

In a table in Azure Table Storage, beside the signer ID and the record ID, or in the database your app already has. The confirm function writes both once the record is confirmed. Instances share no memory and an idle app can scale to zero, so a variable is no place for it.

Why set routePrefix to an empty string in host.json?

Because every route starts with /api otherwise. Microsoft's documentation gives api as the default prefix. In the test without the setting, the host served the page at /api/signup and the session route at /api/api/ceremony. With an empty prefix the paths are /signup, /legal/{slug}, /api/ceremony and /api/signup/confirm.

Why does a route work under func start and ask for a key on Azure?

Because Core Tools does not enforce function keys. Microsoft's documentation says local requests are handled as anonymous unless you pass --enableAuth. In the test a function-level route ran with no key under func start and answered 401 with that option. Set authLevel to anonymous on every route a browser calls.

What ran under Core Tools, and what does only Azure prove?

The four functions ran under func start from Core Tools 4.17.0 with a table in the Azurite emulator, two hosts shared that table, and func pack built the deployment package. Nothing was deployed: publishing, application settings, Key Vault references, scaling, slots and custom domains are proven only on Azure.

Run the signing flow in your function app. Leave the record to us.

Free plan: 10 live signatures a month and a full test mode. No card required.

Azure Functions is a trademark of its owner. Esign Comply is not affiliated with it. What this page says about Azure Functions is from Azure Functions's documentation or from a test run, as marked, on . /azure-functions.md is this page as Markdown.

Working with an AI tool? This page is also available as Markdown: /azure-functions.md