Skip to content

01 - Run Locally (Dedicated)

Initialize, run, and verify a Node.js v4 app on your machine before cloud deployment.

Prerequisites

Tool Version Purpose
Node.js 20+ Local runtime and package execution
Azure Functions Core Tools v4 Local host and publishing
Azure CLI 2.61+ Azure resource provisioning and management

Plan basics

Dedicated runs on App Service plans (B1/S1/P1v3), supports Always On, and behaves like traditional web app hosting. Unlike Consumption and Premium, you pay for the plan whether or not functions are running.

What You'll Build

  • A Node.js v4 HTTP-triggered function named helloHttp running locally with Azure Functions Core Tools.
  • Local route validation at /api/hello/{name?} confirming a JSON payload response.

Infrastructure Context

Plan: Dedicated (B1) | Environment: Local development | Always On: ✅ (when deployed)

Dedicated plans use traditional App Service infrastructure. Locally, the function host behaves identically regardless of target plan.

flowchart TD
    DEV[Developer Machine] -->|func start| HOST[Local Functions Host\nPort 7071]

    subgraph LOCAL["Local Development"]
        HOST
        FUNC[helloHttp\nGET /api/hello]
    end

    HOST --> FUNC
    DEV -->|curl| FUNC

    style HOST fill:#ff8c00,color:#fff
    style LOCAL fill:#E8F5E9,stroke:#4CAF50
    style FUNC fill:#FFF3E0

Steps

  1. Initialize project.

    func init node-guide-dedicated --worker-runtime node --language javascript
    cd node-guide-dedicated
    npm install @azure/functions
    
  2. Create the v4 handler.

    Save the following as src/functions/helloHttp.js:

    const { app } = require('@azure/functions');
    
    app.http('helloHttp', {
        methods: ['GET'],
        route: 'hello/{name?}',
        handler: async (request, context) => {
            const name = request.params.name || request.query.get('name') || 'world';
            context.log(`Handled hello for ${name}`);
            return { status: 200, jsonBody: { message: `Hello, ${name}` } };
        }
    });
    
  3. Run host and test.

    func start
    

    Expected output:

    Functions:
        helloHttp: [GET] http://localhost:7071/api/hello/{name?}
    

    In a second terminal, test the endpoint:

    curl --request GET "http://localhost:7071/api/hello"
    

    Expected output:

    {"message":"Hello, world"}
    
    curl --request GET "http://localhost:7071/api/hello/Dedicated"
    

    Expected output:

    {"message":"Hello, Dedicated"}
    
  4. Review Dedicated-specific notes.

    • Dedicated does not require Azure Files content share settings for zip-based deployments (WEBSITE_RUN_FROM_PACKAGE=1).
    • Enable Always On for non-HTTP triggers so timer, queue, and blob workloads stay active.
    • Use long-form CLI flags (for example, --resource-group) for maintainable runbooks.
    • Dedicated plans use az appservice plan create (not az functionapp plan create used by Premium).

Verification

Confirm that the host lists helloHttp, then run curl --request GET "http://localhost:7071/api/hello" and verify a 200 OK response with a JSON body {"message":"Hello, world"}.

See Also

Sources