Azure Functions 中的个人 One Drive Microsoft Graph 绑定绑定、个人、Functions、Azure

2023-09-06 18:08:04 作者:扎着GUCCI腰带的男人

如何将 One Drive Microsoft Graph Binding 与个人 One Drive 结合使用?

在使用 One Drive Input Binding 运行在 Azure 门户中创建的 Azure 函数时,发生异常并且我收到以下错误:

代码:BadRequest消息:租户没有 SPO 许可证.
Win10如何永久关闭Onedrive 怎么禁用Onedrive

由于我在这个 azure 租户上没有 Office 365,我知道如果 One Drive Business 向我请求文件但我使用的是 Microsoft 帐户 (UserFromId),我可能会遇到这种错误.

解决方案

您需要从 AAD 为 azure 功能配置 Microsoft 帐户身份验证

然后选择微软账号

转到此链接

注册一个新的应用程序然后将客户端密码添加到应用程序

并授予它更新权限或对 Onedrive 进行读写要获取用户 ID:如下输入您的 azure 函数 URL 以进行身份​​验证

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).

解决方案

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: