Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Chris1300
Helper II
Helper II

Bulk admin tasks powershell script

Hello,

 I have admin access to my company wide PowerBI service. I understand you can use Powershell to send commands to do PowerBI server level tasks. I am trying to create some automation and wondering if someone can point me in the right direction.

 

I would like to add a new admin user to ALL workspaces, and also remove a certain person from all the workspace. I have a list of csv with all the workspace IDs and I have the emails necessary. Is there a way to write a loop function in Powershell that loops through all the workspace IDs and adds a new admin user and then removes certain users?

 

I have seen powershell scripts on how to add individual users to a specific workspace ID, but is there a way to do bulk edits using powershell scripting with FOR loop?

 

1 REPLY 1
Daryl-Lynch-Bzy
Resident Rockstar
Resident Rockstar

Hi @Chris1300 - everything you are thinking about is possible.  It just takes a bit of practice.  Have you seen the following video to help you get started with API & PowerShell, and Rui shows how an Azure Application can help execute these.
Guy in Cube - Intro Call any Power BI REST API with PowerShell - YouTube
Rui Romeo - Power BI REST API’s 101 & Useful Techniques (with Rui Romano) - YouTube


Please try to refer to the API documentation, it contains a useful feature call "Try It".  I suggest that you use this and compare it to your PowerShell version to compare results.  Here is an example:  Admin - Groups AddUserAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Finally, some people have shared GitHub libraries with their PowerShell scripts:
GitHub - msfttimmac/MyPowerBIPowerShellSamples: Using the Get-PowerBIWorkspace PowerShell cmdlet to ...
GitHub - tirnovar/Power-BI-Admin-REST-API-Connector: Power BI REST API Connector - Admin Version

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.