Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (!existingServicePrincipal) {
  2.                   // Get token for graph API and create application object + service principal
  3.                   return from(this.getTokenForGraphApi()).pipe(
  4.                     mergeMap((graphToken: string) => [
  5.                       this.subscriptionLinkerService.postApplicationObject(
  6.                         graphToken
  7.                       ),
  8.                       graphToken
  9.                     ]),
  10.                     mergeMap(([appId, graphToken]) => {
  11.                       existingServicePrincipal = new ServicePrincipal();
  12.                       existingServicePrincipal.subscriptionId = [];
  13.                       existingServicePrincipal.tenantId = this.selectedTenant.tenantId;
  14.                       existingServicePrincipal.activeSubscription = this.selectedSubscription.azureId;
  15.                       existingServicePrincipal.clientId = appId;
  16.                       existingServicePrincipal.clientSecret = Guid.newGuid();
  17.                       return this.subscriptionLinkerService.createPrincipal(
  18.                         existingServicePrincipal,
  19.                         graphToken
  20.                       );
  21.                     })
  22.                   );
  23.                 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement