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 :
Power Platform Community / Forums / Power Automate / Environment Security r...
Power Automate
Suggested Answer

Environment Security roles management via Power Automate

(3) ShareShare
ReportReport
Posted on by Microsoft Employee

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:
  • 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,658 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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 315 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 267

#3
Henil Profile Picture

Henil 115

Last 30 days Overall leaderboard