Skip to content

Commit 0cfd399

Browse files
Merge pull request #223177 from OwenRichards1/azure-docs-fix-article2
Resolving #93895 (Urgent attention)
2 parents 9653ff2 + 684af70 commit 0cfd399

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

articles/active-directory/develop/workload-identity-federation-create-trust-gcp.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
title: Access Azure resources from Google Cloud without credentials
33
description: Access Azure AD protected resources from a service running in Google Cloud without using secrets or certificates. Use workload identity federation to set up a trust relationship between an app in Azure AD and an identity in Google Cloud. The workload running in Google Cloud can get an access token from Microsoft identity platform and access Azure AD protected resources.
44
services: active-directory
5-
author: rwike77
5+
author: OwenRichards1
66
manager: CelesteDG
77

88
ms.service: active-directory
99
ms.subservice: develop
1010
ms.topic: how-to
1111
ms.workload: identity
12-
ms.date: 08/07/2022
13-
ms.author: ryanwi
12+
ms.date: 01/06/2023
13+
ms.author: owenrichards
1414
ms.custom: aaddev
1515
ms.reviewer: udayh
1616
#Customer intent: As an application developer, I want to create a trust relationship with a Google Cloud identity so my service in Google Cloud can access Azure AD protected resources without managing secrets.
@@ -206,32 +206,32 @@ class ClientAssertionCredential implements TokenCredential {
206206

207207
// Get the ID token from Google.
208208
return getGoogleIDToken() // calling this directly just for clarity,
209-
// this should be a callback
210-
// pass this as a client assertion to the confidential client app
211-
.then((clientAssertion:any)=> {
212-
var msalApp: any;
213-
msalApp = new msal.ConfidentialClientApplication({
214-
auth: {
215-
clientId: this.clientID,
216-
authority: this.aadAuthority + this.tenantID,
217-
clientAssertion: clientAssertion,
218-
}
209+
210+
let aadAudience = "api://AzureADTokenExchange"
211+
const jwt = axios({
212+
url: "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience="
213+
+ aadAudience,
214+
method: "GET",
215+
headers: {
216+
"Metadata-Flavor": "Google"
217+
}}).then(response => {
218+
console.log("AXIOS RESPONSE");
219+
return response.data;
220+
});
221+
return jwt;
222+
.then(function(aadToken) {
223+
// return in form expected by TokenCredential.getToken
224+
let returnToken = {
225+
token: aadToken.accessToken,
226+
expiresOnTimestamp: aadToken.expiresOn.getTime(),
227+
};
228+
return (returnToken);
229+
})
230+
.catch(function(error) {
231+
// error stuff
219232
});
220-
return msalApp.acquireTokenByClientCredential({ scopes })
221-
})
222-
.then(function(aadToken) {
223-
// return in form expected by TokenCredential.getToken
224-
let returnToken = {
225-
token: aadToken.accessToken,
226-
expiresOnTimestamp: aadToken.expiresOn.getTime(),
227-
};
228-
return (returnToken);
229-
})
230-
.catch(function(error) {
231-
// error stuff
232-
});
233+
}
233234
}
234-
}
235235
export default ClientAssertionCredential;
236236
```
237237

0 commit comments

Comments
 (0)