Skip to content

Debugging Locally

hallvictoria edited this page Apr 2, 2024 · 2 revisions

Prerequisites:

  1. Follow the steps listed in the Debug Python Worker with Azure Functions Host Wiki to set up your local environment.
  2. Install the azure-functions-extension-blob library: pip install azure-functions-extension-blob
  3. In the Python Worker repo, checkout to the branch git checkout hallvictoria/sdk-bindings

Set up the Function App

  1. Set the AzureWebJobsScriptRoot variable in launchSettings.json in Visual Studio to the directory of the function app you want to test.

"AzureWebJobsScriptRoot": "...\\azure-functions-python-extensions\\azure-functions-extension-blob\\samples\\blob_samples_blobclient"

  1. Set the AzureWebJobsStorage variable in launchSettings.json in Visual Studio to the connection string of the storage account you want to connect to.

"AzureWebJobsStorage": "..."

  1. Set the path parameter of the Blob Trigger and Blob Input bindings in function_app.py to the path to your blob.

@app.blob_trigger(arg_name="client", path="test-input/test.txt", connection="AzureWebJobsStorage")

@app.blob_input(arg_name="client", path="test-input/test.txt", connection="AzureWebJobsStorage")

  1. Start the Functions Host process in Visual Studio.

  2. Execute the function by uploading a blob to the storage account or sending an HTTP request to the endpoint provided.

Clone this wiki locally