Azure / azure-functions-microsoftgraph-extension

Microsoft Graph extension for Azure Functions
MIT License
46 stars 23 forks source link

Error while accessing 'X-MS-TOKEN-AAD-ID-TOKEN' #31

Closed TechWatching closed 6 years ago

TechWatching commented 6 years ago

When I try to use microsoft graph binding I have an exception : "Error while accessing 'X-MS-TOKEN-AAD-ID-TOKEN': property doesn't exist.". I got that exception just by executing my azure function created from the new Microsoft Graph azure function templates.

I have AAD app registered that has been configured with access to the Graph API. Is there something else to do ? Is there something to put in the app settings (the readme on github mentions "The bindings can access the client secret (via appsettings) and use that to perform token exchanges.) ?

ConnorMcMahon commented 6 years ago

Can you tell us which exact templates you are using, and the name of the application settings you have set? Also, can you show us the contents of your function.json (at least the Graph binding part of the json)?

TechWatching commented 6 years ago

I tried with 2 different templates : "Outlook message webhook creator" and "Microsoft Graph profile photo API". I have the same error for both.

Appart from the configuration of authentication I did change anything to the functions created, I did not add any application settings, by default AzureWebJobsDashboard, AzureWebJobsStorage, FUNCTIONS_EXTENSION_VERSION, WEBSITE_CONTENTAZUREFILECONNECTIONSTRING, WEBSITE_CONTENTSHARE, WEBSITE_NODE_DEFAULT_VERSION were already configured. Concerning AAD configuration, everything is green when I click on the Ms Graph binding of the azure function in Azure.

Error is not the same when I set Identity of the Ms Graph binding from the default User.FromToken to ClientCredentials. I got a "Application with identifier '*-***--****' was not found in the directory microsoft.com". Do I need to set something in my application settings when identity is set to clientCredentials ?

I am afraid the errors just come from my misunderstanding of authentication identity but I can't figure out what I am doing wrong.

TechWatching commented 6 years ago

Seems to be directly linked to this issue, I did not see. Any other way to do that ?

ConnorMcMahon commented 6 years ago

@TechWatching, we unfortunately do not have a clean way to update extensions in the portal. I am working on a script that would allow individuals to upgrade the version of the AuthToken and GraphExtension. Note that this would prohibit you from utilizing the templates for both of these extensions.

TechWatching commented 6 years ago

Ok. That's fine, I don't really need to use the templates it was just a way to try the graph extension before really using it in an azure function I had planned to develop as a class library directly in VS. So I am very interested by your future script :) By the way I guess there is no way to debug such an azure function locally as authentication is involved, right ?

ConnorMcMahon commented 6 years ago

@TechWatching There is not currently a way to do that. There has definitely been a discussion around exactly what you were suggesting, but unfortunately there is no ETA on that.