The reason the file is not next to the WebJob's binaries is that before the WebJob is invoked it is first copied to a temporary directory (%temp%\jobs\triggered\jobName\randomName
) and is run from there, this way no file is locked and you can update the WebJob's binaries at any time.
The appropriate path to use when persisting a file with a WebJob is using the WEBROOT_PATH environment variable as it has the path to your wwwroot.
If you want this file to only be accessible privately (as wwwroot is publicly visible), you can go up one level, for example: %WEBROOT_PATH%/../output.json
.
Another option is to use: d:\home
, for context wwwroot is at: d:\home\site\wwwroot
.
To access that file use the following url: https://SiteName.scm.azurewebsites.net/vfs/site/output.json and you'll need to provide your deployment credentials.