microsoftgraph / microsoftgraph/msgraph-sdk-powershell
New-MgGroupDriveRootPermission returns "Invalid request" when using -GrantedToV2
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 898
- Forks
- 230
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 31
Description
Thanks for reporting the bug. Please ensure you've gone through the following checklist before opening an issue:
- Make sure you can reproduce this issue using the latest released version of Microsoft.Graph or Microsoft.Graph.Beta.
- Please search the existing issues to see if there has been a similar issue filed.
- For issues related to authentication and service errors, please refer to our troubleshooting guide. For service issues, please open a question at https://developer.microsoft.com/graph/support.
Describe the bug
When running New-MgGroupDriveRootPermission to grant permission to an identity to a DriveID, using a MicrosoftGraphSharepointIdentitySet object, it returns
New-MgGroupDriveRootPermission_CreateExpanded: Invalid request
Status: 400 (BadRequest)
ErrorCode: invalidRequest
To Reproduce
$driveid = replace with drive id
$groupid = replace with group id
Create a new SharePointIdentitySet object
$identitySet = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphSharePointIdentitySet
Create a new Identity object and assign the Application ID
$identitySet.Application = New-Object -TypeName Microsoft.Graph.PowerShell.Models.MicrosoftGraphIdentity
$identitySet.Application.id = replace with application ID
$identitySet.Application.displayName = replace with application display name
New-MgGroupDriveRootPermission -DriveId $driveid -GroupId $groupid -GrantedToV2 $identitySet -Roles "write"
Expected behavior
The application defined in the identity set is granted Write permission to the Drive ID.
Debug Output
Run the problematic command with
-Debugand paste the resulting debug stream below.
⚠ ATTENTION: Be sure to remove any sensitive information that may be in the logs.
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
POST
Absolute Uri:
https://graph.microsoft.com/v1.0/groups/redacted/drives/redacted/root/permissions
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.22631; en-US),PowerShell/2024.0.0
Accept-Encoding : gzip
SdkVersion : graph-powershell/2.16.0
client-request-id : 7b8ef232-f324-41a7-9037-ccc339121011
Body:
{
"roles": [
"write"
],
"grantedToV2": {
"application": {
"displayName": "redacted",
"id": "redacted"
}
}
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Cache-Control : no-store, no-cache
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : dead29e3-d0e5-4a77-874b-4482b7eac02c
client-request-id : 7b8ef232-f324-41a7-9037-ccc339121011
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada East","Slice":"E","Ring":"2","ScaleUnit":"001","RoleInstance":"QB1PEPF000051A3"}}
Link : https://developer.microsoft-tst.com/en-us/graph/changes?$filterby=v1.0,Removal&from=2021-09-01&to=2021-10-01;rel="deprecation";type="text/html",https://developer.microsoft-tst.com/en-us/graph/changes?$filterby=v1.0,Removal&from=2021-09-01&to=2021-10-01;rel="deprecation";type="text/html"
deprecation : Fri, 03 Sep 2021 23:59:59 GMT
sunset : Sun, 01 Oct 2023 23:59:59 GMT
Date : Thu, 28 Mar 2024 16:32:09 GMT
Body:
{
"error": {
"code": "invalidRequest",
"message": "Invalid request",
"innerError": {
"date": "2024-03-28T16:32:10",
"request-id": "dead29e3-d0e5-4a77-874b-4482b7eac02c",
"client-request-id": "7b8ef232-f324-41a7-9037-ccc339121011"
}
}
}
Module Version
Please run
Get-Module Microsoft.Graph*after cmdlet execution and paste the output below.
If a module cannot be installed or imported, please runGet-Module -ListAvailableand paste the output.
2.16.0
Environment Data
Please run
$PSVersionTableand paste the output below. If running the Docker container image, indicate the tag of the image used and the version of Docker engine.
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
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
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the New-MgGroupDriveRootPermission entry point and reproduce the request using the MicrosoftGraphSharePointIdentitySet example with -Debug. Compare the generated request with the Microsoft Graph permissions API expectations; done means the application receives write permission instead of the 400 Invalid request response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100