In this blog post, I will show you how to get a list of disabled or enabled accounts in Microsoft Azure using PowerShell.
Azure PowerShell
For this demonstration, I will use PowerShell 7, which is supported by Azure PowerShell and is a cross-platform module, which means you can run it on Linux, macOS and Windows.
Azure Active Directory
To manage Azure Active Directory with the Azure PowerShell, I will use the Get-AzADUser cmdlet, which allows us to manage Azure AD without the Azure AD PowerShell module unless you need to license a user.
Install-Module
To install the Azure PowerShell module, use the following cmdlet.
install-module az
Connect
To connect to Azure AD and Azure, run the following cmdlet.
connect-azaccount
Get a List Of Disabled or Enabled Azure Accounts With PowerShell
To list enabled Azure users, I will run the following cmdlet.
Get-AzADUser | where {$_.accountenabled -eq $true} | ft
List Disabled Users
To list all the disabled users in Azure, run the following cmdlet.
Get-AzADUser | where {$_.accountenabled -eq $false} | ft