Skip to content

Instantly share code, notes, and snippets.

@chgeuer
Created February 2, 2018 12:29
Show Gist options
  • Save chgeuer/3c09e325329077e8a9bb0a5b1b8e934e to your computer and use it in GitHub Desktop.
Save chgeuer/3c09e325329077e8a9bb0a5b1b8e934e to your computer and use it in GitHub Desktop.
regional image
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"imageSubscription": { "defaultValue": "4ade7712-3c4e-4ab2-bf30-e7577ac71995", "type": "string" },
"imageResourceGroup": { "defaultValue": "imagesource", "type": "string" },
"imageName": { "defaultValue": "aregionalimage", "type": "string" },
"dnsName": { "defaultValue": "myimagecopy", "type": "string" }
},
"variables": {
"vmName": "myvm",
"adminUserName": "chgeuer",
"adminSshKey": "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAk/ViUPrGp7KoJLuN2PgofgMyw7SN9zfLYFDDR0TRYa8cOvJlE8NdZYt6Oqa4aL/fslKr9bmlMCdawhZRL7sHccIIS0I0zG7iD15rQL3/Y5aZOf3ML+bebpSj+SE5OeHT9iobgsYpK8gq72d8tmZZAfKhx6fRJsgC2j2xXH/GveoZ5GkHnhJUYuYPmNjEb/PK7LT43XuP+E9Rderr3LPUTuBeGVW9do0HS7X8I2uTn0+BqgkZLOO4FCnSXxh1u6fuD++ZgOZVmB6Q1xEdHSA7LLnPkjDZqbWezLIh5cSdNPUW2JG7tMxQTAZzVoNMb6vAVsfslB16rqZQ21EdIq+0pw== chgeuer-dcos-1",
"imageID": "[concat('/subscriptions/', parameters('imageSubscription'), '/resourceGroups/', parameters('imageResourceGroup'), '/providers/Microsoft.Compute/images/', parameters('imageName'))]"
},
"resources": [
{
"type": "Microsoft.Network/virtualNetworks",
"name": "vnet",
"apiVersion": "2017-08-01",
"location": "[resourceGroup().location]",
"dependsOn": [ ],
"tags": { },
"properties": {
"addressSpace": {
"addressPrefixes": [
"10.0.0.0/16"
]
},
"subnets": [
{
"name": "default",
"properties": {
"addressPrefix": "10.0.1.0/24"
}
}
]
}
},
{
"type": "Microsoft.Network/publicIPAddresses",
"name": "publicIP",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "Dynamic",
"dnsSettings": { "domainNameLabel": "[parameters('dnsName')]" }
}
},
{
"type": "Microsoft.Network/networkSecurityGroups",
"name": "nsg",
"apiVersion": "2017-06-01",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [
{
"name": "default-allow-ssh",
"properties": {
"priority": 1000,
"protocol": "Tcp", "access": "Allow",
"direction": "Inbound",
"sourceAddressPrefix": "*", "sourcePortRange": "*",
"destinationAddressPrefix": "*", "destinationPortRange": "22"
}
}
]
}
},
{
"name": "nic",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2016-09-01",
"location": "[resourceGroup().location]",
"dependsOn": [
"[concat('Microsoft.Network/virtualNetworks/', 'vnet')]",
"[concat('Microsoft.Network/publicIpAddresses/', 'publicIP')]",
"[concat('Microsoft.Network/networkSecurityGroups/', 'nsg')]"
],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"subnet": { "id": "[concat(resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', 'vnet'), '/subnets/', 'default')]" },
"publicIpAddress": { "id": "[resourceId(resourceGroup().name,'Microsoft.Network/publicIpAddresses', 'publicIP')]" }
}
}
],
"networkSecurityGroup": { "id": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', 'nsg')]" }
}
},
{
"name": "[variables('vmName')]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2016-04-30-preview",
"location": "[resourceGroup().location]",
"dependsOn": [ "[concat('Microsoft.Network/networkInterfaces/', 'nic')]" ],
"properties": {
"osProfile": {
"computerName": "[variables('vmName')]",
"adminUsername": "[variables('adminUserName')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', variables('adminUserName'), '/.ssh/authorized_keys')]",
"keyData": "[variables('adminSshKey')]"
}
]
}
}
},
"hardwareProfile": { "vmSize": "Standard_D2s_v3" },
"storageProfile": {
"imageReference": { "id": "[variables('imageID')]" },
"osDisk": {
"createOption": "FromImage",
"managedDisk": { "storageAccountType": "Premium_LRS" }
}
},
"networkProfile": { "networkInterfaces": [ { "id": "[resourceId('Microsoft.Network/networkInterfaces', 'nic')]" } ] }
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment