Skip to content

Commit 2857d2a

Browse files
Fix path2 e2e: use graph.microsoft.com to match msal-go
management.azure.com is not enrolled for mTLS PoP in this tenant; graph.microsoft.com is. Mirrors msal-go's path2_managedidentity/main.go which uses https://graph.microsoft.com as the resource. Verified: full flow succeeds — binding cert received, mTLS PoP token issued, cert cache working on second call, downstream TLS handshake OK. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b2cb908 commit 2857d2a

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

msal4j-mtls-extensions/src/e2e/java/com/microsoft/aad/msal4j/mtls/e2e/Path2ManagedIdentity.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
public class Path2ManagedIdentity {
3535

36-
private static final String RESOURCE = "https://management.azure.com";
36+
private static final String RESOURCE = "https://graph.microsoft.com";
3737

3838
public static void main(String[] args) throws Exception {
3939
run(args);
@@ -67,7 +67,7 @@ static void run(String[] args) throws Exception {
6767
System.err.println("ℹ️ AADSTS392196: The resource application does not support certificate-bound tokens.");
6868
System.err.println(" This is a tenant/resource configuration issue (same as MSAL.NET on this VM).");
6969
System.err.println(" The mTLS handshake succeeded — the code is working correctly.");
70-
System.err.println(" To fully test, use a tenant where mTLS PoP is enabled for management.azure.com.");
70+
System.err.println(" To fully test, use a tenant where mTLS PoP is enabled for graph.microsoft.com.");
7171
} else {
7272
System.err.println("Common causes:");
7373
System.err.println(" - VBS/KeyGuard not running (check msinfo32.exe)");
@@ -110,7 +110,7 @@ static void run(String[] args) throws Exception {
110110

111111
// ── Third call: Graph /me to verify token actually works ────────────────
112112
System.out.println();
113-
System.out.println("Making downstream mTLS call to management.azure.com...");
113+
System.out.println("Making downstream mTLS call to graph.microsoft.com...");
114114
makeDownstreamCall(client, result1, withAttestation);
115115

116116
System.out.println();
@@ -121,8 +121,8 @@ static void run(String[] args) throws Exception {
121121

122122
private static void makeDownstreamCall(MtlsMsiClient client, MtlsMsiHelperResult result,
123123
boolean withAttestation) {
124-
// management.azure.com /subscriptions — any auth error is still a TLS success.
125-
String url = "https://management.azure.com/subscriptions?api-version=2020-01-01";
124+
// graph.microsoft.com /v1.0/servicePrincipals — any auth error is still a TLS success.
125+
String url = "https://graph.microsoft.com/v1.0/servicePrincipals?$top=1";
126126
try {
127127
MtlsMsiHttpResponse resp = client.httpRequest(
128128
url, "GET", result.getAccessToken(),
@@ -138,9 +138,9 @@ private static void makeDownstreamCall(MtlsMsiClient client, MtlsMsiHelperResult
138138
System.out.println(" ❌ Server error — check token and resource enrollment");
139139
}
140140
if (resp.getStatus() == 200) {
141-
System.out.println(" ✅ HTTP 200 — full mTLS PoP token accepted by management.azure.com");
141+
System.out.println(" ✅ HTTP 200 — full mTLS PoP token accepted by graph.microsoft.com");
142142
} else if (resp.getStatus() == 401 || resp.getStatus() == 403) {
143-
System.out.println(" ℹ️ " + resp.getStatus() + " — TLS OK, authorization depends on subscription/role");
143+
System.out.println(" ℹ️ " + resp.getStatus() + " — TLS OK, authorization depends on permissions");
144144
}
145145
} catch (MtlsMsiException e) {
146146
System.out.println(" ❌ Downstream mTLS call failed: " + e.getMessage());

0 commit comments

Comments
 (0)