You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -63,117 +63,45 @@ It takes about 20 minutes to do these steps.
63
63
64
64
```xml
65
65
<dependency>
66
-
<groupId>com.microsoft.azure</groupId>
67
-
<artifactId>azure</artifactId>
68
-
<version>1.1.0</version>
66
+
<groupId>com.azure</groupId>
67
+
<artifactId>azure-identity</artifactId>
68
+
<version>1.3.6</version>
69
69
</dependency>
70
70
<dependency>
71
-
<groupId>com.microsoft.azure</groupId>
72
-
<artifactId>azure-mgmt-compute</artifactId>
73
-
<version>1.1.0</version>
74
-
</dependency>
75
-
<dependency>
76
-
<groupId>com.microsoft.azure</groupId>
77
-
<artifactId>azure-mgmt-resources</artifactId>
78
-
<version>1.1.0</version>
79
-
</dependency>
80
-
<dependency>
81
-
<groupId>com.microsoft.azure</groupId>
82
-
<artifactId>azure-mgmt-network</artifactId>
83
-
<version>1.1.0</version>
84
-
</dependency>
85
-
<dependency>
86
-
<groupId>com.squareup.okio</groupId>
87
-
<artifactId>okio</artifactId>
88
-
<version>1.13.0</version>
89
-
</dependency>
90
-
<dependency>
91
-
<groupId>com.nimbusds</groupId>
92
-
<artifactId>nimbus-jose-jwt</artifactId>
93
-
<version>3.6</version>
94
-
</dependency>
95
-
<dependency>
96
-
<groupId>net.minidev</groupId>
97
-
<artifactId>json-smart</artifactId>
98
-
<version>1.0.6.3</version>
99
-
</dependency>
100
-
<dependency>
101
-
<groupId>javax.mail</groupId>
102
-
<artifactId>mail</artifactId>
103
-
<version>1.4.5</version>
71
+
<groupId>com.azure.resourcemanager</groupId>
72
+
<artifactId>azure-resourcemanager</artifactId>
73
+
<version>2.8.0</version>
104
74
</dependency>
105
75
```
106
76
107
77
3. Save the file.
108
78
109
-
## Create credentials
110
-
111
-
Before you start this step, make sure that you have access to an [Active Directory service principal](../../active-directory/develop/howto-create-service-principal-portal.md). You should also record the application ID, the authentication key, and the tenant ID that you need in a later step.
79
+
## Set up authentication
112
80
113
-
### Create the authorization file
81
+
Learn how to [set up authentication](../azure/developer/java/sdk/get-started#set-up-authentication).
114
82
115
-
1. Create a file named `azureauth.properties` and add these properties to it:
Replace **<subscription-id>** with your subscription identifier, **<application-id>** with the Active Directory application identifier, **<authentication-key>** with the application key, and **<tenant-id>** with the tenant identifier.
129
-
130
-
2. Save the file.
131
-
3. Set an environment variable named AZURE_AUTH_LOCATION in your shell with the full path to the authentication file.
132
-
133
-
### Create the management client
83
+
## Create the management client
134
84
135
85
1. Open the `App.java` file under `src\main\java\com\fabrikam` and make sure this package statement is at the top:
136
86
137
87
```java
138
88
package com.fabrikam.testAzureApp;
139
89
```
140
90
141
-
2. Under the package statement, add these import statements:
2. To create the Active Directory credentials that you need to make requests, add this code to the main method of the App class:
164
-
165
-
```java
166
-
try {
167
-
final File credFile = new File(System.getenv("AZURE_AUTH_LOCATION"));
168
-
Azure azure = Azure.configure()
169
-
.withLogLevel(LogLevel.BASIC)
170
-
.authenticate(credFile)
171
-
.withDefaultSubscription();
172
-
} catch (Exception e) {
173
-
System.out.println(e.getMessage());
174
-
e.printStackTrace();
175
-
}
98
+
// Please finish 'Set up authentication' step first to set the four environment variables: AZURE_SUBSCRIPTION_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET, AZURE_TENANT_ID
99
+
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
0 commit comments