azure-functionsopenid-connect.net-8.0

OpenId Connect + .NET 8 Isolated - How to implement OIDC in an Azure Function?


I'm studying ways to integrate OpenId Connect with Azure Function + .NET 8 Isolated Mode and, as I haven't found better links on the internet, I would like to know the best way to do this and what steps I could follow.

I would like to know which examples I can follow, which links are useful for more practical research and to know the requirements to meet the demand.


Solution

  • First you need to register the App in Microsoft Entity ID and get the credentials.

    Refer this MSDoc to register the App with Identity Provider.

    enter image description here

    enter image description here

    https://funcad.azurewebsites.net/.auth/login/aad/callback
    

    OR

    For Localhost

    https://localhost:8000/.auth/login/aad/callback
    

    enter image description here

    My local.settings.json file:

    {
      "IsEncrypted": false,
      "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
        "AzureAd:Instance": "https://login.microsof****tonline.com/",
        "AzureAd:TenantId": "******",
        "AzureAd:ClientId": "******",
        "AzureAd:ClientSecret": "******"
      }
    }
    

    Thanks @Try Catch Debug for the clear steps to integrate code in Program.cs and Function file.

    Refer this doc and integrate the code.