We are happy to announce the general availability of Azure Active Directory (AAD) Graph Client Library 1.0. The goal of this library is to simplify .NET developer experience to write an application that leverages Azure AD through Graph API. The library supports all the capabilities exposed by the Graph API version 2013-11-08 and it is available as a NuGet package at https://www.nuget.org/packages/Microsoft.Azure.ActiveDirectory.GraphClient/1.0.2

To install Graph Client, run the following command in the Package Manager Console

PM> Install-Package Microsoft.Azure.ActiveDirectory.GraphClient

The need for a client library.

Consuming the Graph API directly (using raw web requests) can be tedious and error prone and also preparing the request for some advanced queries is non-trivial. Another popular option to consume OData services is to use Microsoft.Data.Services.Client (WCF Data Services) which could add unnecessary complexity to the application logic. Azure Graph client library provides a simple way to access Graph and it is the recommended way to access Azure AD.

How to make a request.

The library contains definitions for all the Graph entities available along with all their properties. All the client library functions are exposed through the GraphConnection class. To initialize a new connection, you need to provide an access token, which can be obtained using Azure Authentication Library.

GraphConnection graphConnection = new GraphConnection(accessToken);

There are several operations available on GraphConnection for various operations including,

  • Create/Get/List/Update/Delete operations on entities like User/Group/Application/Permission, etc.
    • TenantDetail GetTenantDetails()
    • T Get<T>(string uniqueIdentifier)
    • IList<T> List<T>(string pageToken, FilterGenerator filter)
    • T Update<T>(GraphObject)
  • Add/Remove/List link/navigation properties (Members, Manager, etc) on an entity (User/Group etc.)
    • PagedResults<GraphObject> GetLinkedObjects(GraphObject graphObject, LinkProperty linkProperty, string nextPageToken)
    • IList<GraphObject> GetAllDirectLinks(GraphObject graphObject, LinkProperty linkProperty)
    • AddLink(GraphObject sourceObject, GraphObject targetObject, LinkProperty linkProperty, bool isSingleValued)
    • DeleteLink(GraphObject sourceObject, GraphObject targetObject, LinkProperty linkProperty, bool isSingleValued)
  • Batch operations (up to 5 operations can be batched together)
    • ExecuteBatch(params Expresssion<Action>[])
  • Get/Set stream properties on any supported entity.
    • Stream GetStreamProperty(GraphObject graphObject, GraphProperty graphProperty, string acceptType)
    • SetStreamProperty(GraphObject graphObject,GraphProperty graphProperty, MemoryStream memoryStream, string contentType
  • Perform actions like AssignLicense/GetMemberGroups/CheckMemberGroups/IsMemberOf, etc.
    • IList<string> GetMemberGroups(User user, bool securityEnabledOnly)
    • IList<string> CheckMemberGroups(GraphObject graphObject, IList<string> groupIds)
    • User AssignLicense(User user, IList<AssignedLicense> addLicenses, IList<Guid> removeLicenses)
    • bool IsMemberOf(string groupId, string memberId)

Extending Graph Client Library in your application.

Most APIs has overloads to meet different requirements and GraphConnection can be extended to add custom behavior or override specific methods. The sources are available at https://github.com/MSOpenTech/azuread-graphapi-library-for-dotnet, please fork and contribute. We welcome your pull requests.

Feedback Welcome.

The following are our priorities in relation to the next official releases of the library. We welcome any feedback.

  1. Support Linq expressions as query model.
  2. Support Async model.
  3. Support a “preview” version that targets the latest Graph API preview version (for example, support extensions for 1.21-preview version).
  4. Support connection pooling.
  5. Support iOS and Android platforms.


The console application -  https://github.com/AzureADSamples/ConsoleApp-GraphAPI-DotNet and a web application - https://github.com/AzureADSamples/WebApp-GraphAPI-DotNet shows how to use this library.

In part 2 of this blog, we will talk in detail about each of the APIs with a complete API reference.



Pavan Kompelli
Vijay Srirangam
Edward Wu

Azure Active Directory Team