web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

Dynamics CRM Online - how the heck do you manage users and roles programatically? (Power Platform)

(1) ShareShare
ReportReport
Posted on by 22

In CRM Online, which runs on this "Power Platform", er, platform, how the heck do you manage roles to user/groups programmatically? (Permissions aren't the issue, I can do it via the Power Platform GUI or within CRM itself.)

Powershell is preferred but the `Microsoft.PowerApps.Administration.PowerShell` doesn't seem to support it. (And so far seems really badly written/incomplete)

I've tried using the 
PowerPlatform CLI, up to and including registering a service principal, (which is added to the CRM environment), but

>pac admin assign-user -env 9912fe79-valid-env-guid-abc123456789 --user "some.email@ourdomain.org" --role "System Administrator"

give the error

Message: Access token validation failure. Invalid audience.

(Even when using valid user credentials)


Am I missing something obvious? How do folks manage users when provisioning/migrating environments?
I have the same question (0)
  • Suggested answer
    PerezAguiar Profile Picture
    Microsoft Employee on at

    Hey!

    I have 2 different approaches for this.

    1: Using the Microsoft.PowerApps.Administration.Powershell as you've stated.   The list of available cmdlets is on learn.microsoft.com/.../.  If you want to create a user, the command would be "add-adminpowerappssyncuser".  However, please note that if the environment has a database, you can synchronize the user (which will bring the data from AzureAD into the environment) but there's no command to assign a security role to the user.  On this post, you have a nice powershell example: community.dynamics.com/.../force-sync-users-using-powershell

    2: There's a Github repository from Sean McNellis, https://github.com/seanmcne.  there you have "microsoft.Xrm.Data.Powershell" module that you can deploy, and Microsoft.Xrm.Data.Powershell.Samples.  On the latest, you have a folder with "user operations", that has an interesting "addCrmUsersfromOu.ps1", or "AddCrmUsersfromCSV.ps1"

    Regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 182 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 123

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans