I want to pre-provision users OneDrive using the following method:
https://learn.microsoft.com/en-us/graph/api/drive-get?view=graph-rest-1.0&tabs=powershell
This does not however work, and the reason why is unclear.
I got two test users which both has a M365 E3 license assigned.
I'm using the permissions described in the documentation. Running 'Get-MgUserDefaultDrive' for both users gives two different errors.
$Scopes = @(
'Files.Read'
'Sites.ReadWrite.All'
'Sites.Read.All'
'Files.Read.All'
'Files.ReadWrite.All'
)
Import-Module Microsoft.Graph.Files -RequiredVersion 2.23.0
Connect-Graph -Scopes $Scopes
Get-MgUserDefaultDrive -UserId "user1@<domain>"
Get-MgUserDefaultDrive -UserId "user2@<domain>"
The documentation states:
If the drive doesn't exist and can't be provisioned automatically (when using delegated authentication) an HTTP 404
response will be returned.
I've also tried adding a bunch of other permissions but the results are the same. No idea either why i'm getting two different error messages. So the question is why? What am i missing?