HeatherTurner-8540 avatar image
0 Votes"
HeatherTurner-8540 asked ·

Create new app role in B2C via Microsoft Graph

Hello, Im trying to create a new app role using Microsoft Graph via B2C. Is this possible using graph or only approleassignments with already existing app roles? Here is a code snippet that I am using:

 var application = new Application
                     DisplayName = "HeathersTestApp022321c",
                     Description ="HeatherDescription"
                 await _graphServiceClient.Applications
                 var appRole = new AppRole()
                     Id = Guid.NewGuid(),
                     DisplayName = "MyAppRole",
                     IsEnabled = true,
                     Description = "MyAppRoleDescription",
                     AllowedMemberTypes = new List<string>() { "User", "Application" }
                 application.AppRoles = new List<AppRole>() { appRole };
                 await _graphServiceClient.Applications[http://application.Id]

Im getting the following error on the last line when calling UpdateAsync on the application: Specified HTTP method is not allowed for the request target`enter code here`

· 8
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks @Heather and could you please verify the permission of the registered application such as Application.ReadWrite.All, Directory.ReadWrite.All and AppRoleAssignment.ReadWrite.All.

Please share the fiddle trace graph api requested with correlation or request id with timestamp to investigate more.

0 Votes 0 ·


Screenshot of the permissions

0 Votes 0 ·
screenshot-358.png (57.5 KiB)

Will the requestId/clientrequestid get you what you need:

"Code: Request_BadRequest\r\nMessage: Specified HTTP method is not allowed for the request target.\r\nInner error:\r\n\tAdditionalData:\r\n\tdate: 2021-02-25T15:57:32\r\n\trequest-id: 184acbfd-c9b7-4832-afcd-bbeb075b34a7\r\n\tclient-request-id: 184acbfd-c9b7-4832-afcd-bbeb075b34a7\r\nClientRequestId: 184acbfd-c9b7-4832-afcd-bbeb075b34a7\r\n"

0 Votes 0 ·
Show more comments

0 Answers