简体   繁体   English

从 azure ML 笔记本脚本访问 onedrive - 400 客户端错误租户没有 SPO 许可证

[英]access onedrive from azure ML notebook script - 400 Client Error Tenant does not have a SPO license

im trying to access my onedrive from an azure ML script , both using same account ( though the azure one is personal while the onedrive one is work ) .我试图从一个 azure ML 脚本访问我的 onedrive,两者都使用相同的帐户(尽管 azure 是个人的,而 onedrive 是工作的)。 The connection succeeds but then gives a 400 error...any idea why ?连接成功,但随后出现 400 错误……知道为什么吗? thanks ---------------- Authenticated!谢谢---------------- 已认证! Client Error: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/drive/root |客户端错误:400 客户端错误:对 url 的错误请求: https ://graph.microsoft.com/v1.0/drive/root | Error Message: Tenant does not have a SPO license.错误消息:租户没有 SPO 许可证。

--------------
from O365 import Account

credentials = ('client id xxxx 6fb8a4', 'secret value xxxxx v6Hyoa2K')
account = Account(credentials,auth_flow_type='credentials',tenant_id='87xxxxx8-3db7f7',main_resource='myemail@email.com')

storage = account.storage()

if account.authenticate():
    print('Authenticated!')
    
my_drive = storage.get_default_drive() 
root_folder = my_drive.get_root_folder()

# iterate over the first 25 items on the root folder
for item in root_folder.get_items(limit=25):
    if item.is_folder:
        print(list(item.get_items(2))) # print the first two element on this folder.

Client Error: 400 Client Error: Bad Request for url: https://graph.microsoft.com/v1.0/drive/root |客户端错误:400 客户端错误:对 url 的错误请求: https ://graph.microsoft.com/v1.0/drive/root | Error Message: Tenant does not have a SPO license.错误消息:租户没有 SPO 许可证。

The error you are getting for that you need to notice the couple of things.你得到的错误是你需要注意的几件事。 Please check the points stated in this stackover flow reference which says,请检查此stackover flow 参考中所述的要点,其中说,

Office 365, Azure Active Directory, EMS (Enterprise Mobility Suite), personal Outlook, personal OneDrive, and other Microsoft cloud services are all accessible through the developer portal or API known as Microsoft Graph. Office 365, Azure Active Directory, EMS (Enterprise Mobility Suite), personal Outlook, personal OneDrive, and other Microsoft cloud services都可以通过开发人员门户或称为 Microsoft Graph 的 API 访问。 The API is free to use, but in order to access the data it hides, you must have those services, some of which may be free and others of which you may have to pay for. API 可以免费使用,但要访问它隐藏的数据,您必须拥有这些服务,其中一些可能是免费的,而另一些可能需要付费。

Regarding integrating Office 365 into your current tenant.关于将 Office 365 集成到您当前的租户中。 I believe you used a Microsoft Account to join up for Azure.我相信您使用 Microsoft 帐户加入 Azure。 For that tenant, you can still buy or acquire Office 365. You may have to add a new Azure AD user to your tenant (not a Microsoft Account) and give them company admin privileges.对于该租户,您仍然可以购买或获取 Office 365。您可能需要向您的租户(不是 Microsoft 帐户)添加新的 Azure AD 用户并授予他们公司管理员权限。 Whether it asks if you already have a tenant or account, login in with the AAD account you just generated.无论它询问您是否已经有租户或帐户,请使用您刚刚生成的 AAD 帐户登录。 You should then be able to sign up for Office 365. And there you have it an Azure AD tenant with both an Azure AND an Office 365 subscription.然后,您应该能够注册 Office 365。您就拥有了一个 Azure AD 租户,同时拥有 Azure 和 Office 365 订阅。

Solution : You must be using an Office 365 Home license for you azure ad tenant.解决方案:您必须为您的 Azure 广告租户使用 Office 365 家庭版许可证。 For SharePoint Online you need an Office 365 Business account .对于 SharePoint Online,您需要一个 Office 365 商业帐户。

You need a license that include all the OneDrive service (Operation).您需要包含所有 OneDrive 服务(操作)的许可证 So, recommendation is Office 365 Business Essentials which is the cheapest and has Microsoft Graph functionality - more than just upload/manipulate Excel files in OneDrive in future.因此,建议使用最便宜且具有 Microsoft Graph 功能的 Office 365 Business Essentials,而不仅仅是将来在 OneDrive 中上传/操作 Excel 文件。

So from the above conclusion, you can't use the Microsoft Graph API to access OneDrive data(read and upload) without having SharePoint Online (which only comes with the business licenses).所以从上面的结论来看,没有SharePoint Online(只有商业许可证)就不能使用Microsoft Graph API访问OneDrive数据(读取和上传)。

Reference:参考:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 尝试使用 GraphAPI 访问驱动器项目时出现“租户没有 SPO 许可证” - “Tenant does not have a SPO license” when trying to access drive items with GraphAPI 对于 Azure Graph API / OneDrive API 访问读取文件(列表和下载)而言,需要 SPO 意味着什么 - What does SPO required mean for Azure Graph API / OneDrive API access to read files (list and download) 使用 Azure AD 多租户访问个人帐户 Onedrive - Access personal accounts Onedrive with Azure AD Multi tenant 在 Azure 数据工厂中创建 Azure ML 链接服务时出错:具有 object id xxx 的客户端 xxx 无权执行操作' - error creating an Azure ML linked service in Azure Data Factory : The client xxx with object id xxx does not have authorization to perform action ' 在Azure ML Python脚本中访问GlobalParameters - Access GlobalParameters in Azure ML Python script 消耗带有Node.js错误400状态代码的AZURE ML - Consume AZURE ML with nodejs error 400 status code 如何在 Azure ML Studio 笔记本中访问自定义 Azure 注册 ML Model - How to Access a Custom Azure Registered ML Model in the Azure ML Studio Notebook 如何从 Azure 中的另一个租户访问一个租户中的资源? - How to access resources in one tenant from another tenant in Azure? 在 Azure ML Studio 笔记本中导入 MobilenetV2 模型时出错 - Error in importing MobilenetV2 model in Azure ML Studio notebook 是否有任何 PowerShell 脚本或命令可以从 Azure 门户获取租户中所有用户访问角色的报告? - Is there any PowerShell script or command to get a report of all the user's access role in tenant wise from Azure portal?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM