This is an example project based on Microsoft.Identity.Web
that demonstrates a Web API that
- can be used in the "From Web" PowerQuery option in Excel with Azure Active Directory authentication, and
- uses the provided credentials to call the Graph API.
This needs an app registration in Azure with
- API permissions for the Graph calls that you want to do (with appropriate consent for your tenant)
- A configured Application ID URI (under "Expose an API" in app registrations) that matches the
Uri
setting in the config - An authorized client application (same tab) of
d3590ed6-52b3-4102-aeff-aad2292ab01c
(Microsoft Office) withuser_impersonation
scope - A client ID, secret and tenant ID set up in the
AzureAd
configuration section
The sample can be used as follows:
- Ensure that the configured application uri resolves to localhost (e.g. by adding it in your
hosts
file) - In Excel choose "Data" -> "From Web"
- Enter the chosen uri with an appropriate endpoint (in the sample,
/Test/{siteName}
should get info for a SharePoint site) - You should be asked to log in using your AAD credentials