Search code examples
azure-functionsazurite

Azurite Error: "Exit Due to Unhandled Error" when Running Azure Function Project


Good day fellow developer,

I would like to ask for help regarding running my Azure Function project using Visual Studio 2022.

Here's what happened, just after our Visual Studio 2022 was updated by our IT admin, we can no longer run our Azure Function project. When running the command: "C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator\azurite.exe" we encounter the following error: "Exit due to unhandled error: listen EADDRINUSE: address already in use 127.0.0.1:10001". See screenshot below:enter image description here

I have already tried some solutions listed in this link Azure Storage Emulator error and does not start, but we can't try the solutions that involve running CMD as an "Administrator" since our IT admin is the only one with access.


Solution

  • The following steps resolved my issue:

    1. Create a local storage accounts from Microsoft Azure Storage Explorer application. Customized the ports of the following: Blobs, Queues, and Table. See sample below:

    enter image description here

    1. Initialize the ports for the newly created storage accounts.

      C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\Extensions\Microsoft\Azure Storage Emulator\azurite.exe" --blobPort 20000 --queuePort 20001 --tablePort 20002 --silent --location c:\azurite --debug c:\azurite\debug.log

    see reference: https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azurite?tabs=visual-studio%2Cblob-storage