locked
Removing the user from Azure subscription programtically(C#) RRS feed

  • Question

  • I want remove the users from Azure subscriptions programtically.

    We have lot of ways in the web to remove the AAD user but i could not find source to remove the users from Azure subscriptions.

    Can we remove the user from Azure subscriptions programtically?

    If so please can any give me any idea how we can do this please.

    Thanks in Advance.

    Friday, June 29, 2018 3:10 AM

Answers

All replies

  • If you want to remove specific user’s access from subscription, then you can remove its role assignment. You can manage the role assignments with PowerShell, Azure CLI and Rest API.

    --------------------------------------------------------------------------------------

    If this answer was helpful, click “Mark as Answer” or Up-Vote. To provide additional feedback on your forum experience, click here

    • Proposed as answer by Ajay Kadam Friday, June 29, 2018 5:01 AM
    Friday, June 29, 2018 5:01 AM
  • Hi Ajay,

    Thanks for the reply

    I found similar URL that you have mentioned. 

    The URL i found and Rest API URL you have mentioned, need authentication token(Bearer). Can you help me in getting the correct auth token to use the Rest API mentioned in the URL.

    Thanks,

    Avinash

    Friday, June 29, 2018 7:27 AM
  • You may refer the blog: Azure REST APIs with Postman which describes how to generate the required Bearer Token Authorization header to use Azure Rest APIs.

    Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. 

    --------------------------------------------------------------------------------------

    If this answer was helpful, click “Mark as Answer” or Up-Vote. To provide additional feedback on your forum experience, click here

    • Proposed as answer by Ajay Kadam Saturday, June 30, 2018 9:29 AM
    Saturday, June 30, 2018 9:29 AM
  • Hi,

    Below URL(this was mentioned above by Ajay) is fetching the list of all Users in a Subscription. 

    https://docs.microsoft.com/en-us/azure/role-based-access-control/role-assignments-rest

    But this URL is fetching only User GUID. But i want all the information of a User.

    Please can any one help me in getting all the information of all the users.

    Monday, July 2, 2018 7:25 AM
  • You may refer the StackOverflow thread and see if it helps.

    -------------------------------------------------------------------------

    If this answer was helpful, click “Mark as Answer” or Up-Vote. To provide additional feedback on your forum experience, click here

    • Proposed as answer by Ajay Kadam Tuesday, July 3, 2018 6:55 AM
    Tuesday, July 3, 2018 6:55 AM
  • Just checking in if you have had a chance to see the previous response. If that answers your query, do click “Mark as Answer” and Up-Vote for the same. If you have any further query, then do let us know.

    Thursday, July 5, 2018 11:21 AM
  • Thursday, July 5, 2018 8:56 PM
  • Thanks for updating the forum with the solution that worked for you, which might help other community members.

    Friday, July 6, 2018 9:30 AM