Search code examples
visual-studio-codeazure-functionsazure-functions-core-toolsazurite

Starting Azurite when debugging (F5) Azure Functions with VS Code


Does anyone know if there's a simple, recommended way to always background start/stop Azurite using a temp directory when F5 debugging in VS Code, like Visual Studio proper does, maybe through the launch.json? I have the Azurite installed, so I can manually start the service and it works, but I find all of the __*__ files in my project directory to be really annoying. Not to mention the Azurite: Clean command never cleans everything due to file-level locks. My environment is up to date and currently as follows:

  • OS: Windows 11 23H2 (OS Build 22631.3527)
  • VS Code: 1.89.1 (w/ Azure, Azure Functions and Azurite extensions)
  • Azure Function Core Tools: 4.0.5700
  • Model: dotnet-isolated
  • Language: C#
  • local.settings.json contains "AzureWebJobsStorage": "UseDevelopmentStorage=true"

Solution

  • This has been annoying me for years and I finally found an answer after digging into the Azure Functions issue log and finding Issue 3876. Until something is done to resolve this, the simple fix is to replace

    {
      //...
      "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=True"
        // ...    
      }
    }
    

    with this

    {
      //...
      "Values": {
        "AzureWebJobsStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10010/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10011/devstoreaccount1;TableEndpoint=http://127.0.0.1:10012/devstoreaccount1;"
        // ...    
      }
    }