简体   繁体   English

在 Azure function 停止后是否会自动删除临时文件

[英]Do temp files get automatically deleted after Azure function stops

I have an Azure function app with multiple Azure functions in it.我有一个 Azure function 应用程序,其中包含多个 Azure 功能。 The function app is running on the consumption plan and a linux os. function 应用程序正在消费计划和 linux 操作系统上运行。 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.在 Azure 函数之一中,每次运行时,我都会将文件保存到 /tmp 目录,以便可以在 Azure ZC1C425268E68385D1AB5074C17A9F 中使用该文件。 After the Azure function stops running, if you don't delete this file from the /tmp directory will it automatically be deleted? Azure function停止运行后,如果你不从/tmp目录中删除这个文件,它会被自动删除吗? 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.我不知道 tmp 目录是否是这些共享资源的一部分。 But I'd rather not have other people be able to access files I write to the tmp directory.但我不希望其他人能够访问我写入 tmp 目录的文件。 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." “但请记住,Functions 被视为无服务器平台,您不应依赖本地磁盘访问来执行任何类型的持久性。存储在该位置的任何内容都将在其他 Function 调用中删除。”

I ran one of the Azure functions which uploads a file to that tmp directory each time it runs.我运行了 Azure 函数之一,该函数每次运行时都会将文件上传到该 tmp 目录。 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.从该链接中,我认为每次运行 function 时都会删除 tmp 中的文件,但每次运行 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.如果 function 应用程序重新启动,临时目录文件会在 12 小时内自动删除一次,但不会在每次运行function 应用程序后自动删除。

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 .这意味着存储在 Azure 的临时目录(例如D:\local\Temp)中的数据,可以存在到function 主机进程是活动的,这意味着临时数据/文件是短暂的。

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.有关详细信息,请参阅Azure 应用服务文件系统临时文件GitHub 文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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