Automatically initialize variables in Azure Functions


When working with Azure Functions and passing parameters in the HTTP request, this piece of Powershell comes in handy every time.

$Request.Query.GetEnumerator() | ForEach-Object { New-Variable -Name $_.Key -Value $_.Value }

This will make a variable from each parameter you pass in the request.
So for example;

If you request the following Azure functions URL:

You will automatically have a parameter “myname” which you can use in your script.


Thank you for reading my blog.
If you have any questions or feedback, leave a comment or drop me an email.

Darryl van der Peijl      

Leave a Reply

Your email address will not be published. Required fields are marked *