Skip to content

Instantly share code, notes, and snippets.

@igstan
Created June 4, 2020 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igstan/7bed390f5d5bbb478167ca7b6f2c939b to your computer and use it in GitHub Desktop.
Save igstan/7bed390f5d5bbb478167ca7b6f2c939b to your computer and use it in GitHub Desktop.
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