Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Commit 05d048d

Browse files
committed
basic hello world
1 parent 6cc3a24 commit 05d048d

File tree

3 files changed

+155
-0
lines changed

3 files changed

+155
-0
lines changed

azuredeploy.json

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{
2+
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
"webSiteName": {
6+
"type": "string",
7+
"maxLength": 15,
8+
"metadata": {
9+
"description": "Name of the Web App."
10+
}
11+
},
12+
"skuName": {
13+
"type": "string",
14+
"defaultValue": "F1",
15+
"allowedValues": [
16+
"F1",
17+
"D1",
18+
"B1",
19+
"B2",
20+
"B3",
21+
"S1",
22+
"S2",
23+
"S3",
24+
"P1",
25+
"P2",
26+
"P3",
27+
"P4"
28+
],
29+
"metadata": {
30+
"description": "Describes plan's pricing tier and instance size. Check details at https://azure.microsoft.com/en-us/pricing/details/app-service/"
31+
}
32+
},
33+
"keyVaultName": {
34+
"type": "string",
35+
"metadata": {
36+
"description": "Key Vault to be created. Web site will be granted access to this Key Vault."
37+
}
38+
},
39+
"keyVaultSecret": {
40+
"type": "string",
41+
"metadata": {
42+
"description": "Secret to add to the Key Vault"
43+
}
44+
}
45+
},
46+
"variables": {
47+
"hostingPlanName": "[concat('hostingplan', uniqueString(resourceGroup().id))]",
48+
"identityResourceId" : "[concat(resourceId('Microsoft.Web/sites', parameters('webSiteName')),'/providers/Microsoft.ManagedIdentity/Identities/default')]"
49+
},
50+
"resources": [
51+
{
52+
"apiVersion": "2016-03-01",
53+
"name": "[variables('hostingPlanName')]",
54+
"type": "Microsoft.Web/serverfarms",
55+
"location": "[resourceGroup().location]",
56+
"tags": {
57+
"displayName": "HostingPlan"
58+
},
59+
"sku": {
60+
"name": "[parameters('skuName')]",
61+
"capacity": 1
62+
},
63+
"properties": {
64+
"name": "[variables('hostingPlanName')]"
65+
}
66+
},
67+
{
68+
"apiVersion": "2016-03-01",
69+
"name": "[parameters('webSiteName')]",
70+
"type": "Microsoft.Web/sites",
71+
"location": "[resourceGroup().location]",
72+
"identity": {
73+
"type": "SystemAssigned"
74+
},
75+
"dependsOn": [
76+
"[variables('hostingPlanName')]"
77+
],
78+
"tags": {
79+
"[concat('hidden-related:', resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName')))]": "empty",
80+
"displayName": "Website"
81+
},
82+
"properties": {
83+
"name": "[parameters('webSiteName')]",
84+
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', variables('hostingPlanName'))]"
85+
}
86+
},
87+
{
88+
"type": "Microsoft.KeyVault/vaults",
89+
"name": "[parameters('keyVaultName')]",
90+
"apiVersion": "2015-06-01",
91+
"location": "[resourceGroup().location]",
92+
"tags": {},
93+
"properties": {
94+
"sku": {
95+
"family": "A",
96+
"name": "Standard"
97+
},
98+
"tenantId": "[reference(variables('identityResourceId'), '2015-08-31-PREVIEW').tenantId]",
99+
"accessPolicies": [
100+
{
101+
"tenantId": "[reference(variables('identityResourceId'), '2015-08-31-PREVIEW').tenantId]",
102+
"objectId": "[reference(variables('identityResourceId'), '2015-08-31-PREVIEW').principalId]",
103+
"permissions": {
104+
"secrets": [
105+
"get"
106+
]
107+
}
108+
}
109+
],
110+
"enabledForDeployment": false
111+
},
112+
"dependsOn": [
113+
"[concat('Microsoft.Web/sites/', parameters('webSiteName'))]"
114+
]
115+
},
116+
{
117+
"type": "Microsoft.KeyVault/vaults/secrets",
118+
"name": "[concat(parameters('keyVaultName'), '/', 'secret')]",
119+
"apiVersion": "2015-06-01",
120+
"properties": {
121+
"value": "[parameters('keyVaultSecret')]"
122+
},
123+
"dependsOn": [
124+
"[concat('Microsoft.KeyVault/vaults/', parameters('keyVaultName'))]"
125+
]
126+
}
127+
]
128+
}

index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var http = require('http');
2+
3+
var server = http.createServer(function(request, response) {
4+
5+
response.writeHead(200, {"Content-Type": "text/plain"});
6+
response.end("Hello World!");
7+
8+
});
9+
10+
var port = process.env.PORT || 1337;
11+
server.listen(port);
12+
13+
console.log("Server running at http://localhost:%d", port);

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "app-service-hello-world",
3+
"description": "Simple Hello World Node.js sample for Azure App Service",
4+
"version": "0.0.1",
5+
"private": true,
6+
"license": "MIT",
7+
"author": "Microsoft",
8+
"engines": {
9+
"node": ">=6.9.1"
10+
},
11+
"scripts": {
12+
"start": "node index.js"
13+
}
14+
}

0 commit comments

Comments
 (0)