SOLVED

M365 group to export the list with owner

Copper Contributor

Hi there, i would like to export out the m365 groups ( a lot) with owner email address. 

 

and i see this page, https://github.com/12Knocksinna/Office365itpros/blob/master/TeamsGroupsActivityReportV5.PS1

 

i try to run it, but seems like i have permission issue.  

 

Checking Microsoft 365 Groups and Teams for:
This phase can take some time because we need to fetch every group in the organization and
then analyze its settings and activity. Please wait.
Get-GraphData : System.Net.WebException: The remote server returned an error: (403) Forbidden.
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
At D:\TeamsGroupsActivityReportV5.PS1:330 char:18
+ [array]$Groups = Get-GraphData -AccessToken $Token -Uri $uri
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-GraphData

Can't find any Microsoft 365 Groups - Check your access token

i have no idea how to find out which permission is needed as there are a lots of permission for microsoft graph. 

 

i try to check the link inside the script and use the graph explorer, it also needed the permission. 

 

{
    "error": {
        "code": "UnknownError",
        "message": "{\"error\":{\"code\":\"S2SUnauthorized\",\"message\":\"Invalid permission.\"}}",
        "innerError": {
            "date": "2024-08-21T06:30:50",
            "request-id": "e7de8a7b-77ec-4d8b-94fd-9161026f21bb",
            "client-request-id": "833ca782-ad02-748b-0798-ffdda617f57d"
        }
    }
 
any advise ? 
1 Reply
best response confirmed by Sanjee311 (Copper Contributor)
Solution

@Sanjee311 

 

Ensure you have the necessary permissions for the Microsoft Graph API. For exporting group details, you typically need Group.Read.All and User.Read.All permission

1 best response

Accepted Solutions
best response confirmed by Sanjee311 (Copper Contributor)
Solution

@Sanjee311 

 

Ensure you have the necessary permissions for the Microsoft Graph API. For exporting group details, you typically need Group.Read.All and User.Read.All permission

View solution in original post