Skip to content

Commit

Permalink
Merge pull request Azure#708 from bjoervik/patch-1
Browse files Browse the repository at this point in the history
201-specialized-vm-existing-vnet
  • Loading branch information
Kay Singh committed Oct 15, 2015
2 parents 101b7ce + e0bd839 commit f83ecd9
Show file tree
Hide file tree
Showing 4 changed files with 204 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 201-specialized-vm-in-existing-vnet/README.md
Original file line number Diff line number Diff line change
@@ -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.
153 changes: 153 additions & 0 deletions 201-specialized-vm-in-existing-vnet/azuredeploy.json
Original file line number Diff line number Diff line change
@@ -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'))]"
}
]
}
}
}
]
}
36 changes: 36 additions & 0 deletions 201-specialized-vm-in-existing-vnet/azuredeploy.parameters.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
7 changes: 7 additions & 0 deletions 201-specialized-vm-in-existing-vnet/metadata.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit f83ecd9

Please sign in to comment.