Removing Azure Active Directory users using Azure Cloud Shell

Share this:

Cloud Shell is one of the new features in Azure Portal, and it is accessible from virtually any browser and even from Azure App. In this Tutorial, we are going over the simple steps to list and remove accounts using Azure Cloud Shell.

Solution


In the current scenario, we have some accounts that are being synchronized between on-premises and Azure Active Directory using Azure AD Connect, since they are being synchronized we can’t just remove them using Azure Portal. A possible solution to remove such accounts, is opening Azure Cloud Shell.

Screen Shot 2017-10-06 at 6.44.20 PM

After connected and it may take a few seconds, we can first list the current users using the following command.

az ad user list

Screen Shot 2017-10-08 at 10.50.42 AM

In order to delete an account, the following command can be used. Please, replace the UPN by the user on your organization.

az ad user delete –upn-or-object-id bruce@infralab.org

Screen Shot 2017-10-08 at 10.52.51 AM

 

There are way more tasks that can be done using Azure Cloud Shell, in this Tutorial, we focused in a simple set of tasks to list and remove accounts that cannot be removed using the Azure Portal.

Written by Anderson Patricio

Anderson Patricio

Anderson Patricio is a Canadian MVP in Cloud and Datacenter Management, and Office Server and Services, besides the Microsoft Award he also holds a Solutions Master (MCSM) in Exchange and several other certifications. Anderson has been contributing to the Microsoft Community with articles, tutorials, blog posts, twitter, forums and book reviews. He is a regular contributor here at ITPROCentral.com, MSExchange.org, Techgenix.com and Anderson Patricio.org (Portuguese).

Related Post

Checking if a mailbox is valid using Exchange Mana... In some scenarios we need to check if a mailbox database is valid on Exchange Server, this kind of validation is useful when migrating/transitioning m...
Installing Azure CLI on a Mac OS X Microsoft Azure is open for all type of administrators, and if you use a Mac OS X,  you can access the portal using your Safari and also use Azure CLI...
Statistics of a NIC Teaming If the UI window is sufficiently tall a statistics tile appears at the bottom of the Team tile and the Adapters and Interfaces tile. These statistics ...
Automating the process to join a server to a domai... In this Tutorial we are going to optimize a simple task that in larger environments may take some time from the service desk/operations team which is ...