|
| 1 | +name: azure-app-service |
| 2 | +runtime: yaml |
| 3 | +description: A static website hosted on AWS S3 |
| 4 | +configuration: |
| 5 | + sqlAdmin: |
| 6 | + type: String |
| 7 | + default: pulumi |
| 8 | +variables: |
| 9 | + blobAccessToken: |
| 10 | + Fn::Invoke: |
| 11 | + Function: azure-native:storage:listStorageAccountServiceSAS |
| 12 | + Arguments: |
| 13 | + accountName: ${sa.name} |
| 14 | + protocols: https |
| 15 | + sharedAccessStartTime: '2022-01-01' |
| 16 | + sharedAccessExpiryTime: '2030-01-01' |
| 17 | + resource: c |
| 18 | + resourceGroupName: ${appservicegroup.name} |
| 19 | + permissions: r |
| 20 | + canonicalizedResource: /blob/${sa.name}/${container.name} |
| 21 | + contentType: application/json |
| 22 | + cacheControl: max-age=5 |
| 23 | + contentDisposition: inline |
| 24 | + contentEncoding: deflate |
| 25 | + Return: serviceSasToken |
| 26 | +resources: |
| 27 | + appservicegroup: |
| 28 | + type: azure-native:resources:ResourceGroup |
| 29 | + sa: |
| 30 | + type: azure-native:storage:StorageAccount |
| 31 | + properties: |
| 32 | + resourceGroupName: ${appservicegroup.name} |
| 33 | + kind: 'StorageV2' |
| 34 | + sku: { name: 'Standard_LRS' } |
| 35 | + appserviceplan: |
| 36 | + type: azure-native:web:AppServicePlan |
| 37 | + properties: |
| 38 | + resourceGroupName: ${appservicegroup.name} |
| 39 | + kind: App |
| 40 | + sku: |
| 41 | + name: B1 |
| 42 | + tier: Basic |
| 43 | + container: |
| 44 | + type: azure-native:storage:BlobContainer |
| 45 | + properties: |
| 46 | + resourceGroupName: ${appservicegroup.name} |
| 47 | + accountName: ${sa.name} |
| 48 | + publicAccess: None |
| 49 | + blob: |
| 50 | + type: azure-native:storage:Blob |
| 51 | + properties: |
| 52 | + resourceGroupName: ${appservicegroup.name} |
| 53 | + accountName: ${sa.name} |
| 54 | + containerName: ${container.name} |
| 55 | + type: 'Block' |
| 56 | + source: |
| 57 | + Fn::FileArchive: ./www |
| 58 | + appInsights: |
| 59 | + type: azure-native:insights:Component |
| 60 | + properties: |
| 61 | + resourceGroupName: ${appservicegroup.name} |
| 62 | + applicationType: web |
| 63 | + kind: web |
| 64 | + sqlPassword: |
| 65 | + type: random:RandomPassword |
| 66 | + properties: |
| 67 | + length: 16 |
| 68 | + special: true |
| 69 | + sqlServer: |
| 70 | + type: azure-native:sql:Server |
| 71 | + properties: |
| 72 | + resourceGroupName: ${appservicegroup.name} |
| 73 | + administratorLogin: ${sqlAdmin} |
| 74 | + administratorLoginPassword: ${sqlPassword.result} |
| 75 | + version: '12.0' |
| 76 | + db: |
| 77 | + type: azure-native:sql:Database |
| 78 | + properties: |
| 79 | + resourceGroupName: ${appservicegroup.name} |
| 80 | + serverName: ${sqlServer.name} |
| 81 | + sku: { name: 'S0' } |
| 82 | + |
| 83 | + app: |
| 84 | + type: azure-native:web:WebApp |
| 85 | + properties: |
| 86 | + resourceGroupName: ${appservicegroup.name} |
| 87 | + serverFarmId: ${appserviceplan} |
| 88 | + siteConfig: |
| 89 | + appSettings: |
| 90 | + - name: WEBSITE_RUN_FROM_PACKAGE |
| 91 | + value: https://${sa.name}.blob.core.windows.net/${container.name}/${blob.name}?${blobAccessToken} |
| 92 | + - name: APPINSIGHTS_INSTRUMENTATIONKEY |
| 93 | + value: ${appInsights.instrumentationKey} |
| 94 | + - name: APPLICATIONINSIGHTS_CONNECTION_STRING |
| 95 | + value: InstrumentationKey=${appInsights.instrumentationKey} |
| 96 | + - name: ApplicationInsightsAgent_EXTENSION_VERSION |
| 97 | + value: ~2 |
| 98 | + connectionStrings: |
| 99 | + - name: db |
| 100 | + type: SQLAzure |
| 101 | + connectionString: Server= tcp:${sqlServer.name}.database.windows.net;initial catalog=${db.name};userID=${sqlAdmin};password=${sqlPassword.result};Min Pool Size=0;Max Pool Size=30;Persist Security Info=true; |
| 102 | +outputs: |
| 103 | + endpoint: ${app.defaultHostName} |
0 commit comments