Azure Automation

Azure Automation enables PowerShell (and more) to be executed as runbooks by runbook workers hosted in Azure. Additionally Azure Automation accounts bring capabilities such as credential objects to securely store credentials, variables, scheduling and more. When a runbook executes it runs in a temporary environment that does not have any persistent state and so if you want to work with files you need to save them somewhere, for example to an Azure storage account as a blob, before the runbook completes.

You can actually create and use files as normal using the default path within PowerShell during execution, just remember to save the files externally before the script completes.

For example create a file as usual:

Creating and writing to a file

PowerShell

1

2

3

4

5

$todaydate=Get-Date-FormatMM-dd-yy

$LogFull="AzureScan-$todaydate.log"

$LogItem=New-Item-ItemTypeFile-Name$LogFull

" Text to write"|Out-File-FilePath$LogFull-Append

Then before ending the PowerShell, copy it to a blob (as an example storage place):