msgraph-sdk-dotnet icon indicating copy to clipboard operation
msgraph-sdk-dotnet copied to clipboard

The origin property in PermissionScope cannot be set

Open JesperLeerberg opened this issue 2 years ago • 3 comments

Describe the bug If you set this property and send it to the graph you will get an error. Not setting this or having null works. The graph Docs does not have this property in their docs. I assume it depends on what the backend API consumes.

To Reproduce Update an application registration with the new scope where the model PermissionScope has the Origin property set to e.g. "Application".

Expected behavior HTTP/1.1 204 No Content

Screenshots https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/bee6cabf551d4cddd066d31101892423dd659a8c/src/Microsoft.Graph/Generated/model/PermissionScope.cs#L52

Graph docs: https://docs.microsoft.com/en-us/graph/api/resources/permissionscope?view=graph-rest-1.0

SDK version: 4.35.0

JesperLeerberg avatar Aug 31 '22 11:08 JesperLeerberg

Thanks for raising this @JesperLeerberg

We generate the client library from https://graph.microsoft.com/v1.0/$metadata and the property is present as shown below. Unfortunately, the metadata does not give info on whether a property can or cannot be set.

image

Any chance you can share more information on the exact error you receive when you set the property (error message and client-request-id) to help feedback to the relevant API team?

andrueastman avatar Sep 05 '22 09:09 andrueastman

Sure, here is the error that the graph returns.

Code: Request_BadRequest Message: Expected property 'origin' is not present on resource of type 'PermissionScope' Inner error: AdditionalData: date: 2022-09-05T13:38:19 request-id: cf3c9b0a-807e-46c0-bbf9-262ab34dba7d client-request-id: cf3c9b0a-807e-46c0-bbf9-262ab34dba7d ClientRequestId: cf3c9b0a-807e-46c0-bbf9-262ab34dba7d

JesperLeerberg avatar Sep 05 '22 13:09 JesperLeerberg

API team has acknowledged this is a bug and have created https://identitydivision.visualstudio.com/Engineering/_workitems/edit/2059105 to track and fix.

andrueastman avatar Sep 07 '22 04:09 andrueastman

Hi @andrueastman , do you have any news on this ?

This issue lasts for a few months now and despite some minor updates on the NuGet, it's still there.

Or maybe a turnaround to suggest ? Use directly the API without the SDK or anything else

EDIT : My bad, it can be done by removing this property directly from the call. But still strange to have a SDK more up-to-date than the API it calls.

BastienPerdriau avatar Jan 30 '23 12:01 BastienPerdriau

it can be done by removing this property directly from the call. But still strange to have a SDK more up-to-date than the API it calls.

Thanks for this as the API team is still yet to fix this.

andrueastman avatar Feb 02 '23 06:02 andrueastman

I'm unable to use the MsGraph SDK for my project and still must resort to using the Azure CLI from PowerShell. 😦 Yes, this is an uncommon case but is a huge quality issue that wastes developer time and encourages them to use different approaches.

mikaelweave avatar Jun 06 '23 19:06 mikaelweave

@mikaelweave Can you help me understand the specific issue you had that prevented you from using the SDK? What were you trying to do that you weren't able to do?

psignoret avatar Oct 31 '23 23:10 psignoret

@psignoret - has been a while since I looked at this code tbh. Last project. Essentially, I remember that I could not use the library because the types didn't match and the error I saw was like @JesperLeerberg. I did not see the workaround of just removing the property.

mikaelweave avatar Nov 01 '23 21:11 mikaelweave