dynamics-crmxrmtoolbox

UserNotLicensed :User does not have license to use <ModernProject> with <ReadOnly> access


I am using below code to create CRM Client

var conn = new CrmServiceClient($@"AuthType=ClientSecret;url={organizationUri};ClientId={clientId};ClientSecret={clientSecret}");

Above code is throwing me "UserNotLicensed :User does not have license to use with access" error

I have also followed this article for creating application user. which is not possible as user needs to be created using power platform.

https://www.ashishvishwakarma.com/Dynamics-365-Single-Tenant-Server-2-Server-Authentication-Azure-Active-Directory-Access-Token/

Mine looks like

enter image description here

Also, as shown in the article I am not able to navigate to "New User" form. It keeps redirecting to Office Admin page. where I am not sure if I have permission to create. Let's say I make Admin do that, will Admin have option to associate User with application ?

enter image description here


Solution

  • creating application user. which is not possible as user needs to be created using power platform.

    what do you mean by this? You first need application user which should be created via Azure AD as app registration as mentioned in article and then you need to go to admin.powerplatfrom.com, select your env and then you see s2s users. Onye you click here it will give you list of all your s2s users (including the one you created). Add this s2s user in your env and assign particular security role (in most cases systemadmin). This should solve your issue