Forum Discussion

TonyRedmond's avatar
Sep 21, 2023

Chasing Performance When Reporting Teams SharePoint Site URLs

It’s possible to use PowerShell to create a report detailing the SharePoint Online site URLs used with Teams. My first attempt used the Exchange Online module, but is the Graph any faster? As it turns out, not really. At least, not for interactive sessions using the Microsoft Graph PowerShell SDK (things are different when running SDK code using a registered app). I tried several approaches, but Graph permissions got in the way every time.

 

https://office365itpros.com/2023/09/21/teams-sharepoint-url/

1 Reply

  • michka78as's avatar
    michka78as
    Copper Contributor

    Creating a report detailing SharePoint Online site URLs used with Microsoft Teams can https://www.alivechristians.com/acblog/category/inspirational-quotes accomplished using PowerShell, and both the Exchange Online module and Microsoft Graph can be used for this purpose. The choice between them depends on your specific requirements and constraints.

    Here's a high-level overview of using both approaches:

    Using the Exchange Online Module:

    1. Connect to Exchange Online:

      powershellCopy code
      Connect-ExchangeOnline -UserPrincipalName <YourAdminAccount>
    2. Retrieve Teams-connected SharePoint sites:

      powershellCopy code
      $teamsSites = Get-UnifiedGroup | Where-Object { $_.SharePointSiteURL -ne $null }
    3. Output or format the results as needed.

    Using the Microsoft Graph PowerShell SDK:

    1. Install and import the Microsoft Graph PowerShell module:

      powershellCopy code
      Install-Module -Name Microsoft.Graph Import-Module Microsoft.Graph
    2. Authenticate using a registered app (service principal) with the necessary permissions to access Microsoft Graph.

    3. Retrieve Teams-connected SharePoint sites:

      powershellCopy code
      $teamsSites = Get-MgTeamsAppInstallation -Top 500 | Where-Object { $_.ResourceType -eq 'Site' }
    4. Output or format the results as needed.

    Both approaches can provide the desired information, but there are some considerations to keep in mind:

    • Permissions: As you mentioned, permission requirements can be more complex when using Microsoft Graph. You need to ensure that the app or account used for authentication has the necessary permissions to access Teams and SharePoint data. It may require application registration and consent.

    • Performance: In terms of speed and performance, the choice between the two methods might not yield a significant difference for interactive sessions. The performance largely depends on the efficiency of your scripts and network latency.

    • Authentication: Using Microsoft Graph typically requires more elaborate authentication setup compared to connecting to Exchange Online. This may involve creating an Azure AD application, granting the required permissions, and obtaining access tokens.

    • Granularity: Depending on your specific reporting requirements, one method might provide more granular information than the other. Consider what level of detail you need in your report.

    In summary, both the Exchange Online module and Microsoft Graph can be used to create a report on Teams-connected SharePoint sites. The choice depends on your specific requirements, existing infrastructure, and familiarity with the tools. For many cases, the Exchange Online module may be simpler to set up and use, while Microsoft Graph offers more flexibility and customization options.

Resources