Temp directory files persistence in Azure Functions

HKPR 41 Reputation points
2022-07-23T11:27:02.113+00:00

Listened that the file uploaded to the temp directory when running the azure functions, gets deleted automatically.
When I ran the function in the same session each time, the files are in the temp directory for each run - why they are being available for each run, they should get deleted but not?

If they are not deleted, any security issues when files are in that temp directory because consumption plans mean sharing resources.

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

Accepted answer
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2022-07-25T09:44:55.01+00:00

    Hi @HKPR ,

    Thanks for reaching out to Q&A.

    The files present in the Temp directory are temporary files, they are deleted automatically once in 12 hours (not after each run) or if the app is restarted. Unlike Persisted files, these files are not shared among site instances. Also, you cannot rely on them staying there. So there are no security issues concerned here.

    Please look into this article for more details: https://github.com/projectkudu/kudu/wiki/Understanding-the-Azure-App-Service-file-system#temporary-files

    Hope this helps! Feel free to reach out to me if you have any queries or concerns.

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. David Broggy 6,371 Reputation points MVP Volunteer Moderator
    2022-07-24T05:43:09.167+00:00

    Hi @HKPR
    Yes, leaving data in a temp directory could definitely be a security issue.
    If possible you should clean up temp once you’re done with it, or ensure you’re not sharing that directory outside of you function.
    Good luck.


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.