title: Azure SDK for .NET authentication - where to keep the generated service principal?
body: <p>I'm trying to understand how to authenticate with Azure during development and production.</p>
  
  <p>For development I followed the instructions here: <a href="https://docs.microsoft.com/en-us/dotnet/azure/dotnet-sdk-azure-get-started?view=azure-dotnet#set-up-authentication" rel="nofollow noreferrer">documentation</a></p>
  
  <p>I now have a file and an environment variable that the Azure SDK uses for authentication.</p>
  
  <p>However for production I don't know where to put this file. In this case, production is itself a set of Azure Functions which uses the Azure SDK. In the documentation the service principal is stored on <code>C:\</code>.</p>
  
  <p>Should I forgo the environment variable and instead place the service principal file in my <code>src</code> directory (and exclude it from commits of course) and then make sure the file is copied to the output so that it is present for both development and production?</p>
  
  <pre><code>var credentials = SdkContext.AzureCredentialsFactory
          .FromFile("service-principle.json"); // same dir as the Azure Function DLLs
  </code></pre>