Skip to content

Commit 8148dbe

Browse files
committed
new cli scripts for deploying
1 parent fc0a916 commit 8148dbe

5 files changed

Lines changed: 299 additions & 0 deletions

File tree

deploy/az/win-vm/azuredeploy.json

Lines changed: 289 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
{
2+
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3+
"contentVersion": "1.0.0.0",
4+
"parameters": {
5+
6+
"VMName": {
7+
"type": "string",
8+
"metadata": {
9+
"description": "This name will also be used to prefix the network security group, storage, virtual network, network card, subnet and public IP address name."
10+
}
11+
},
12+
13+
"adminUsername": {
14+
"type": "string",
15+
"metadata": {
16+
"description": "Username for the Virtual Machine."
17+
}
18+
},
19+
20+
"adminPassword": {
21+
"type": "securestring",
22+
"metadata": {
23+
"description": "Password for the Virtual Machine."
24+
}
25+
},
26+
27+
"dnsNameForPublicIP": {
28+
"type": "string",
29+
"metadata": {
30+
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
31+
}
32+
},
33+
34+
"newStorageAccountName": {
35+
"type": "string",
36+
"metadata": {
37+
"description": "Storage name for the Virtual Machine."
38+
}
39+
},
40+
"vmSize": {
41+
"type": "string",
42+
"defaultValue": "Standard_D1",
43+
"metadata": {
44+
"description": "VM Size"
45+
}
46+
}
47+
},
48+
49+
"variables": {
50+
"windowsOSVersion": "2016-Datacenter",
51+
"imagePublisher": "MicrosoftWindowsServer",
52+
"imageOffer": "WindowsServer",
53+
"OSDiskName": "[concat(parameters('VMName'),'_osdisk')]",
54+
"nicName": "[concat(parameters('VMName'),'_nic')]",
55+
"addressPrefix": "10.0.0.0/16",
56+
"subnetName": "[concat(parameters('VMName'),'_subnet')]",
57+
"subnetPrefix": "10.0.0.0/24",
58+
"networkSecurityGroupName": "[concat(parameters('VMName'),'_nsg')]",
59+
"storageAccountType": "Standard_LRS",
60+
"publicIPAddressName": "[concat(parameters('VMName'),'_pubip')]",
61+
"publicIPAddressType": "Dynamic",
62+
"vmStorageAccountContainerName": "vhds",
63+
"apiVersion": "2015-05-01-preview",
64+
"virtualNetworkName": "[concat(parameters('VMName'),'_vnet')]",
65+
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
66+
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]"
67+
},
68+
"resources": [
69+
70+
{
71+
"type": "Microsoft.Network/networkSecurityGroups",
72+
"name": "[variables('networkSecurityGroupName')]",
73+
"apiVersion": "[variables('apiVersion')]",
74+
"location": "[resourceGroup().location]",
75+
"properties": {
76+
"securityRules": [
77+
{
78+
"name": "HTTP",
79+
"properties": {
80+
"description": "HTTP",
81+
"protocol": "Tcp",
82+
"sourcePortRange": "*",
83+
"destinationPortRange": "80",
84+
"sourceAddressPrefix": "*",
85+
"destinationAddressPrefix": "*",
86+
"access": "Allow",
87+
"priority": 100,
88+
"direction": "Inbound"
89+
}
90+
},
91+
92+
{
93+
"name": "RDP",
94+
"properties": {
95+
"description": "RDP",
96+
"protocol": "Tcp",
97+
"sourcePortRange": "*",
98+
"destinationPortRange": "3389",
99+
"sourceAddressPrefix": "*",
100+
"destinationAddressPrefix": "*",
101+
"access": "Allow",
102+
"priority": 200,
103+
"direction": "Inbound"
104+
}
105+
},
106+
107+
{
108+
"name": "Docker",
109+
"properties": {
110+
"description": "Docker",
111+
"protocol": "Tcp",
112+
"sourcePortRange": "*",
113+
"destinationPortRange": "2375",
114+
"sourceAddressPrefix": "*",
115+
"destinationAddressPrefix": "*",
116+
"access": "Allow",
117+
"priority": 300,
118+
"direction": "Inbound"
119+
}
120+
}
121+
122+
]
123+
}
124+
},
125+
126+
{
127+
"type": "Microsoft.Storage/storageAccounts",
128+
"name": "[parameters('newStorageAccountName')]",
129+
"apiVersion": "[variables('apiVersion')]",
130+
"location": "[resourceGroup().location]",
131+
"tags": {
132+
"displayName": "StorageAccount"
133+
},
134+
"properties": {
135+
"accountType": "[variables('storageAccountType')]"
136+
}
137+
},
138+
139+
{
140+
"apiVersion": "[variables('apiVersion')]",
141+
"type": "Microsoft.Network/publicIPAddresses",
142+
"name": "[variables('publicIPAddressName')]",
143+
"location": "[resourceGroup().location]",
144+
"tags": {
145+
"displayName": "PublicIPAddress"
146+
},
147+
"properties": {
148+
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
149+
"dnsSettings": {
150+
"domainNameLabel": "[tolower(parameters('dnsNameForPublicIP'))]"
151+
}
152+
}
153+
},
154+
155+
{
156+
"apiVersion": "[variables('apiVersion')]",
157+
"type": "Microsoft.Network/virtualNetworks",
158+
"name": "[variables('virtualNetworkName')]",
159+
"location": "[resourceGroup().location]",
160+
"dependsOn": [
161+
"[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]"
162+
],
163+
"tags": {
164+
"displayName": "VirtualNetwork"
165+
},
166+
"properties": {
167+
"addressSpace": {
168+
"addressPrefixes": [
169+
"[variables('addressPrefix')]"
170+
]
171+
},
172+
"subnets": [
173+
{
174+
"name": "[variables('subnetName')]",
175+
"properties": {
176+
"addressPrefix": "[variables('subnetPrefix')]",
177+
"networkSecurityGroup": {
178+
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
179+
}
180+
}
181+
}
182+
]
183+
}
184+
},
185+
186+
{
187+
"apiVersion": "[variables('apiVersion')]",
188+
"type": "Microsoft.Network/networkInterfaces",
189+
"name": "[variables('nicName')]",
190+
"location": "[resourceGroup().location]",
191+
"tags": {
192+
"displayName": "NetworkInterface"
193+
},
194+
"dependsOn": [
195+
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
196+
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
197+
],
198+
"properties": {
199+
"ipConfigurations": [
200+
{
201+
"name": "ipconfig1",
202+
"properties": {
203+
"privateIPAllocationMethod": "Dynamic",
204+
"publicIPAddress": {
205+
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
206+
},
207+
"subnet": {
208+
"id": "[variables('subnetRef')]"
209+
}
210+
}
211+
}
212+
]
213+
}
214+
},
215+
216+
{
217+
"apiVersion": "[variables('apiVersion')]",
218+
"type": "Microsoft.Compute/virtualMachines",
219+
"name": "[parameters('VMName')]",
220+
"location": "[resourceGroup().location]",
221+
"tags": {
222+
"displayName": "VirtualMachine"
223+
},
224+
"dependsOn": [
225+
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
226+
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
227+
],
228+
"properties": {
229+
"hardwareProfile": {
230+
"vmSize": "[parameters('vmSize')]"
231+
},
232+
"osProfile": {
233+
"computername": "[parameters('VMName')]",
234+
"adminUsername": "[parameters('adminUsername')]",
235+
"adminPassword": "[parameters('adminPassword')]"
236+
},
237+
"storageProfile": {
238+
"imageReference": {
239+
"publisher": "[variables('imagePublisher')]",
240+
"offer": "[variables('imageOffer')]",
241+
"sku": "[variables('windowsOSVersion')]",
242+
"version": "latest"
243+
},
244+
"osDisk": {
245+
"name": "osdisk",
246+
"vhd": {
247+
"uri": "[concat(reference(concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName')), variables('apiVersion')).primaryEndpoints.blob, variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]"
248+
},
249+
"caching": "ReadWrite",
250+
"createOption": "FromImage"
251+
}
252+
},
253+
"networkProfile": {
254+
"networkInterfaces": [
255+
{
256+
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
257+
}
258+
]
259+
}
260+
},
261+
"resources": [
262+
{
263+
"name": "containerConfiguration",
264+
"type": "extensions",
265+
"location": "[resourceGroup().location]",
266+
"apiVersion": "2015-06-15",
267+
"dependsOn": [
268+
"[concat('Microsoft.Compute/virtualMachines/', parameters('VMName'))]"
269+
],
270+
"tags": {
271+
"displayName": "containerConfiguration"
272+
},
273+
"properties": {
274+
"publisher": "Microsoft.Compute",
275+
"type": "CustomScriptExtension",
276+
"typeHandlerVersion": "1.2",
277+
"autoUpgradeMinorVersion": true,
278+
"settings": {
279+
"fileUris": [
280+
"https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/windows-server-containers-preview/azure-containers.ps1"
281+
],
282+
"commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File azure-containers.ps1 -adminuser ',parameters('adminUsername'))]"
283+
}
284+
}
285+
}
286+
]
287+
}
288+
]
289+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
REM az group create --name eShopOnAzureDevWin --location westus
2+
az group deployment create --resource-group eShopOnAzureDevWin --parameters @mvparams.json --template-file azuredeploy.json
3+

deploy/az/win-vm/mvparams.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"newStorageAccountName": { "value": "eshopsrvmvstoragewin" },
3+
"adminUsername": { "value": "eshop" },
4+
"adminPassword": { "value": "Pass@word" },
5+
"dnsNameForPublicIP": { "value": "eshop-srv-win" },
6+
"VMName": {"value": "eshop-srv-win"}
7+
}

0 commit comments

Comments
 (0)