When creating users in Dynamics 365 using the Microsoft CRM SDK, the salesperson security role is automatically assigned. We believe this behavior started recently.
It does not happen when creating users in Dynamics 365 using the UI.
It does not happen when creating users in on-premises CRM using the same code. There must be something on the Microsoft Dynamics 365 server side adding this security role.
The behavior is documented here for imported user.
The security role can also be added automatically based on assigned license. It is possible to opt out of this. One of our customers had Microsoft do this for their Dynamics environment, but the salesperson role is still added automatically.
Is there a way to avoid the automatic security role assignment?
We have a workaround by adding the user to the AAD security group of the Dynamics environment and waiting until the synchronization from AAD to Dynamics 365 creates the user before we add access and update personalia/settings using the API.