web
You’re offline. This is a read only version of the page.
close
Skip to main content
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,086

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
    RE: Is there any way to add users to an environment that has no Dataverse database, programmatically or via PowerShell script?

    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 125

#2
Tom_Gioielli Profile Picture

Tom_Gioielli 110 Super User 2025 Season 2

#3
Erin Lubben Profile Picture

Erin Lubben 73

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans