RazorSPoint
RazorSPoint

Accessing App Setting from Azure Functions with PowerShell

Sebastian SchützeSebastian Schütze

I am currently trying out a lot with Azure Functions. With CI / CD pipelines and how to automatically deploy them. But also trying out C# and PowerShell to be used with Azure Functions. When I came to use PowerShell with Azure Functions, I got to a problem.

I am using an Azure Function with a queue trigger to read from that trigger. This function currently is including an administrator account and a password in clear text. Not good I though. I could encrypt it before putting it into the queue and then decrypt it when getting it out. But I wanted to have these settings rather saved in the app settings of the function. But how to access these app settings?

Lets see the following PowerShell Script that you could use

What this does is basically getting all the environment variables, converting them into a string and output them to the logs. What you get is the following

There you can see variables starting with the name APPSETTING_ this means you could just access any app settings with the environment prefix. For example we want to access the standard variable QueueConnectionString. This would look like this

So now you know how to access app settings this PowerShell 🙂

 

Sebastian Schütze is working as a Senior SharePoint Developer since 2017 at Schindler Digital Business and from 2013-2017 as a SharePoint Consultant at Fritz & Macziol. Beforehand he also worked as a trainer for ASP.NET web development in the Microsoft Student Partner Program. His passion is dedicated to Microsoft technologies.