简体   繁体   中英

Do temp files get automatically deleted after Azure function stops

I have an Azure function app with multiple Azure functions in it. The function app is running on the consumption plan and a linux os. In one of the Azure functions, each time it runs I'm saving a file to a /tmp directory so that I can use that file in the Azure function. After the Azure function stops running, if you don't delete this file from the /tmp directory will it automatically be deleted? And if it isn't automatically deleted, what's the security implications of having those files still there. I say this because, as I understand it, using the consumption plan means sharing resources with other people. I don't know if the tmp directory is part of those shared resources or not. But I'd rather not have other people be able to access files I write to the tmp directory. Thanks:)

I had read here

"Keep in mind though, that Functions is conceived as a serverless platform, and you should not depend on local disk access to do any kind of persistence. Whatever you store in that location will be deleted on other Function invocations."

I ran one of the Azure functions which uploads a file to that tmp directory each time it runs. From that link, I thought the files in tmp would be deleted each time I ran the function, but they persisted across each time that I ran the function. What am I getting wrong here?

Temp directory files are deleted automatically once in 12 hours of time but not after each run of the function app of if the function app is restarted.

It means the data stored in temp directory (For Eg, D:\local\Temp) in Azure, can exists up to the function host process is alive which means that temp data/files are ephemeral .

Persisted files are not shared among site instances and also cannot rely on those files by staying there. Hence, there are no security concerns here.

Please refer to the Azure App Service File System temporary files GitHub Document for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM