Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (!existingServicePrincipal) {
- // Get token for graph API and create application object + service principal
- return from(this.getTokenForGraphApi()).pipe(
- mergeMap((graphToken: string) => [
- this.subscriptionLinkerService.postApplicationObject(
- graphToken
- ),
- graphToken
- ]),
- mergeMap(([appId, graphToken]) => {
- existingServicePrincipal = new ServicePrincipal();
- existingServicePrincipal.subscriptionId = [];
- existingServicePrincipal.tenantId = this.selectedTenant.tenantId;
- existingServicePrincipal.activeSubscription = this.selectedSubscription.azureId;
- existingServicePrincipal.clientId = appId;
- existingServicePrincipal.clientSecret = Guid.newGuid();
- return this.subscriptionLinkerService.createPrincipal(
- existingServicePrincipal,
- graphToken
- );
- })
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement