This Java sample application is a web app that reads directory data from the Azure Active Directory Graph API, and executes queries against a demo company. The full list of capabilities for the Graph API can be found on MSDN (link below). If you would like to access your own Azure AD tenant's directory data, then the application must be configured with your own Tenant ID, Application ID and App Key - these values are stored in the app's web.xml file, then rebuild the application.
Getting started is simple! To run this sample you will need: - JDK 7 Standard Edition (JDK7 or greater) - Eclipse IDE - Apache Tomcat - An Internet connection - An Azure Active Directory (Azure AD) tenant. For more information on how to get an Azure AD tenant, please see How to get an Azure AD tenant - A user account in your Azure AD tenant. This sample will not work with a Microsoft account, so if you signed in to the Azure portal with a Microsoft account and have never created a user account in your directory before, you need to do that now.
From your shell or command line:
git clone firstname.lastname@example.org:Azure-Samples/active-directory-java-graphapi-web.git
https://localhost:44320/. Click on Create to create the application.
The Sample application can be built using the Eclipse IDE, and runs under Tomcat.The following instructions are provided:
1.Download and install the JDK 7 from the Oracle Website (select the version for your development environment (e.g. Windows x64) JDK 7
Select JDK Standard Edition (JDK SE 7 with latest update).
Set a system environmental variable named JAVA_HOME and give the variable value to your java installation. Typically, this value would be something like: C:\Program Files\Java\jdk1.7.0_06
Download and install the Eclipse IDE for Java EE Developers from the following website (select the version for your development environment (e.g. Windows x86). Eclipse IDE for Java EE - simply execute Eclipse.exe from a command line.
Download and install Apache Tomcat. Apache TomCat (http://tomcat.apache.org/) You can run Apache Tomcat by clicking
Import the project in Eclipse by: a. Starting Eclipse by clicking Eclipse.exe. b. Specify a workspace folder of your choice. c. Click File/Import/General/Existing Projects Into the workspace d. Select the root directory to the project you want to import into. e. Click Finish.
Optionally, you can also import the JavaSampleApp.war file by selecting from Eclispe: File/Import/Web/War and selecting the JavaSampleApp.war file.
b. update the web.xml file - under WebContent -> WEB-INF, locate web.xml file and open it - update three init-param values in the web.xml: i. Replace the current param-value under TenantContextId with your tenant domain name (e.g. MyTestConpany.OnMicrosoft.com). Also replace the param-value under TenantDomainName with your tenant domain name. ii. Replace the param-value under AppPrincipalId with the client ID value that was configured from the Azure Management Portal. iii. Replace the param-value under SymmetricKey with the Key value that was configured from the Azure Managment Portal. Save the web.xml file. c. Now right click on the project name, and select ?Run As/Run on Server?. d. This would prompt you to specify a server
i. Select Apache Tomcat V7.0
ii. Select the root directory of the tomcat server.
iii. Select ?Always use this server?.