#Azure – Reading configuration values in Azure Functions

Buy Me A Coffee

Hi !

I was learning about Azure Vault and Azure Functions, and it’s been an interesting ride. This tweet summarizes this ride 😎😁😎

So while I a was using Functions, I realized that at the end, we are working with WebApps. So, we have access to standard App Configurations.

Note: I’ll call it standard, however this reveal how old I am, remembering Asp.Net apps and web.config files.

Moving On, in the Azure Portal, we can access the Function Configuration via Function // Settings // Configuration.

As the official documentation describes

In App Service, app settings are variables passed as environment variables to the application code.

So, it super easy to access this with a simple line of code. The next examples shows how to read an environment variable named “dbConnectionString” where I store a connection string.

var cnnString = Environment.GetEnvironmentVariable("dbConnectionString", EnvironmentVariableTarget.Process);

Super easy ! and it also have the checks for security:

App settings are always encrypted when stored (encrypted-at-rest).

My next step in my journey will be describe how to also do this with KeyVault. And share some insights on both scenarios.

References

Happy coding!

Greetings

El Bruno



¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.