How to remove Guest user on Azure Active Directory?

7.6k views Asked by At

I added a user with a directory role as a 'Guest'. I now want to remove. The Azure Portal user interface has a "Delete" option but it is grayed out without any explanation. I have tried through the "Find a User" screen, I have tried through the "Quick Overview Screen" and I have tried "Manage -> Users and Groups -> All Users". All the same thing, "Delete" is disabled with no explanation.

I have also tried through Powershell. I installed the AzureRM and Azure modules into Powershell. I access my Azure account and following multiple online docs (namely the Azure GitHub docs: https://github.com/Azure/azure-docs-powershell-azuread/blob/master/Azure%20AD%20Cmdlets/MSOnline/index.md) for accessing Azure AD I cannot connect.

I type into Powershell:

$Msolcred = Get-credential

Which prompts for credentials, then following tutorials I try to use the cmdlet:

Connect-MsolService -Credential $MsolCred

But I receive the error:

Connect-MsolService : The term 'Connect-MsolService' is not recognized as the name of a cmdlet, function, script fi
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again. 
1

There are 1 answers

11
4c74356b41 On BEST ANSWER
Add-AzureRmAccount -SubscriptionName 'SUBNAME'
Get-AzureRmADUser #Look up the user GUID
Remove-AzureRmADUser -UPNOrObjectId 'USER GUID'

To install this module you should run 'Install-Module AzureRM' (it will take some time)