Created
June 4, 2020 07:53
-
-
Save igstan/7bed390f5d5bbb478167ca7b6f2c939b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as azure from "@pulumi/azure"; | |
import * as azuread from "@pulumi/azuread"; | |
import * as pulumi from "@pulumi/pulumi"; | |
import * as random from "@pulumi/random"; | |
export const app = new azuread.Application('pulumi', { | |
availableToOtherTenants: false, | |
homepage: "http://example.com", | |
identifierUris: ["http://example.com"], | |
oauth2AllowImplicitFlow: true, | |
replyUrls: ["http://example.com"], | |
}); | |
export const sp = new azuread.ServicePrincipal('pulumi', { | |
applicationId: app.applicationId, | |
}); | |
var password = new random.RandomPassword('pulumi-pass', { | |
length: 20, | |
special: true, | |
}); | |
var servicePrincipalPassword = new azuread.ServicePrincipalPassword('pulumi-sp-pass', { | |
servicePrincipalId: sp.id, | |
endDate: '2099-01-01T00:00:00Z', | |
value: password.result, | |
}); | |
const subscription = azure.core.getSubscription({}); | |
new azure.authorization.Assignment('pulumi-contributor', { | |
principalId: sp.objectId, | |
scope: subscription.then(p => p.id), | |
roleDefinitionName: 'Contributor', | |
}); | |
export const appID = app.applicationId; | |
export const spID = sp.id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment