Home > Net >  On how to delete users in Azure AppRoleAssignment problems
On how to delete users in Azure AppRoleAssignment problems

Time:03-25

Recent contact with Azure, feeling of the framework of Azure,
Now want to consult a delete AppRoleAssignment problem,

When I use the following code query the specified user and user AppRoleAssignment, want to delete a AppRoleAssignment, should how to operate?
 client. Users. The Where (g=& gt; G.U serPrincipalName. Equals (the userInfo)). Expand (u=& gt; U.A ppRoleAssignments). ExecuteAsync () 

Does the code above Expand method, can only query from the user of the first page the AppRoleAssignment

I now is to use the following method to remove user AppRoleAssignment
 user. AppRoleAssignments. Remove (targetRole); 
User. UpdateAsync (). Wait ();

If I want to remove targetRole is on the first page, can be normal to delete,
However, if you need to remove targetRole isn't on the first page, such as behind the second page or a page, should how to delete?

CodePudding user response:

By the method of Expand, access to the user at the same time, also can get to the user's AppRoleAssignment (but only the first page)
I tried to get AppRoleAssignment alone, so I can get all the pages AppRoleAssignment,
And then, I put all the pages AppRoleAssignment in AppRoleAssignments attribute of the user,
User. AppRoleAssignments. Remove (targetRole); Can be performed successfully,
But in the update (executive UpdateAsync method) will be in the abnormal,

CodePudding user response:

From the Microsoft web site to find a piece of code, as follows:
 graphClient. Groups [r]. "{group - id}" AppRoleAssignments [" {appRoleAssignment - id} "] 
The Request ()
DeleteAsync ();

However, a direct Request method can't find,
I doubt is an extension method, but I don't know is which under the namespace, or which assemblies,
  •  Tags:  
  • C#
  • Related