Azure Dev
Azure Dev

Reputation: 105

Azure Function Temp Files Clean Up

I have an Azure Function v2 with c#.net core code running on dedicated App Service Plan. The function downloads files and then uploads them via Microsoft Graph to a Sharepoint Library.

My code looks like this
 var path = System.IO.Path.GetTempPath() + downloadedfileName;
 using (var stream = System.IO.File.Create(path)                
 {
    //put content from downloaded file into stream
    //call graph to use the stream and upload the content.
 }

This code works fine, but I am concerned about running out of temp space. The question I have is:

  1. When will this temp file get cleared
  2. If it is not cleared automatically then how do i clear it?
  3. Is there any other alternative way to handle this upload scenario?

Upvotes: 1

Views: 3455

Answers (1)

suziki
suziki

Reputation: 14108

Please have a look of this doc.

There is no automatic method, you can only do it manually. Since Azure Function is a Web App sandbox, if you don't delete files in your code, the method you can choose is the restart site provided in the doc.

enter image description here enter image description here

Upvotes: 1

Related Questions