How to run a function from a Azure Function App local in VS Code?

Khalid Hajjouji 50 Reputation points
2025-04-08T09:02:54.5866667+00:00

I created a simple pipeline with (Bicep and Yaml) which creates an Azure Function App (PowerShell) with 1 function. I can modify the PowerShell code in VS Code and commit/sync (GIT) it to Azure Dev Ops repository. I can run the pipeline to deploy the latest version to the Azure Function App.

How can I run the function from VS Code local to test it? I am using some PowerShell modules from the requirements.psd1 file.

User's image

User's image

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Khadeer Ali 5,990 Reputation points Microsoft External Staff Moderator
    2025-04-10T14:51:39.04+00:00

    @Khalid Hajjouji ,

    Yes, you can run your Azure Function App locally using either Visual Studio Code or the command line:

    Option 1:

    1. Open your project in Visual Studio Code where your Azure Function App is located.
    2. Ensure you have the Azure Functions extension installed, as it provides the necessary tools to run and debug your functions locally.
    3. Set up your local environment: Make sure your local.settings.json file is configured correctly, including any required connection strings and settings for your PowerShell modules.
    4. Run the function locally:
      1. The output will be displayed in the Terminal panel, and any notifications regarding the execution will appear in Visual Studio Code.
      2. Press F5 to start debugging your function. This will use the Azure Functions Core Tools to run your function locally.
    5. View the output:
      • Alternatively, you can use the command palette (Ctrl+Shift+P) and enter Azure Functions: Execute function now. Choose your function from the list and provide any required input in the prompt.

    Option 2: Using Command Line

    Open a terminal and navigate to your function app’s root directory.

    Run:

    
    func start
    

    This starts the local Azure Functions runtime and exposes your function endpoints on http://localhost:7071.

    📄 References:

    Run functions locally

    Develop PowerShell functions in VS Code

    PowerShell developer guide

    These options allow you to test and debug your Azure Function locally before deploying it through your pipeline.

    Hope this helps. Do let us know if you have any further queries.


    If this answers your query, do click Accept Answer and Yes for "Was this answer helpful." And if you have any further questions, let us know.


    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.