azureazure-ad-graph-api

how to access registered enterprise application properties from azure


I have an Azure Application name and I would like to know if there is a way to get the application ID and other properties of the enterprise application.

I am able to authenticate myself by passing in the clientID/ApplicationID and secret. But, I would like to know if there is a way to fetch client id/application ID using Azure Application name, so that I dont have to hardcode it.


Solution

  • I have one enterprise application named "DemoApp" with below properties:

    enter image description here

    To fetch client ID (app ID) using application name, you can make use of below commands:

    PowerShell:

    Connect-AzAccount
    $enterpriseApp = Get-AzADServicePrincipal -DisplayName "DemoApp"
    $enterpriseApp.AppId
    

    enter image description here

    Azure CLI:

    az login
    az ad sp list --display-name "DemoApp" --query "[0].appId"
    

    enter image description here

    Microsoft Graph:

    GET https://graph.microsoft.com/v1.0/servicePrincipals/?$filter=displayName eq 'DemoApp' &$select=appId,appDisplayName
    

    enter image description here