|
2 | 2 | title: Access Azure resources from Google Cloud without credentials
|
3 | 3 | 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.
|
4 | 4 | services: active-directory
|
5 |
| -author: rwike77 |
| 5 | +author: OwenRichards1 |
6 | 6 | manager: CelesteDG
|
7 | 7 |
|
8 | 8 | ms.service: active-directory
|
9 | 9 | ms.subservice: develop
|
10 | 10 | ms.topic: how-to
|
11 | 11 | ms.workload: identity
|
12 |
| -ms.date: 08/07/2022 |
13 |
| -ms.author: ryanwi |
| 12 | +ms.date: 01/06/2023 |
| 13 | +ms.author: owenrichards |
14 | 14 | ms.custom: aaddev
|
15 | 15 | ms.reviewer: udayh
|
16 | 16 | #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.
|
@@ -209,31 +209,29 @@ class ClientAssertionCredential implements TokenCredential {
|
209 | 209 |
|
210 | 210 | let aadAudience = "api://AzureADTokenExchange"
|
211 | 211 | const jwt = axios({
|
212 |
| - |
213 | 212 | url: "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience="
|
214 | 213 | + aadAudience,
|
215 |
| - method: "GET", |
216 |
| - headers: { |
217 |
| - "Metadata-Flavor": "Google" |
218 |
| - }}).then(response => { |
219 |
| - console.log("AXIOS RESPONSE"); |
220 |
| - return response.data; |
| 214 | + method: "GET", |
| 215 | + headers: { |
| 216 | + "Metadata-Flavor": "Google" |
| 217 | + }}).then(response => { |
| 218 | + console.log("AXIOS RESPONSE"); |
| 219 | + return response.data; |
221 | 220 | });
|
222 | 221 | return jwt;
|
223 |
| - |
224 |
| - .then(function(aadToken) { |
225 |
| - // return in form expected by TokenCredential.getToken |
226 |
| - let returnToken = { |
227 |
| - token: aadToken.accessToken, |
228 |
| - expiresOnTimestamp: aadToken.expiresOn.getTime(), |
229 |
| - }; |
230 |
| - return (returnToken); |
231 |
| - }) |
232 |
| - .catch(function(error) { |
233 |
| - // error stuff |
234 |
| - }); |
| 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 | + } |
235 | 234 | }
|
236 |
| -} |
237 | 235 | export default ClientAssertionCredential;
|
238 | 236 | ```
|
239 | 237 |
|
|
0 commit comments