-
Notifications
You must be signed in to change notification settings - Fork 9
/
website.ts
61 lines (54 loc) · 2.04 KB
/
website.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import * as azure from "@pulumi/azure";
import * as azuread from "@pulumi/azuread";
import * as pulumi from "@pulumi/pulumi";
import * as cdn from "@pulumi/azure-nextgen/cdn/latest";
import { appName, location, resourceGroupName } from "./common";
export const storageAccount = new azure.storage.Account(`${appName}fe`, {
resourceGroupName: resourceGroupName,
tags: {
displayName: "Drone Front End Storage Account",
},
accountTier: "Standard",
accountReplicationType: "LRS",
staticWebsite: {
indexDocument: "index.html",
error404Document: "404.html",
},
});
export const storageAccountUrl = storageAccount.primaryWebEndpoint;
const cdnProfile = new cdn.Profile("profile", {
resourceGroupName: resourceGroupName,
profileName: `${appName}-cdn`,
location: location,
sku: { name: "Standard_Microsoft" },
});
const cdnEndpoint = new cdn.Endpoint("endpoint", {
resourceGroupName: resourceGroupName,
profileName: cdnProfile.name,
endpointName: `${appName}-endpoint`,
location: location,
isHttpAllowed: false,
origins: [{ name: "origin", hostName: storageAccount.primaryWebHost }],
originHostHeader: storageAccount.primaryWebHost,
});
export const cdnUrl = pulumi.interpolate`https://${cdnEndpoint.hostName}`;
export const tenantId = pulumi.output(azure.core.getClientConfig()).tenantId;
const apiAppName=`${appName}-api`;
const apiApp = new azuread.Application(apiAppName, {
name: apiAppName,
oauth2AllowImplicitFlow: true,
replyUrls: [storageAccountUrl, cdnUrl],
identifierUris: [`http://${apiAppName}`],
appRoles: [{
allowedMemberTypes: [ "User" ],
description:"Access to device status",
displayName:"Get Device Status",
isEnabled:true,
value: "GetStatus",
}],
requiredResourceAccesses: [{
resourceAppId: "00000003-0000-0000-c000-000000000000",
resourceAccesses: [ { id: "e1fe6dd8-ba31-4d61-89e7-88639da4683d", type: "Scope" } ],
}],
});
export const applicationId = apiApp.applicationId;