Skip to content

Commit 8614521

Browse files
authored
Mgmt: Graph, update to microsoft graph API (Azure#18420)
* remove non need parameter * update specs * generate microsoft graph v1.0 * fix service principal error * fix application error * add domain yml * regenerate * fix user error * download groups.yml * add delete members api from https://docs.microsoft.com/en-us/graph/api/group-delete-members * regen * fix group error * fix compile error * update test * update azure environment * group members return 204 as success * regen * fix some test error * password credential do not allow specifying value * use display name for credentials * application do not need sing on url * fix refresh credential * remove password secret due to it cannot be set * custom sign on url is removed * use subscription id from withSubscriptionId * update export to file method * service principal use addPassword for creation and use inner for others creation or deletion * update test * update session records * fix keyvault test * update session records * change display name and spNames order * Revert "update azure environment" This reverts commit 8de3c2d. * fix compile error * fix compile error * change readme.md to swagger.md due to CI * remove groups onenote api * regen * fix checkstyle * add credcheck for secretText * add credcheck search * run credcheck * remove conflict file change * run cred check * fix checkstyle * fix spotbugs * deprecate export to auth file and add password consumer * add password consumer test * add logging for parser * use singletonMap * add delete logic for test * add back withNewApplication(String) * update session records * update core-management * update microsoft graph endpoint * update graph endpoint in test * add all endpoint to test profile * add change log * remove groups calender events threads API * regen * skip revapi * update change log * remove en-us in link * skip revapi in keyvault * skip in other dependency * update revapi
1 parent dbbb326 commit 8614521

File tree

876 files changed

+258463
-19882
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

876 files changed

+258463
-19882
lines changed

sdk/resourcemanager/api-specs.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,11 @@
167167
"args": "--tag=package-features-2015-12"
168168
},
169169
"graphrbac": {
170+
"spec": "https://raw.githubusercontent.com/Azure/azure-sdk-for-java/master/sdk/resourcemanager",
170171
"dir": "azure-resourcemanager-authorization",
171-
"source": "specification/graphrbac/data-plane/readme.md",
172+
"source": "azure-resourcemanager-authorization/swagger/swagger.md",
172173
"package": "com.azure.resourcemanager.authorization",
173-
"args": "--payload-flattening-threshold=1 --tag=1.6"
174+
"args": "--tag=v1.0 --title=MicrosoftGraphClient --models-subpackage=fluent.models"
174175
},
175176
"iothub": {
176177
"dir": "azure-resourcemanager-devices",

sdk/resourcemanager/azure-resourcemanager-appservice/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@
206206
<artifactId>revapi-maven-plugin</artifactId>
207207
<version>0.11.2</version> <!-- {x-version-update;org.revapi:revapi-maven-plugin;external_dependency} -->
208208
<configuration>
209+
<skip>true</skip>
209210
<analysisConfiguration>
210211
<revapi.ignore>
211212
<item>

sdk/resourcemanager/azure-resourcemanager-authorization/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## 2.2.0-beta.1 (Unreleased)
44

5+
- Updated API from `AAD Graph` to `Microsoft Graph`. New permission needs to be granted before calling the API, [Reference](https://docs.microsoft.com/graph/permissions-reference)
6+
- Removed `applicationPermissions` in `ActiveDirectoryApplication`
7+
- Removed `signInName` in `ActiveDirectoryUser`
8+
- Removed `withPasswordValue` in `PasswordCredential.Definition`
9+
- Supported `withPasswordConsumer` in `PasswordCredential.Definition` to consume the password value.
510

611
## 2.1.0 (2020-11-24)
712

sdk/resourcemanager/azure-resourcemanager-authorization/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
<artifactId>revapi-maven-plugin</artifactId>
154154
<version>0.11.2</version> <!-- {x-version-update;org.revapi:revapi-maven-plugin;external_dependency} -->
155155
<configuration>
156+
<skip>true</skip>
156157
<analysisConfiguration>
157158
<revapi.ignore>
158159
<item>

sdk/resourcemanager/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/AuthorizationManager.java

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55

66
import com.azure.core.credential.TokenCredential;
77
import com.azure.core.http.HttpPipeline;
8+
import com.azure.core.management.AzureEnvironment;
89
import com.azure.core.management.profile.AzureProfile;
910
import com.azure.resourcemanager.authorization.fluent.AuthorizationManagementClient;
11+
import com.azure.resourcemanager.authorization.fluent.MicrosoftGraphClient;
1012
import com.azure.resourcemanager.authorization.implementation.AuthorizationManagementClientBuilder;
11-
import com.azure.resourcemanager.authorization.fluent.GraphRbacManagementClient;
12-
import com.azure.resourcemanager.authorization.implementation.GraphRbacManagementClientBuilder;
1313
import com.azure.resourcemanager.authorization.implementation.ActiveDirectoryApplicationsImpl;
1414
import com.azure.resourcemanager.authorization.implementation.ActiveDirectoryGroupsImpl;
1515
import com.azure.resourcemanager.authorization.implementation.ActiveDirectoryUsersImpl;
16+
import com.azure.resourcemanager.authorization.implementation.MicrosoftGraphClientBuilder;
1617
import com.azure.resourcemanager.authorization.implementation.RoleAssignmentsImpl;
1718
import com.azure.resourcemanager.authorization.implementation.RoleDefinitionsImpl;
1819
import com.azure.resourcemanager.authorization.implementation.ServicePrincipalsImpl;
@@ -29,11 +30,12 @@
2930
import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils;
3031

3132
/** Entry point to Azure Authorization and Graph RBAC management. */
32-
public final class AuthorizationManager implements HasServiceClient<GraphRbacManagementClient> {
33+
public final class AuthorizationManager implements HasServiceClient<MicrosoftGraphClient> {
3334
private final String tenantId;
35+
private final AzureEnvironment environment;
3436
private ResourceManagerUtils.InternalRuntimeContext internalContext;
3537
// The sdk clients
36-
private final GraphRbacManagementClient graphRbacManagementClient;
38+
private final MicrosoftGraphClient microsoftGraphClient;
3739
private final AuthorizationManagementClient authorizationManagementClient;
3840
// The collections
3941
private ActiveDirectoryUsers activeDirectoryUsers;
@@ -43,6 +45,8 @@ public final class AuthorizationManager implements HasServiceClient<GraphRbacMan
4345
private RoleAssignments roleAssignments;
4446
private RoleDefinitions roleDefinitions;
4547

48+
private static final String DEFAULT_GRAPH_ENDPOINT_SUFFIX = "v1.0";
49+
4650
/**
4751
* Creates an instance of AuthorizationManager that exposes Authorization
4852
* and Graph RBAC management API entry points.
@@ -77,8 +81,8 @@ public static Configurable configure() {
7781
}
7882

7983
@Override
80-
public GraphRbacManagementClient serviceClient() {
81-
return this.graphRbacManagementClient;
84+
public MicrosoftGraphClient serviceClient() {
85+
return this.microsoftGraphClient;
8286
}
8387

8488
/** The interface allowing configurations to be set. */
@@ -103,11 +107,15 @@ public AuthorizationManager authenticate(TokenCredential credential, AzureProfil
103107
}
104108

105109
private AuthorizationManager(HttpPipeline httpPipeline, AzureProfile profile) {
106-
this.graphRbacManagementClient =
107-
new GraphRbacManagementClientBuilder()
110+
String graphEndpoint = profile.getEnvironment().getMicrosoftGraphEndpoint();
111+
graphEndpoint = graphEndpoint.endsWith("/")
112+
? graphEndpoint + DEFAULT_GRAPH_ENDPOINT_SUFFIX
113+
: graphEndpoint + "/" + DEFAULT_GRAPH_ENDPOINT_SUFFIX;
114+
115+
this.microsoftGraphClient =
116+
new MicrosoftGraphClientBuilder()
108117
.pipeline(httpPipeline)
109-
.endpoint(profile.getEnvironment().getGraphEndpoint())
110-
.tenantId(profile.getTenantId())
118+
.endpoint(graphEndpoint)
111119
.buildClient();
112120
this.authorizationManagementClient =
113121
new AuthorizationManagementClientBuilder()
@@ -116,6 +124,7 @@ private AuthorizationManager(HttpPipeline httpPipeline, AzureProfile profile) {
116124
.subscriptionId(profile.getSubscriptionId())
117125
.buildClient();
118126
this.tenantId = profile.getTenantId();
127+
this.environment = profile.getEnvironment();
119128
}
120129

121130
/**
@@ -131,6 +140,11 @@ public String tenantId() {
131140
return tenantId;
132141
}
133142

143+
/** @return the environment the graph client is associated with */
144+
public AzureEnvironment environment() {
145+
return environment;
146+
}
147+
134148
/** @return the {@link ResourceManagerUtils.InternalRuntimeContext} associated with this manager */
135149
public ResourceManagerUtils.InternalRuntimeContext internalContext() {
136150
if (internalContext == null) {
@@ -158,15 +172,15 @@ public ActiveDirectoryGroups groups() {
158172
/** @return the service principal management API entry point */
159173
public ServicePrincipals servicePrincipals() {
160174
if (servicePrincipals == null) {
161-
servicePrincipals = new ServicePrincipalsImpl(graphRbacManagementClient.getServicePrincipals(), this);
175+
servicePrincipals = new ServicePrincipalsImpl(this);
162176
}
163177
return servicePrincipals;
164178
}
165179

166180
/** @return the application management API entry point */
167181
public ActiveDirectoryApplications applications() {
168182
if (applications == null) {
169-
applications = new ActiveDirectoryApplicationsImpl(graphRbacManagementClient.getApplications(), this);
183+
applications = new ActiveDirectoryApplicationsImpl(this);
170184
}
171185
return applications;
172186
}

0 commit comments

Comments
 (0)