AzureAD: Get List of all users with a particular license

You might have to do reporting and want a list of all users in Azure AD which have a particular license..

Following is an easy way to do so

Get-MsolAccountSku will give you a table of all the License Types you have and count

AccountSkuId ActiveUnits WarningUnits ConsumedUnits
TENANTNAME:AAD_BASIC 300000 0 1
TENANTNAME:AAD_PREMIUM 300000 0 200000
TENANTNAME:AAD_PREMIUM_P2 300000 0 200000
TENANTNAME:POWER_BI_STANDARD 1000000 0 200000

You can then choose the AccountSkuId you want to report on and pass that in the “TENANTNAME:AAD_PREMIUM” of the Get-MSOLUser command

It took me about 20 min to run this report for about 155000 users

Fixing MIM Error: The dimage indicates an update or replace operation, but the image doesn’t exist.

So there was a delete operation sent to an AD MA. It was deleted successfully but on import (Full / Delta) MIM was still seeing the object with a staging error

Error: The dimage indicates an update or replace operation, but the image doesn’t exist.

Cause: Unknown – The Object Information was corrupted in connector space.

Resolution: Did some digging with Microsoft and came up with the solution

  • Open SQL Server management studio and logon. Backup FIMSynchronizationService database.
  • In a new query script, input the below command

 

 

  • You can get the RDN from the object corrupted.
  • After that, record the object_id from the query result, which we will use in the later statements.
  • Run the below statements to turn it into a phantom

 

  • Stop the FIM service.
  • Delete the record via the below commands

 

  • Restarted the FIM Services
  • Run the FIM Sync to see if the issue fixed.