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

Announcements

News and Announcements icon
Community site session details

Community site session details

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

Is there any way to add users to an environment that has no Dataverse database, programmatically or via PowerShell script?

(0) ShareShare
ReportReport
Posted on by 2,122

I want to add an E5 license office 365 users into one of our D365 Database from Power platform. I can see, we can add the user from Environment itself by using this link:

https://docs.microsoft.com/en-us/power-platform/admin/add-users-to-environment

But, I need to perform the same operation either using a C# code or PowerShell script as I would like to add the users in bulk. Any help would much appreciated.

I have the same question (0)
  • Suggested answer
    PerezAguiar Profile Picture
    Microsoft Employee on at

    Hey Team!

    You have this command: docs.microsoft.com/.../add-adminpowerappssyncuser.  It allows user synchronization and requires 2 parameters:  The environmentID and the UserObjectID.

    A sample script would be something like this:

    Connect-AzureAD // This will prompt credentials

    $User =Get-AzureADuser // This creates an object with all AzureAD Users.  You can do some tuning to retrieve users form a specific ADGroup

    $Environment = Get-AdminPowerAppEnvironment //This will prompt for credentials

    //Change this either using a For to do this for all environments, or just to select one specific

    $env=$Environment[1]

    foreach($u in $User)

    {

       Add-AdminPowerAppsSyncUser -EnvironmentName env.Name -PrincipalObjectId $u.ObjectId

    }

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 95 Super User 2026 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 58 Most Valuable Professional

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 42 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans