diff --git a/201-specialized-vm-in-existing-vnet/README.md b/201-specialized-vm-in-existing-vnet/README.md new file mode 100644 index 000000000000..a384c6b42929 --- /dev/null +++ b/201-specialized-vm-in-existing-vnet/README.md @@ -0,0 +1,8 @@ +Prerequisites: +- URL to the existing VHD file in ether a premium or standard storage account. +- Name of the existing VNET and subnet you want to connect the new virtual machine to. + - Name of the Resource Group that the VNET resides in. + +This template creates a VM from a specialized VHD and let you connect it to an existing VNET that can reside in another Resource Group then the virtual machine. + +Plese note: This deployment template does not create or attach an existing Network Security Group to the virtual machine. diff --git a/201-specialized-vm-in-existing-vnet/azuredeploy.json b/201-specialized-vm-in-existing-vnet/azuredeploy.json new file mode 100644 index 000000000000..12ce47f8261c --- /dev/null +++ b/201-specialized-vm-in-existing-vnet/azuredeploy.json @@ -0,0 +1,153 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string", + "metadata": { + "description": "Please enter the location where you want to deploy this VM" + } + }, + "vmName": { + "type": "string", + "metadata": { + "description": "Name of the VM" + } + }, + "osType": { + "type": "string", + "allowedValues": [ + "Windows", + "Linux" + ], + "metadata": { + "description": "Type of OS on the existing vhd" + } + }, + "osDiskVhdUri": { + "type": "string", + "metadata": { + "description": "Uri of the existing VHD in ARM standard or premium storage" + } + }, + "vmSize": { + "type": "string", + "metadata": { + "description": "Size of the VM" + } + }, + "existingVirtualNetworkName": { + "type": "string", + "metadata": { + "description": "Name of the existing VNET" + } + }, + "existingVirtualNetworkResourceGroup": { + "type": "string", + "metadata": { + "description": "Name of the existing VNET resource group" + } + }, + "subnetName": { + "type": "string", + "metadata": { + "description": "Name of the subnet in the virtual network you want to use" + } + }, + "dnsNameForPublicIP": { + "type": "string", + "metadata": { + "description": "Unique DNS Name for the Public IP used to access the Virtual Machine." + } + } + + }, + "variables": { + "api-version": "2015-06-15", + "publicIPAddressType": "Dynamic", + "vnetID": "[resourceId(parameters('existingVirtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', parameters('existingVirtualNetworkName'))]", + "subnetRef": "[concat(variables('vnetID'),'/subnets/', parameters('subnetName'))]", + "nicName": "[parameters('vmName')]", + "publicIPAddressName": "[parameters('vmName')]" + }, + "resources": [ + { + "apiVersion": "[variables('api-version')]", + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('publicIPAddressName')]", + "location": "[parameters('location')]", + "tags": { + "displayName": "PublicIPAddress" + }, + "properties": { + "publicIPAllocationMethod": "[variables('publicIPAddressType')]", + "dnsSettings": { + "domainNameLabel": "[parameters('dnsNameForPublicIP')]" + } + } + }, + { + "apiVersion": "[variables('api-version')]", + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]" + ], + "tags": { + "displayName": "NetworkInterface" + }, + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[variables('subnetRef')]" + } + } + } + ] + } + }, + { + "apiVersion": "[variables('api-version')]", + "type": "Microsoft.Compute/virtualMachines", + "name": "[parameters('vmName')]", + "location": "[parameters('location')]", + "tags": { + "displayName": "VirtualMachine" + }, + "dependsOn": [ + "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('vmSize')]" + }, + "storageProfile": { + "osDisk": { + "name": "[concat(parameters('vmName'))]", + "osType": "[parameters('osType')]", + "caching": "ReadWrite", + "vhd": { + "uri": "[parameters('osDiskVhdUri')]" + }, + "createOption": "Attach" + } + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]" + } + ] + } + } + } + ] +} diff --git a/201-specialized-vm-in-existing-vnet/azuredeploy.parameters.json b/201-specialized-vm-in-existing-vnet/azuredeploy.parameters.json new file mode 100644 index 000000000000..b0ef2c9e1f30 --- /dev/null +++ b/201-specialized-vm-in-existing-vnet/azuredeploy.parameters.json @@ -0,0 +1,36 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + + "location": { + "value": "West US" + }, + "dnsNameForPublicIP": { + "value": "youruniquename" + }, + "existingVirtualNetworkName": { + "value": "yourvnet" + }, + "existingVirtualNetworkResourceGroup": { + "value": "VNETresourceGroup" + }, + "subnetName": { + "value": "VNETsubnetName" + }, + + "osDiskVhdUri": { + "value": "customvhdlocation" + }, + "vmName": { + "value": "NameOfVM" + }, + + "osType": { + "value": "Windows" + }, + "vmSize": { + "value": "Standard_DS1" + } + } +} diff --git a/201-specialized-vm-in-existing-vnet/metadata.json b/201-specialized-vm-in-existing-vnet/metadata.json new file mode 100644 index 000000000000..0bcf8166aa11 --- /dev/null +++ b/201-specialized-vm-in-existing-vnet/metadata.json @@ -0,0 +1,7 @@ +{ + "itemDisplayName": "Create a VM from a custom VHD and connect it to an existing VNET", + "description": "This template creates a VM from a specialized VHD and let you connect it to an existing VNET that can reside in another Resource Group then the virtual machine", + "summary": "Create a VM from a specialized VHD and connect it to an existing virtual network", + "githubUsername": "bjoervik", + "dateUpdated": "2015-10-13" +}