Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-MgUserDefaultDrive pre-provision does not work #2975

Open
giertz opened this issue Sep 30, 2024 · 3 comments
Open

Get-MgUserDefaultDrive pre-provision does not work #2975

giertz opened this issue Sep 30, 2024 · 3 comments

Comments

@giertz
Copy link

giertz commented Sep 30, 2024

Describe the bug

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

According to the documentation this should work:

If a user's OneDrive isn't provisioned but the user has a license to use OneDrive, this request will automatically provision the user's drive, when using delegated authentication

It does however not, and the reason why is unclear.

I got a user with an Microsoft E3 license assigned and im using the permissions described in the documentation.

Expected behavior

OneDrive site get created

How to reproduce

$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@"

SDK Version

2.23.0

Latest version known to work for scenario above?

No response

Known Workarounds

Using PnP.PowerShell
Request-SPOPersonalSite -UserEmails <upn>

Debug output

Click to expand log ```

DEBUG: [CmdletBeginProcessing]: - Get-MgUserDefaultDrive begin processing with parameterSet 'Get'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [Agreement.ReadWrite.All, Application.Read.All, CloudPC.ReadWrite.All, DeviceManagementApps.ReadWrite.All, DeviceManagementConfiguration.ReadWrite.All, DeviceManagementManagedDevices.ReadWrite.All, DeviceManagementRBAC.ReadWrite.All, DeviceManagementServiceConfig.ReadWrite.All, Directory.ReadWrite.All, email, Files.Read, Files.Read.All, Files.ReadWrite.All, Group.Read.All, Group.ReadWrite.All, openid, Organization.ReadWrite.All, Policy.Read.All, Policy.ReadWrite.ConditionalAccess, PrivilegedAccess.ReadWrite.AzureADGroup, profile, RoleManagement.ReadWrite.Directory, RoleManagementPolicy.ReadWrite.AzureADGroup, Sites.Read.All, Sites.ReadWrite.All, User.Read, User.Read.All, User.ReadWrite.All].
DEBUG: ============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://graph.microsoft.com/v1.0/users//drive

Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; sv-SE),PowerShell/2024.2.2
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.23.0
client-request-id : d7f8cbb4-05d9-4c4f-aa22-d2bd810d8e67

Body:

DEBUG: ============================ HTTP RESPONSE ============================

Status Code:
Forbidden

Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 0a34bc4e-2aad-401f-aec7-7f3434c9154a
client-request-id : d7f8cbb4-05d9-4c4f-aa22-d2bd810d8e67
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Norway East","Slice":"E","Ring":"2","ScaleUnit":"001","RoleInstance":"OSL2EPF00000164"}}
Date : Mon, 30 Sep 2024 08:16:07 GMT

Body:
{
"error": {
"code": "accessDenied",
"message": "Access denied",
"innerError": {
"date": "2024-09-30T08:16:08",
"request-id": "0a34bc4e-2aad-401f-aec7-7f3434c9154a",
"client-request-id": "d7f8cbb4-05d9-4c4f-aa22-d2bd810d8e67"
}
}
}

Get-MgUserDefaultDrive_Get: Access denied

Status: 403 (Forbidden)
ErrorCode: accessDenied
Date: 2024-09-30T08:16:08

Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 0a34bc4e-2aad-401f-aec7-7f3434c9154a
client-request-id : d7f8cbb4-05d9-4c4f-aa22-d2bd810d8e67
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Norway East","Slice":"E","Ring":"2","ScaleUnit":"001","RoleInstance":"OSL2EPF00000164"}}
Date : Mon, 30 Sep 2024 08:16:07 GMT

DEBUG: [CmdletEndProcessing]: - Get-MgUserDefaultDrive end processing.

</details>


### Configuration

PSVersion                      7.4.5
PSEdition                      Core
GitCommitId                    7.4.5
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

### Other information

_No response_
@giertz giertz added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Sep 30, 2024
@ryanchrisw
Copy link

I just ran into this same issue.

@poikladevv88
Copy link

Same here. I really need this feature.
Because I am using Apple M3 Macbook, Which the PowerShell module "Microsoft.Online.SharePoint.PowerShell" does not support this arch...

@timayabi2020 timayabi2020 added Status: Needs Investigation and removed status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Oct 28, 2024
@worldsdream
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants