Personal One Drive Microsoft Graph binding in Azur

2019-07-22 00:55发布

问题:

How do you use the One Drive Microsoft Graph Binding with personal one drive ?

When running an Azure Function created in Azure Portal with One Drive Input Binding, an exception occurs and I receive the following error :

Code: BadRequest
Message: Tenant does not have a SPO license.

As I don't have Office 365 on this azure tenant, I understand that I could have this kind of error if I was requested a file from One Drive Business but I am using a Microsoft account (UserFromId).

回答1:

You need to configure Microsoft account authentication for the azure function from AAD https://docs.microsoft.com/en-us/azure/app-service/configure-authentication-provider-microsoft When you configure Input Binding click manage

then choose mIcrosoft account

Goto this link https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/applicationsListBlade

choose manage personal account

register a new application and then add the client secret to the application

and give it update permission or read write to Onedrive To get the user ID: enter your azure function URL as below to authenticate https://yourfunction.azurewebsites.net/.auth/login/aad

then access https://yourfunction.azurewebsites.net/.auth/me grab user_id

enter your outlook.com user ID as below: