Connect to Azure AD in PowerShell

Share

I wanted to test the installation, the uninstallation and then the reinstallation of Azure AD Connect, but during the last installation, I had double accounts and therefore orphaned, since the Azure portal, impossible to delete them, it is "grayed out", the same for security groups that I did not want to synchronize.
Be aware that a solution exists and it does not through PowerShell.

Installing the AzureAD PowerShell Module

Open PowerShell as administrator, then enter the following command:

[cc lang = "powershell"] Install-Module -Name AzureAD [/ cc]

The module is also available on PowerShell Gallery

Using the AzureAD module

Once installed, all you have to do is import the AzureAd module by entering the following command:

[cc lang = "powershell"] Import-Module AzureAD [/ cc]

To connect to Azure, enter the following command:

[cc lang = "powershell"] Connect-AzureAD [/ cc]

The Microsoft authentication window opens, enter your Microsoft username and password ...

Here I am connected!

To see the list of users, enter the following command:

[cc lang = "powershell"] Get-AzureADUser [/ cc]

To delete a user:

[cc lang = "powershell"] Remove-AzureADUser -ObjectId [/CC]

The complete list of cmdlets is available at this address by entering the following command:

[cc lang = "powershell"] Get-Command -Module AzureAD | ft -AutoSize [/ cc]

Or by visiting this page.


Share

Steven Bart

Founder of StevenBart.com - Vevey, Switzerland. I have been in IT since 2001, I work as a Workplace Architect and mainly deal with the administration of MEMCM (SCCM), the mass deployment of workstations and applications. Learn more about me.

    Leave a comment

    Your email address will not be published. Required fields are marked with *