Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I'm about to add user email group to the power bi worksapce by using api.
I was able to use below pyhton code well if I use normal email address, but it's doesn't work if I use email adress group which is created by AD and this email act as email group security.
for exmample my email is "chayaphon@abc.com" then the api can add it successfully,
and if I have email group like "marketing@abc.com" and this email group has member of myself "chayaphon@abc.com" and other people email address the api throw error as {"error":{"code":"ItemNotFound","message":"User was not found"}}
Actullly I can directly add "marketing@abc.com" into workspace in website ui but for api it doesn't work.
So anyone has knowlege on this please advise.
Thanks
workspace_id = ' '
api_endpoint = f'https://api.powerbi.com/v1.0/myorg/groups/{workspace_id}/users'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + token
}
payload = {
"emailAddress" : " ",
"groupUserAccessRight": "Member"
}
# Send the request to add the user to the workspace
response = requests.post(api_endpoint, headers=headers, data=json.dumps(payload))
# Check the response status code and print the result
if response.status_code == 200:
print('user has been added to workspace : ')
else:
print('Error adding user to the workspace: ', response.text)
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!