I am trying to assign a SecurityRole to the user using the oData rest endpoints. Here are the details:
- URL: https://<trial-tenant>.trial.operations.dynamics.com/data/SecurityUserRoles
- Http Method: POST
- Json Body::{
"SecurityRoleIdentifier":"LedgerAccountant",
"UserId":"NDTestUser"
}
When I trigger this request, I get following error:
"message": "Write validation failed for table row of type 'SystemSecurityUserRoleEntity'. Infolog: Warning: Security role '' with identifier value 'LedgerAccountant' is not valid..",
"type": "Microsoft.Dynamics.Platform.Integration.Services.OData.AxODataValidateWriteException",
But, when I add SecurityRoleName in the request, my request is getting successfully executed. While inspecting the metadata for
EntityType name="SecurityUserRole", I saw that only UserId and SecurityRoleIdentifier are mentioned as key, then why SecurityRoleName is required in
the POST request to successfully assign the Role to the User?