How to get the Permission Scopes of the Oauth2PermissionScopes using PowerShell?

EnterpriseArchitect 4,446 Reputation points
2024-01-31T03:00:03.2+00:00

How can I translate the result GUID of the below column called Oauth2PermissionScopes into a meaningful format not to another GUID? User's image

Get-MgServicePrincipal -Filter "Tags/any(t:t eq 'WindowsAzureActiveDirectoryIntegratedApp')" -Property  Oauth2PermissionScopes | Select *

Thank you so much for your attention and participation.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,944 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
1,852 questions
0 comments No comments
{count} votes

Accepted answer
  1. CarlZhao-MSFT 34,701 Reputation points
    2024-01-31T07:10:00.7766667+00:00

    Hi @EnterpriseArchitect

    It returns an array of permission scopes by default. If you want to export all attribute values of the array, then you need to convert the array to a JSON type string.

    For example:

    Get-MgServicePrincipal -Filter "tags/any(t:t eq 'WindowsAzureActiveDirectoryIntegratedApp')" | Select-Object -Property id,@{Name='oauth2PermissionScopes';Expression={$_.oauth2PermissionScopes | ConvertTo-Json -Compress}} | Export-Csv -Path "D:\test.csv"
    

    User's image

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful