I'm working with PowerShell and Azure functions, both which are new to me, but it's choices I've been tasked to work with.
What I reeeally want to do is this:
Invoke-RestMethod -Method GET -Uri $uri -Headers $headers -Body $body -OutFile $outfile -UseBasicParsing -DisableKeepAlive
Temporarily write the REST response to $outfile
and then a moment later in the script I'll upload the file via FTP to somewhere else and then won't need it anymore.
Of course, this works great locally. But in Azure I essentially get that the file cannot be found at the $outfile
path location. It shouldn't be trying to find it there anyway, but I can only guess I don't actually have permissions to write to that file system.
So if you know of a way for me to write a temp file here, that would be preferred!
Incase not, some blob storage was generated with the function app and I've got an environment variable of AzureWebJobsStorage
with the account name, key, etc, for that storage. So maybe I can write the files to there, then read them back.
But, I can't find any documentation anywhere of how to do this in PowerShell. There's a lot of talk out there of the AzureWebJobsStorage
variable, but I didn't find anywhere where it was actually used with an example of how to read and write in PowerShell. Again, because I'm just very new to the language.
Any assistance would be greatly appreciated. Thanks!