I'm trying to delete a group and a contact from Office 365 using Azure PowerShell by using Remove-MsolGroup -userprincipalname, but it's not working.


To delete a contact or group from Office 365 you have to use the object ID.


You obtain the object IDs of all your groups/contacts by using get-msolgroup -all / get-msolcontact -all.

They can also be exported to a .csv using get-msolgroup -all | export-csv groups.csv.

Then the command to delete is remove-msolgroup (or contact) -objected ****insert objectID****.