How can I set the client Id for a Function App without setting explicit authentication

Parag Kale 25 Reputation points
2025-04-28T16:29:34.3433333+00:00

Hi,

I have a function App in my environment where the authentication is not explicitly set up, since the http triggered functions currently use function key as the anonymous level

However In the same function app we have set up durable functions monitor , as we can't use a dedicated function app just for durable function monitor for some reason.

Hence we don't prefer to set explicit authentication using Authentication tab in the function app. Is there any way I could set the environment variable WEBSITE_AUTH_CLIENT_ID for the function app without setting the authentication tab in the function app?

Since we do want to authenticate the durable function monitor.

Looking at the code of https://github.com/microsoft/DurableFunctionsMonitor, I am trying to make the authentication work by setting some environment variables like WEBSITE_AUTH_CLIENT_ID and a couple other that start with WEBSITE_

Appreciate your help in this

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,781 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Loknathsatyasaivarma Mahali 1,875 Reputation points Microsoft External Staff Moderator
    2025-04-29T00:06:14.8866667+00:00

    Hello Parag Kale,

    If you're leveraging the Graph library, you can configure Azure AD settings like ClientId in your Function App, add them as application settings using the format AzureAd__ClientId and AzureAd__TenantId (note the double underscores for nested keys). These will be available via IConfiguration in your code, e.g., _configuration["AzureAd:ClientId"] or _configuration.GetSection("AzureAd")["ClientId"]. If you're not leveraging MSAL, you can simply create ClientId application setting/environment variable and pull it in code using _configuration["ClientId"];. For local development, you can set the same keys in local.settings.json under the Values section. This approach keeps your configuration environment-specific, secure, and easy to manage.

     

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.