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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Environment Security r...
Power Automate
Unanswered

Environment Security roles management via Power Automate

(3) ShareShare
ReportReport
Posted on by

I would like to use PowerAutomate to be able to remove the Security Role from the user (on any environment), unfortunately the action 'Edit_Environment_Role_Assignment' returns the following error:

 

The environment 'ENV_ID' is linked to a new CDS 2.0 instance. The operation 'POST/PROVIDERS/MICROSOFT.BUSINESSAPPPLATFORM/SCOPES/ADMIN/ENVIRONMENTS/MODIFYROLEASSIGNMENTS' is forbidden for linked environments.

 

So I would like to use REST API to be able to remove Security Role from the user.

I found this topic in the documentation:
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/update-delete-entities-using-web-api#delete-a-single-property-value

 

Unfortunately, when I try to make such a query using HTTP blocks in PowerAutomate, I get a prompt:

Delete References directly is only valid for OneToManyEntityRelationship

 

QUERY:

{
"uri": "EnvLink/api/data/v9.1/systemusers(UserID)/systemuserroles_association/$ref",
"method": "DELETE",
"headers": {
"authorization": "*sanitized*",
"Content-Type": "application/json",
"Accept": "application/json",
"OData-MaxVersion": "4.0",
"OData-Version": "4.0"
},
"body": {
"@odata.id": " EnvLink/api/data/v9.1/roles(RoleID)"
}
}

 

Please help me to use PowerAutomate to remove Security Role from a user

Categories:
I have the same question (0)
  • vishalc_ Profile Picture
    2 on at

    hey, I'm on the same boat - were you able to find a solution for this?

  • Mitanshu Profile Picture
    1,650 Moderator on at

    HTTP call should be:

     

    METHOD: DELETE
    
    URI: 
    https://[ENVLINK]/api/data/v9.1/systemusers(USER_GUID)/systemuserroles_association(ROLE_GUID)/$ref

     

    You should leave body blank and keep everything AS IS in the original question.

     

     

    Headers:
    {
     "Accept": "application/json",
     "Content-type": "application/json;charset=utf-8",
     "Authorization": "*sanitized*"
    }

     

     

    ENVLINK is of format: 

     

    https://NNNNNN.crmN.dynamics.com

     

     

    systemuserroles_association is a collection-valued navigation property.

     

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If this post or my previous reply was useful in other ways, please consider giving it Thumbs Up.

  • shivam0712 Profile Picture
    2 on at

    Hi @happyume, I am trying to call the above http request but getting 401 error. can you please guide me about the authentication you used for the http action? Also, I have tenant admin access.

  • cristi03_92 Profile Picture
    4 on at

    Hey, were you meanwhile able to find a solution or workaround? I am facing the exact same error. Thanks!

  • Suggested answer
    _daveB Profile Picture
    6 on at

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard