Hi @Szilágyi Sándor !
I wrote a short script that I tested on my tenant.
Firstly gather the groups you wish to delete into a CSV file. I have used the SearchString parameter to find all groups with 'Test' in the name.
Get-AzureADGroup -SearchString "test" | Export-CSV C:\temp\groups.csv
Next, import your CSV data into a variable so we can manipulate in our PowerShell session:
$groups = import-csv C:\temp\groups.csv
Lastly we will look through our groups, save the ObjectID and run that against the remove command:
foreach ($group in $groups) {
$objectID = $group.objectID
Remove-AzureADGroup -ObjectID $ObjectID
}
If the answer is helpful please click on ACCEPT ANSWER as it could help other members of the Microsoft Q&A community who have similar questions and are looking for solutions.