/azfunc-managedidentityexamples

Some example Azure Function code showing Managed Identity authentication to Microsoft Graph, Dataverse and Dynamics 365

Primary LanguageC#MIT LicenseMIT

Azure Functions with Managed Identities example

This repository serves as the example code for my blog post around using Managed Identities to connect to resources other than Azure, more specifically to SharePoint Online, Microsoft Graph and Dataverse.

Environment Variables

The code uses a couple of environment variables in order to be configurable:

  • DataverseUrl: only used when connecting to Dataverse, eg. https://org18120bff.crm4.dynamics.com
  • SiteCollectionUrl: only used when connecting to SharePoint Online, eg. https://contoso.sharepoint.com/sites/fabrikam
  • UserAssignedIdentity: only used when connecting with a user-assigned managed identity. If not provided, or empty, the code will fallback to using the system-assigned managed identity. Eg. 1ef91609-b506-48f7-a085-6bd89f928bfd

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.