Skip to content

Commit a5b945b

Browse files
Java-console-app-portal-quickstart
1 parent 11b1927 commit a5b945b

File tree

1 file changed

+15
-86
lines changed

1 file changed

+15
-86
lines changed

articles/active-directory/develop/quickstart-v2-java-daemon.md

Lines changed: 15 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -19,104 +19,40 @@ ms.custom: aaddev, "scenarios:getting-started", "languages:Java", devx-track-jav
1919

2020
In this quickstart, you download and run a code sample that demonstrates how a Java application can get an access token using the app's identity to call the Microsoft Graph API and display a [list of users](/graph/api/user-list) in the directory. The code sample demonstrates how an unattended job or Windows service can run with an application identity, instead of a user's identity.
2121

22-
> [!div renderon="docs"]
23-
> ![Shows how the sample app generated by this quickstart works](media/quickstart-v2-java-daemon/java-console-daemon.svg)
24-
2522
## Prerequisites
2623

2724
To run this sample, you need:
2825

2926
- [Java Development Kit (JDK)](https://openjdk.java.net/) 8 or greater
3027
- [Maven](https://maven.apache.org/)
3128

32-
> [!div renderon="docs"]
33-
> ## Register and download your quickstart app
34-
35-
> [!div renderon="docs" class="sxs-lookup"]
36-
>
37-
> You have two options to start your quickstart application: Express (Option 1 below), and Manual (Option 2)
38-
>
39-
> ### Option 1: Register and auto configure your app and then download your code sample
40-
>
41-
> 1. Go to the <a href="https://portal.azure.com/?Microsoft_AAD_RegisteredApps=true#blade/Microsoft_AAD_RegisteredApps/applicationsListBlade/quickStartType/JavaDaemonQuickstartPage/sourceType/docs" target="_blank">Azure portal - App registrations</a> quickstart experience.
42-
> 1. Enter a name for your application and select **Register**.
43-
> 1. Follow the instructions to download and automatically configure your new application with just one click.
44-
>
45-
> ### Option 2: Register and manually configure your application and code sample
46-
47-
> [!div renderon="docs"]
48-
> #### Step 1: Register your application
49-
> To register your application and add the app's registration information to your solution manually, follow these steps:
50-
>
51-
> 1. Sign in to the <a href="https://portal.azure.com/" target="_blank">Azure portal</a>.
52-
> 1. If you have access to multiple tenants, use the **Directories + subscriptions** filter :::image type="icon" source="./media/common/portal-directory-subscription-filter.png" border="false"::: in the top menu to switch to the tenant in which you want to register the application.
53-
> 1. Search for and select **Azure Active Directory**.
54-
> 1. Under **Manage**, select **App registrations** > **New registration**.
55-
> 1. Enter a **Name** for your application, for example `Daemon-console`. Users of your app might see this name, and you can change it later.
56-
> 1. Select **Register**.
57-
> 1. Under **Manage**, select **Certificates & secrets**.
58-
> 1. Under **Client secrets**, select **New client secret**, enter a name, and then select **Add**. Record the secret value in a safe location for use in a later step.
59-
> 1. Under **Manage**, select **API Permissions** > **Add a permission**. Select **Microsoft Graph**.
60-
> 1. Select **Application permissions**.
61-
> 1. Under **User** node, select **User.Read.All**, then select **Add permissions**.
62-
63-
> [!div class="sxs-lookup" renderon="portal"]
64-
> ### Download and configure the quickstart app
65-
>
66-
> #### Step 1: Configure the application in Azure portal
67-
> For the code sample for this quickstart to work, you need to create a client secret, and add Graph API's **User.Read.All** application permission.
68-
> > [!div renderon="portal" id="makechanges" class="nextstepaction"]
69-
> > [Make these changes for me]()
70-
>
71-
> > [!div id="appconfigured" class="alert alert-info"]
72-
> > ![Already configured](media/quickstart-v2-netcore-daemon/green-check.png) Your application is configured with these attributes.
29+
> [!div class="sxs-lookup"]
30+
### Download and configure the quickstart app
7331

74-
#### Step 2: Download the Java project
32+
#### Step 1: Configure the application in Azure portal
33+
For the code sample for this quickstart to work, you need to create a client secret, and add Graph API's **User.Read.All** application permission.
34+
> [!div class="nextstepaction"]
35+
> [Make these changes for me]()
7536
76-
> [!div renderon="docs"]
77-
> [Download the Java daemon project](https://github.com/Azure-Samples/ms-identity-java-daemon/archive/master.zip)
37+
> [!div class="alert alert-info"]
38+
> ![Already configured](media/quickstart-v2-netcore-daemon/green-check.png) Your application is configured with these attributes.
7839
79-
> [!div renderon="portal" id="autoupdate" class="sxs-lookup nextstepaction"]
40+
#### Step 2: Download the Java project
41+
42+
> [!div class="sxs-lookup nextstepaction"]
8043
> [Download the code sample](https://github.com/Azure-Samples/ms-identity-java-daemon/archive/master.zip)
8144
82-
> [!div class="sxs-lookup" renderon="portal"]
45+
> [!div class="sxs-lookup"]
8346
> > [!NOTE]
8447
> > `Enter_the_Supported_Account_Info_Here`
8548
86-
> [!div renderon="docs"]
87-
> #### Step 3: Configure the Java project
88-
>
89-
> 1. Extract the zip file to a local folder close to the root of the disk, for example, *C:\Azure-Samples*.
90-
> 1. Navigate to the sub folder **msal-client-credential-secret**.
91-
> 1. Edit *src\main\resources\application.properties* and replace the values of the fields `AUTHORITY`, `CLIENT_ID`, and `SECRET` with the following snippet:
92-
>
93-
> ```
94-
> AUTHORITY=https://login.microsoftonline.com/Enter_the_Tenant_Id_Here/
95-
> CLIENT_ID=Enter_the_Application_Id_Here
96-
> SECRET=Enter_the_Client_Secret_Here
97-
> ```
98-
> Where:
99-
> - `Enter_the_Application_Id_Here` - is the **Application (client) ID** for the application you registered.
100-
> - `Enter_the_Tenant_Id_Here` - replace this value with the **Tenant Id** or **Tenant name** (for example, contoso.microsoft.com).
101-
> - `Enter_the_Client_Secret_Here` - replace this value with the client secret created on step 1.
102-
>
103-
> > [!TIP]
104-
> > To find the values of **Application (client) ID**, **Directory (tenant) ID**, go to the app's **Overview** page in the Azure portal. To generate a new key, go to **Certificates & secrets** page.
105-
106-
> [!div class="sxs-lookup" renderon="portal"]
107-
> #### Step 3: Admin consent
108-
109-
> [!div renderon="docs"]
110-
> #### Step 4: Admin consent
49+
#### Step 3: Admin consent
11150

11251
If you try to run the application at this point, you'll receive *HTTP 403 - Forbidden* error: `Insufficient privileges to complete the operation`. This error happens because any *app-only permission* requires Admin consent: a global administrator of your directory must give consent to your application. Select one of the options below depending on your role:
11352

11453
##### Global tenant administrator
11554

116-
> [!div renderon="docs"]
117-
> If you are a global tenant administrator, go to **API Permissions** page in **App registrations** in the Azure portal and select **Grant admin consent for {Tenant Name}** (Where {Tenant Name} is the name of your directory).
118-
119-
> [!div renderon="portal" class="sxs-lookup"]
55+
> [!div class="sxs-lookup"]
12056
> If you are a global administrator, go to **API Permissions** page select **Grant admin consent for Enter_the_Tenant_Name_Here**.
12157
> > [!div id="apipermissionspage"]
12258
> > [Go to the API Permissions page]()
@@ -129,16 +65,9 @@ If you're a standard user of your tenant, then you need to ask a global administ
12965
https://login.microsoftonline.com/Enter_the_Tenant_Id_Here/adminconsent?client_id=Enter_the_Application_Id_Here
13066
```
13167

132-
> [!div renderon="docs"]
133-
> > Where:
134-
> > * `Enter_the_Tenant_Id_Here` - replace this value with the **Tenant Id** or **Tenant name** (for example, contoso.microsoft.com)
135-
> > * `Enter_the_Application_Id_Here` - is the **Application (client) ID** for the application you registered.
136-
137-
> [!div class="sxs-lookup" renderon="portal"]
68+
> [!div class="sxs-lookup"]
13869
> #### Step 4: Run the application
13970
140-
> [!div renderon="docs"]
141-
> #### Step 5: Run the application
14271

14372
You can test the sample directly by running the main method of ClientCredentialGrant.java from your IDE.
14473

0 commit comments

Comments
 (0)