I have a Windows Azure Function on the consumption plan.
It uses Process.Start to run a Windows .exe (app.exe). App.exe reads a local file in the temp directory and writes to the same directory. I use unique file names to keep files from different AF instances from colliding.
This works, but there is very little available drive space in the directory returned by Temp.GetFilePath.
I could use the directory returned by reading the value of the HOME environment variable. This works, but is very slow because this drive is an Azure File Share.
I created a Premium Azure Storage file share. $15 for 100 gigs for a month is a good price and plenty of space.
My goal is to mount this Azure Storage file share from the Azure Function Windows app, so App.exe can use it.
I'm familiar with Azure.Storage.Blobs, but that won't work here. I'm not writing C# code in this case. App.exe, a legacy app, expects a Windows directory with read/write permissions.
I tried running this script from a Bash shell in the Azure Portal:
az webapp config storage-account add -g myresrourcegroup -n myazurefunction -i files -t AzureFiles -a myfilestorageaccountname --sn files -k mykey -m /files
with the "my" values replaced with the correct values for my resource. I get a "bad request" error.
I tried running the standard Powershell script I would run in Windows to mount a drive, in Azure Portal Advanced Tools, but I get errors as well.
$connectTestResult = Test-NetConnection -ComputerName http://myfileshare.file.core.windows.net -Port 445
Write-Progress : Win32 internal error "The handle is invalid" 0x6 occurred
while reading the console output buffer. Contact Microsoft Customer Support
Services.
At C:\Windows\system32\WindowsPowerShell\v1.0\Modules\NetTCPIP\Test-NetConnecti
on.psm1:264 char:13
- Write-Progress -Activity $ProgressString -Status "Attempt ...
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : ReadError: (:) [Write-Progress], HostException
- FullyQualifiedErrorId : ReadConsoleOutput,Microsoft.PowerShell.Commands.
WriteProgressCommand
etc.
Please advise as to the simplest way to mount an Azure Storage File Share from an Azure Function Windows on the consumption plan.
Thanks!
Adam Leffert
https://www.fullstackdeveloper.com