I am trying to export every group within my organisation and their owner(s) if possible Also to return no owner or remain blank if no owner is assigned

I am new to azure powershelgl so am starting from zero here

I have looked through numerous other threads but don't seem to find any that returns owners owners only group members. I don't necessarily need the membership of these groups just the name of the group, the owners and export this to CSV

Thank you for any assistance

I haven't really tried anything as I am very new to azure powershell and also unable to find anything online

0

1 Answer

I tried to reproduce the same in my environment and got the results successfully like below:

To import the list of Azure AD Groups and its owners, use the below Powershell Script:

connect-AzureAD $groups = Get-AzureADGroup -All $true $result = foreach ($group in $groups) { Get-AzureADGroupOwner -ObjectId $group.ObjectId -All $true | ForEach-Object { [PsCustomObject]@{ 'Group' = $group.DisplayName 'Owner' = $_.UserPrincipalName } } } $result | Format-Table -AutoSize $result | Export-Csv -Path 'C:\users\testkhann.csv' -NoTypeInformation 

enter image description here

The Csv File imported successfully like below:

enter image description here

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.