-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_api_to_vm.json
More file actions
162 lines (162 loc) · 5.21 KB
/
deploy_api_to_vm.json
File metadata and controls
162 lines (162 loc) · 5.21 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.8.9.13224",
"templateHash": "15559643551456468043"
}
},
"parameters": {
"vmName": {
"type": "string",
"metadata": {
"description": "The name of you Virtual Machine."
}
},
"adminUsername": {
"type": "string",
"defaultValue": "demouser",
"metadata": {
"description": "SSH username for the Virtual Machine."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "SSH password for the Virtual Machine."
}
},
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources."
}
},
"availabilityZone": {
"type": "string",
"defaultValue": "",
"metadata": {
"description": "Availability Zone for VM. If not specified no AZs will be used"
}
},
"vmSize": {
"type": "string",
"defaultValue": "Standard_B1s",
"metadata": {
"description": "The size of the VM"
}
},
"virtualNetworkName": {
"type": "string",
"metadata": {
"description": "Name of the VNet. Needs to have been previously created in the same RG where the VM will be deployed"
}
},
"subnetName": {
"type": "string",
"metadata": {
"description": "Name of the subnet in the virtual network. Needs to have been previously created"
}
},
"sqlServerFQDN":{
"type": "string",
"metadata": {
"description": "Fully-Qualified Domain Name or IP address of SQL Server"
}
},
"sqlServerUser":{
"type": "string",
"defaultValue": "demouser",
"metadata": {
"description": "Username for SQL auth"
}
},
"sqlServerPassword":{
"type": "securestring",
"defaultValue": "demo!pass123",
"metadata": {
"description": "Password for SQL auth"
}
}
},
"variables": {
"containerImage": "securenetworkingopenhack/ohndapi:1.0",
"networkInterfaceName": "[format('{0}-nic', parameters('vmName'))]",
"osDiskType": "Standard_LRS",
"customData": "[concat('#!/bin/bash\ndocker run --restart always -d -p 8080:8080 -e \"SQL_SERVER_FQDN=', parameters('sqlServerFQDN'),'\" -e \"SQL_SERVER_USERNAME=', parameters('sqlServerUser'),'\" -e \"SQL_SERVER_PASSWORD=', parameters('sqlServerPassword'),'\" --name api ', variables('containerImage'))]"
},
"resources": [
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2021-05-01",
"name": "[variables('networkInterfaceName')]",
"location": "[parameters('location')]",
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[concat(resourceGroup().id, '/providers/Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'), '/subnets/', parameters('subnetName'))]"
},
"privateIPAllocationMethod": "Dynamic"
}
}
]
},
"dependsOn": []
},
{
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2021-11-01",
"name": "[parameters('vmName')]",
"location": "[parameters('location')]",
"plan": {
"name": "stable-gen2",
"product": "flatcar-container-linux-free",
"publisher": "kinvolk"
},
"zones": "[if(empty(parameters('availabilityZone')),parameters('availabilityZone'),array(parameters('availabilityZone')))]",
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('vmSize')]"
},
"storageProfile": {
"osDisk": {
"createOption": "FromImage",
"managedDisk": {
"storageAccountType": "[variables('osDiskType')]"
}
},
"imageReference": {
"publisher": "kinvolk",
"offer": "flatcar-container-linux-free",
"sku": "stable-gen2",
"version": "latest"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]"
}
]
},
"osProfile": {
"computerName": "[parameters('vmName')]",
"customData": "[base64(variables('customData'))]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
}
},
"dependsOn": [
"[resourceId('Microsoft.Network/networkInterfaces', variables('networkInterfaceName'))]"
]
}
],
"outputs": {
}
}