I am trying to retrieve app owners from Azure Portal App Registration under the Manifest using the Microsoft Graph API and REST Method via a PowerShell script. I am using a service principal account (client secret key), tenant, and client ID (app ID) to authenticate to the Graph API.
Here is the code for getting specific app info:
Invoke-RestMethod -Uri "https://graph.microsoft.com/v1.0/applications?$filter=appId eq 'appIdhere'" -Headers $headers -Method GET
I am using the following request headers and body:
$requestBody = @{
"grant_type" = "client_credentials"
"client_id" = $clientId
"client_secret" = $clientSecret
"scope" = "https://graph.microsoft.com/.default"
}
$headers = @{
Authorization = "Bearer $accessToken"
}
However, this code above works only on the graph. Please see the documentation below. (I used the /applications endpoint and it still works with the reference below) Microsoft Graph API - List owners of a service principal
I want to use the URL mentioned above to access the application manifest under App Registration Azure Portal, but the URL retrieves all the applications from the Azure Portal instead of just the specified one from the URL when using Invoke-RestMethod from PowerShell ISE.
I would like to request assistance on how to retrieve specified information under this URL: "https://graph.microsoft.com/v1.0/applications?$filter=appId eq 'f059f748-6b42-46ec-8d5b-23a0fee126ee'". Thank you in advance to those who will assist.