You can run PowerShell scripts on Windows virtual machines using the custom scripts feature after uploading the scripts to a blob container.
The following figure is an example of an Azure container storing a PowerShell script file:
The following PowerShell script is an example of how to create a backup of an SQL Server database and write the results to a log file on the machine, the log file name is generated based on the script’s execution time. The snapshot itself is not application consistent, but the database will be backed up before the snapshot is created. You can use alternative scripts and options to make this an application consistent snapshot.
For the PowerShell script to create successful backups of SQL Server, you must provide the NT AUTHORITY\SYSTEM account permissions to create database backups (it might be enabled is some systems):
The Event Viewer displays the backup results. The following figure shows how a successful backup looks like: