Create new app role in B2C via Microsoft Graph
Heather Turner
66
Reputation points
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
.Request()
.AddAsync(application);
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]
.Request()
.UpdateAsync(application);
Im getting the following error on the last line when calling UpdateAsync on the application: Specified HTTP method is not allowed for the request targetenter code here