Skip to content
Switch branches/tags
Go to file
Cannot retrieve contributors at this time
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
$VM = Get-AzVM -Name "pfsense"
$StartRtn = $VM | Start-AzVM -NoWait -ErrorAction Continue
$HTML = New-Object -TypeName "System.Text.StringBuilder"
[void]$HTML.AppendLine( @"
<!DOCTYPE html>
<title>Start VM status</title>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
<h1> <br />
SelfService VPN starter</h1>
Result from starting the VM is: <br/>
# Associate values to output bindings by calling 'Push-OutputBinding'.
Push-OutputBinding -Name Response -Value (@{
StatusCode = "Ok"
ContentType = "text/html"
Body = $HTML.ToString()