In this article

Graph API Common Queries

01/26/2016

2 minutes to read

In this article

This topic shows some common queries that can be performed with the Azure AD Graph API. For more information about supported operations when querying the Graph, see Supported Queries, Filters, and Paging Options in Azure AD Graph API.

We strongly recommend that you use Microsoft Graph instead of Azure AD Graph API to access Azure Active Directory resources. Our development efforts are now concentrated on Microsoft Graph and no further enhancements are planned for Azure AD Graph API. There are a very limited number of scenarios for which Azure AD Graph API might still be appropriate; for more information, see the Microsoft Graph or the Azure AD Graph blog post in the Office Dev Center.

Addressing

The queries below all address the tenant using a domain name. You can replace contoso.com with one of your tenant’s registered domain names, with your tenant's ID (GUID), or with the MyOrganization alias (for delegated access). For information about other ways of addressing the tenant, see Addressing Entities and Operations in the Graph API.

Querying Top-Level Resources

The following common queries demonstrate how to access top-level resources with the Graph API using contoso.com as the example tenant. Note that an Authorization header containing a valid bearer token received from Azure AD will be required to run queries against a tenant.

Note: White space in the query string should be URL-encoded before sending a request. For example, the following query string, https://graph.windows.net/contoso.com/Users?$filter=displayName eq 'Jon Doe'&api-version=1.6, should be URL encoded as: https://graph.windows.net/contoso.com/Users?$filter=displayName%20eq%20'Jon%20Doe'&api-version=1.6.