I am completely new with AzureAD and would like to use API calls to test that the configuration of the EntraID applications we are using are correct. Our identity team created a service principal attached to the entraID application I would like to query. I used this service principal clientId, clientSecret and our tenantId to generate a graph client (see snapshot of python code below)
client_id = self.settings['clientId']
tenant_id = self.settings['tenantId']
client_secret = self.settings['clientSecret']
client_credential = ClientSecretCredential(tenant_id, client_id, client_secret)
graph_client = GraphServiceClient(client_credential)
Then to get my entraID application properties, I followed the step documented here: https://learn.microsoft.com/en-us/graph/api/application-get?view=graph-rest-1.0&tabs=python#request :
result = await graph_client.applications.by_application_id('my-entraID-applicationID').get()
But it doesnt work and I get a RessourceNotFound Error:
Request_ResourceNotFound Resource 'xxxxxxxxxxxxxxxxx' does not exist or one of its queried reference-property objects are not present.
Do you know what I am doing wrong? (The app has been granted the API permission Application.Read.All, Group.Read.All, GroupMember.Read.All)
I have one Entra ID application with
Application.Read.Allpermission of Application type granted in it:Initially, I too got same error when I tried to get application properties by passing Application ID like this:
Response:
To resolve the error, you need to pass the Object ID of Entra ID app registration that can be found here:
When I ran below python code by replacing Application ID with Object ID, I got the response with application properties successfully like this:
Response:
Reference: Get application - Microsoft Graph v1.0