
It is possible to upload files to an OneDrive account via Graph API in the following method
- Create Azure AD application to use for the purpose
- Configure Permissions for the application
Microsoft graph -> Application Permissions -> Files.ReadWrite.All, Sites.ReadWrite.All
- Get access token and use it in the following command
ACCESS_TOKEN=htI2eXAiOiJ7R4QiNMKub25jZSI6IlZ0KYRT
curl -X PUT 'https://graph.microsoft.com/v1.0/me/drive/root:/foldername/file.tgz:/content' -H 'Authorization: Bearer '"${ACCESS_TOKEN}"'' -T test.tgz