Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@junichia
Created March 29, 2017 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save junichia/c3b1808759af2c91d1130f19adbc7d46 to your computer and use it in GitHub Desktop.
Save junichia/c3b1808759af2c91d1130f19adbc7d46 to your computer and use it in GitHub Desktop.
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminUserName": {
"metadata": {
"description": "Admin User ID"
},
"type": "string"
},
"adminPassword": {
"metadata": {
"description": "Admin Password"
},
"type": "securestring"
},
"CustomerNumber": {
"metadata": {
"description": "Customer Number"
},
"type": "string"
}
},
"variables": {
"StorageAccountName": "[concat('ocms', parameters('CustomerNumber'))]",
"srcOsDiskVhdName": "[concat('http://',variables('StorageAccountName'),'.blob.core.windows.net/vhds/',variables('vmName'),'osDisk-origin.vhd')]",
"osDiskVhdName": "[concat('http://',variables('StorageAccountName'),'.blob.core.windows.net/vhds/',variables('vmName'),'osDisk.vhd')]",
"api-version": "2016-03-30",
"location": "[resourceGroup().location]",
"vmName": "[concat('ocms', parameters('CustomerNumber'))]",
"publicIPAddressType": "Dynamic",
"nicName": "[concat(variables('vmName'),'-nic')]",
"publicIPAddressName": "[concat(variables('vmName'),'-pip')]",
"vmSize": "Standard_D1_v2",
"VNETName": "[concat(variables('vmName'),'-VNET')]",
"VNETPrefix": "10.0.0.0/16",
"SubNetName": "[concat(variables('vmName'),'-SN')]",
"SubNetPrefix": "10.0.0.0/24",
"SubnetRef": "[resourceId('Microsoft.Network/virtualNetworks/subnets', variables('VNETName'), variables('SubNetName'))]",
"domainNameLabel": "[concat('ocms', parameters('CustomerNumber'))]",
"networkSecurityGroupName": "[concat(variables('vmName'),'-sg')]",
"StorageAccountType": "Standard_LRS"
},
"resources": [
{
"apiVersion": "2016-03-30",
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[variables('networkSecurityGroupName')]",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "winrm",
"properties": {
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "5985",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 100,
"direction": "Inbound"
}
},
{
"name": "rdp",
"properties": {
"protocol": "Tcp",
"sourcePortRange": "*",
"destinationPortRange": "3389",
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"access": "Allow",
"priority": 110,
"direction": "Inbound"
}
}
]
},
"resources": [],
"dependsOn": []
},
{
"apiVersion": "2016-03-30",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIPAddressName')]",
"location": "[variables('location')]",
"properties": {
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
"dnsSettings": {
"domainNameLabel": "[variables('domainNameLabel')]"
}
}
},
{
"apiVersion": "2016-03-30",
"type": "Microsoft.Network/virtualNetworks",
"name": "[variables('VNETName')]",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [ "[variables('VNETPrefix')]" ]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnetPrefix')]"
}
}
]
}
},
{
"apiVersion": "2016-03-30",
"type": "Microsoft.Network/networkInterfaces",
"name": "[variables('nicName')]",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
"[resourceId('Microsoft.Network/virtualNetworks/', variables('VNETName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": {
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
},
"subnet": {
"id": "[variables('subnetRef')]"
}
}
}
]
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Compute/virtualMachines",
"name": "[variables('vmName')]",
"location": "[variables('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
],
"tags": {
"displayName": "[variables('VMName')]"
},
"properties": {
"hardwareProfile": { "vmSize": "[variables('vmSize')]" },
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[parameters('adminUsername')]",
"adminPassword": "[parameters('adminPassword')]"
},
"storageProfile": {
"osDisk": {
"name": "[concat(variables('vmName'),'-osDisk')]",
"osType": "Windows",
"caching": "ReadWrite",
"createOption": "FromImage",
"image": {
"uri": "[variables('srcOsDiskVhdName')]"
},
"vhd": {
"uri": "[variables('osDiskVhdName')]"
},
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
}
]
}
},
"resources": [
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment