Adding template for Create VM with Empty Disk and Create VM from User Image
This commit is contained in:
Родитель
2c89af990a
Коммит
49965fbc5b
|
@ -0,0 +1,18 @@
|
|||
# Create a Virtual Machine from a Windows Image with Empty Data Disk
|
||||
|
||||
<a href="https://azuredeploy.net/" target="_blank">
|
||||
<img src="http://azuredeploy.net/deploybutton.png"/>
|
||||
</a>
|
||||
|
||||
This template allows creates a Windows VM with empty data disk
|
||||
|
||||
In the parameters file:
|
||||
|
||||
"vmDiagnosticsStorageAccountResourceGroup":{
|
||||
"value" : "diagnosticsResourceGroup"
|
||||
},
|
||||
"vmDiagnosticsStorageAccountName":{
|
||||
"value" : "diagnosticsStorageAccount"
|
||||
},
|
||||
|
||||
the specified diagnostics storage account must be created in the specified diagnostics resource group.
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"newStorageAccountName" : {
|
||||
"value":"uniqueStorageAccountName"
|
||||
},
|
||||
"adminUsername": {
|
||||
"value": ""
|
||||
},
|
||||
"adminPassword": {
|
||||
"value": ""
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"value": "myDNSname"
|
||||
},
|
||||
"vmSourceImageName" : {
|
||||
"value" : "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-Datacenter-201503.01-en.us-127GB.vhd"
|
||||
},
|
||||
"location": {
|
||||
"value": "West US"
|
||||
},
|
||||
"virtualNetworkName": {
|
||||
"value": "myVNET"
|
||||
},
|
||||
"vmSize": {
|
||||
"value": "Standard_A1"
|
||||
},
|
||||
"vmName" : {
|
||||
"value" : "myVM"
|
||||
},
|
||||
"publicIPAddressName" : {
|
||||
"value" : "myPublicIP"
|
||||
},
|
||||
"nicName" : {
|
||||
"value" : "myNic"
|
||||
},
|
||||
"vmExtensionName" : {
|
||||
"value" : "myExtension"
|
||||
},
|
||||
"vmDiagnosticsStorageAccountResourceGroup":{
|
||||
"value" : "diagnosticsResourceGroup"
|
||||
},
|
||||
"vmDiagnosticsStorageAccountName":{
|
||||
"value" : "diagnosticsStorageAccount"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,287 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters" : {
|
||||
"newStorageAccountName": {
|
||||
"type": "string",
|
||||
"defaultValue" : "uniqueStorageAccountName",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the your storage account"
|
||||
}
|
||||
},
|
||||
"dnsNameForPublicIP" : {
|
||||
"type" : "string",
|
||||
"defaultValue": "uniqueDnsNameForPublicIP",
|
||||
"metadata": {
|
||||
"Description": "This is the unique DNS name of the for the public IP for your VM"
|
||||
}
|
||||
},
|
||||
"adminUserName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"Description": "This is the the username you wish to assign to your VMs admin account"
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"Description": "This is the the password you wish to assign to your VMs admin account"
|
||||
}
|
||||
},
|
||||
"imagePublisher": {
|
||||
"type": "string",
|
||||
"defaultValue": "MicrosoftWindowsServer",
|
||||
"metadata": {
|
||||
"Description": "This is the publisher name of the OS image that your VM will host"
|
||||
}
|
||||
},
|
||||
"imageOffer": {
|
||||
"type": "string",
|
||||
"defaultValue": "WindowsServer",
|
||||
"metadata": {
|
||||
"Description": "This is the offer name of the OS image that your VM will host"
|
||||
}
|
||||
},
|
||||
"imageSKU": {
|
||||
"type": "string",
|
||||
"defaultValue": "2012-Datacenter",
|
||||
"metadata": {
|
||||
"Description": "This is the image SKU of the OS image that your VM will host"
|
||||
}
|
||||
},
|
||||
"imageVersion": {
|
||||
"type": "string",
|
||||
"defaultValue": "3.0.201503",
|
||||
"metadata": {
|
||||
"Description": "This is the version of the OS image that your VM will host"
|
||||
}
|
||||
},
|
||||
"location": {
|
||||
"type": "String",
|
||||
"defaultValue" : "West Europe",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the region where you want to deploy your VM"
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_A2",
|
||||
"metadata": {
|
||||
"Description": "This is the size of your VM"
|
||||
}
|
||||
},
|
||||
"publicIPAddressName": {
|
||||
"type": "string",
|
||||
"defaultValue" : "myPublicIP",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the Public IP assigned to your VM"
|
||||
}
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"defaultValue" : "myVM",
|
||||
"metadata": {
|
||||
"Description": "This is the name of your VM"
|
||||
}
|
||||
},
|
||||
"virtualNetworkName":{
|
||||
"type" : "string",
|
||||
"defaultValue" : "myVNET",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the Virtual Network that your VM is a part of"
|
||||
}
|
||||
},
|
||||
"nicName":{
|
||||
"type" : "string",
|
||||
"defaultValue":"myNIC",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the NIC assigned to your VM"
|
||||
}
|
||||
},
|
||||
"vmExtensionName":{
|
||||
"type" : "string",
|
||||
"defaultValue":"myExtension",
|
||||
"metadata": {
|
||||
"Description": "This is the name of your extension"
|
||||
}
|
||||
},
|
||||
"vmDiagnosticsStorageAccountResourceGroup":{
|
||||
"type" : "string",
|
||||
"metadata": {
|
||||
"Description": "This is the resource group name for the storage account that will contain your VMs diagnostic data"
|
||||
}
|
||||
},
|
||||
"vmDiagnosticsStorageAccountName":{
|
||||
"type" : "string",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the storage account that will contain your VMs diagnostic data"
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"addressPrefix":"10.0.0.0/16",
|
||||
"subnet1Name": "Subnet-1",
|
||||
"subnet2Name": "Subnet-2",
|
||||
"subnet1Prefix" : "10.0.0.0/24",
|
||||
"subnet2Prefix" : "10.0.1.0/24",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"publicIPAddressType" : "Dynamic",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"vnetID":"[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]",
|
||||
"subnet1Ref" : "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
|
||||
"dataDisk1VhdName" : "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',parameters('vmName'),'dataDisk1.vhd')]",
|
||||
"accountid": "[concat('/subscriptions/',subscription().subscriptionId,'/resourceGroups/',parameters('vmDiagnosticsStorageAccountResourceGroup'),'/providers/','Microsoft.Storage/storageAccounts/', parameters('vmDiagnosticsStorageAccountName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[parameters('newStorageAccountName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[parameters('publicIPAddressName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[parameters('virtualNetworkName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnet1Name')]",
|
||||
"properties" : {
|
||||
"addressPrefix": "[variables('subnet1Prefix')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "[variables('subnet2Name')]",
|
||||
"properties" : {
|
||||
"addressPrefix": "[variables('subnet2Prefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[parameters('nicName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnet1Ref')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[parameters('vmName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
|
||||
"[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computername": "[parameters('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[parameters('imagePublisher')]",
|
||||
"offer": "[parameters('imageOffer')]",
|
||||
"sku" : "[parameters('imageSKU')]",
|
||||
"version":"[parameters('imageVersion')]"
|
||||
},
|
||||
"dataDisks" : [
|
||||
{
|
||||
"name" : "datadisk1",
|
||||
"diskSizeGB" : "100",
|
||||
"lun" : 0,
|
||||
"vhd":{
|
||||
"Uri" : "[variables('dataDisk1VhdName')]"
|
||||
}
|
||||
}
|
||||
],
|
||||
"osDisk" : {
|
||||
"name": "osdisk1",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',parameters('newStorageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/','osdisk1.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
}
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces" : [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('nicName'))]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||
"name": "[concat(parameters('vmName'),'/', parameters('vmExtensionName'))]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Compute/virtualMachines/', parameters('vmName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"publisher": "Microsoft.Azure.Diagnostics",
|
||||
"type": "IaaSDiagnostics",
|
||||
"typeHandlerVersion": "1.2",
|
||||
"settings": {
|
||||
"xmlCfg":"PFdhZENmZz4NCiAgICAgICAgPERpYWdub3N0aWNNb25pdG9yQ29uZmlndXJhdGlvbiBvdmVyYWxsUXVvdGFJbk1CPSIyNTAwMCI+DQogICAgICAgIDxQZXJmb3JtYW5jZUNvdW50ZXJzIHNjaGVkdWxlZFRyYW5zZmVyUGVyaW9kPSJQVDFNIj4NCiAgICAgICAgICAgIDxQZXJmb3JtYW5jZUNvdW50ZXJDb25maWd1cmF0aW9uIGNvdW50ZXJTcGVjaWZpZXI9IlxQcm9jZXNzb3IoX1RvdGFsKVwlIFByb2Nlc3NvciBUaW1lIiBzYW1wbGVSYXRlPSJQVDFNIiB1bml0PSJwZXJjZW50IiAvPg0KICAgICAgICAgICAgPFBlcmZvcm1hbmNlQ291bnRlckNvbmZpZ3VyYXRpb24gY291bnRlclNwZWNpZmllcj0iXE1lbW9yeVxDb21taXR0ZWQgQnl0ZXMiIHNhbXBsZVJhdGU9IlBUMU0iIHVuaXQ9ImJ5dGVzIi8+DQogICAgICAgICAgICA8L1BlcmZvcm1hbmNlQ291bnRlcnM+DQogICAgICAgICAgICA8RXR3UHJvdmlkZXJzPg0KICAgICAgICAgICAgICAgIDxFdHdFdmVudFNvdXJjZVByb3ZpZGVyQ29uZmlndXJhdGlvbiBwcm92aWRlcj0iU2FtcGxlRXZlbnRTb3VyY2VXcml0ZXIiIHNjaGVkdWxlZFRyYW5zZmVyUGVyaW9kPSJQVDVNIj4NCiAgICAgICAgICAgICAgICAgICAgPEV2ZW50IGlkPSIxIiBldmVudERlc3RpbmF0aW9uPSJFbnVtc1RhYmxlIi8+DQogICAgICAgICAgICAgICAgICAgIDxFdmVudCBpZD0iMiIgZXZlbnREZXN0aW5hdGlvbj0iTWVzc2FnZVRhYmxlIi8+DQogICAgICAgICAgICAgICAgICAgIDxFdmVudCBpZD0iMyIgZXZlbnREZXN0aW5hdGlvbj0iU2V0T3RoZXJUYWJsZSIvPg0KICAgICAgICAgICAgICAgICAgICA8RXZlbnQgaWQ9IjQiIGV2ZW50RGVzdGluYXRpb249IkhpZ2hGcmVxVGFibGUiLz4NCiAgICAgICAgICAgICAgICAgICAgPERlZmF1bHRFdmVudHMgZXZlbnREZXN0aW5hdGlvbj0iRGVmYXVsdFRhYmxlIiAvPg0KICAgICAgICAgICAgICAgIDwvRXR3RXZlbnRTb3VyY2VQcm92aWRlckNvbmZpZ3VyYXRpb24+DQogICAgICAgICAgICA8L0V0d1Byb3ZpZGVycz4NCiAgICAgICAgPC9EaWFnbm9zdGljTW9uaXRvckNvbmZpZ3VyYXRpb24+DQogICAgPC9XYWRDZmc+",
|
||||
"StorageAccount":"[parameters('vmDiagnosticsStorageAccountName')]"
|
||||
},
|
||||
"protectedSettings": {
|
||||
"storageAccountName": "[parameters('vmDiagnosticsStorageAccountName')]",
|
||||
"storageAccountKey": "[listKeys(variables('accountid'),'2015-05-01-preview').key1]",
|
||||
"storageAccountEndPoint": "https://core.windows.net/"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"itemDisplayName": "Create a VM from a Windows Image with Empty Data Disk",
|
||||
"description": "This template allows creates a Windows VM with empty data disk",
|
||||
"summary": "Create a VM from a Windows Image with Empty Data Disk",
|
||||
"githubUsername": "kenazk",
|
||||
"dateUpdated": "2015-04-04"
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
# Create a Virtual Machine from a User Image
|
||||
|
||||
<a href="https://azuredeploy.net/" target="_blank">
|
||||
<img src="http://azuredeploy.net/deploybutton.png"/>
|
||||
</a>
|
||||
|
||||
Prerequisite - The Storage Account with the User Image VHD should already exist in the same resource group.
|
||||
|
||||
This template allows you to create a Virtual Machines from a User image. This template also deploys a Virtual Network, Public IP addresses and a Network Interface.
|
||||
|
||||
Below are the parameters that the template expects
|
||||
|
||||
| Name | Description |
|
||||
|:--- |:---|
|
||||
| userImageStorageAccountName | Name of the Storage Account where the User Image disk is placed. |
|
||||
| userImageStorageContainerName | Name of the Container Name in the Storage Account where the User Image disk is placed. |
|
||||
| userImageVhdName | Name of the User Image VHD file. |
|
||||
| osType | Specify the type of the OS of the User Image (Windows|Linux) |
|
||||
| adminUsername | Username for the Virtual Machines |
|
||||
| adminPassword | Password for the Virtual Machine |
|
||||
| dnsNameForPublicIP | Unique DNS Name for the Public IP used to access the Virtual Machine. |
|
||||
| subscriptionId | Subscription ID where the template will be deployed |
|
||||
| vmSourceImageName | Source Image Name for the VM. Example: b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-12_04_5-LTS-amd64-server-20140927-en-us-30GB |
|
||||
| location | location where the resources will be deployed |
|
||||
| virtualNetworkName | Name of Virtual Network |
|
||||
| vmSize | Size of the Virtual Machine |
|
||||
| vmName | Name of Virtual Machine |
|
||||
| publicIPAddressName | Name of Public IP Address Name |
|
||||
| nicName | Name of Network Interface |
|
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"adminUsername": {
|
||||
"value": "cloudguy"
|
||||
},
|
||||
"adminPassword": {
|
||||
"value": "abc_123!"
|
||||
},
|
||||
"userImageStorageAccountName": {
|
||||
"value" : "clodfed13"
|
||||
},
|
||||
"userImageStorageContainerName" : {
|
||||
"value" : "vhds"
|
||||
},
|
||||
"userImageVhdName" : {
|
||||
"value" : "sample.vhd"
|
||||
},
|
||||
"dnsNameForPublicIP": {
|
||||
"value": "clodfed13"
|
||||
},
|
||||
"osType" : {
|
||||
"value" : "linux"
|
||||
},
|
||||
"subscriptionId": {
|
||||
"value": "87a9cd1c-aa24-446d-b7e0-d73955447c69"
|
||||
},
|
||||
"location": {
|
||||
"value": "West US"
|
||||
},
|
||||
"virtualNetworkName": {
|
||||
"value": "myVNET"
|
||||
},
|
||||
"vmSize": {
|
||||
"value": "Standard_A2"
|
||||
},
|
||||
"vmName" : {
|
||||
"value" : "myVM"
|
||||
},
|
||||
"publicIPAddressName" : {
|
||||
"value" : "myPublicIP"
|
||||
},
|
||||
"nicName" : {
|
||||
"value" : "myNic"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,222 @@
|
|||
{
|
||||
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters" : {
|
||||
"userImageStorageAccountName": {
|
||||
"type": "string",
|
||||
"defaultValue" : "userImageStorageAccountName",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the your storage account"
|
||||
}
|
||||
},
|
||||
"userImageStorageContainerName" : {
|
||||
"type" : "string",
|
||||
"defaultValue" : "userImageStorageContainerName",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the container within the your storage account"
|
||||
}
|
||||
},
|
||||
"userImageVhdName" : {
|
||||
"type" : "string",
|
||||
"defaultValue" : "userImageVhdName",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the your customized VHD"
|
||||
}
|
||||
},
|
||||
"dnsNameForPublicIP" : {
|
||||
"type" : "string",
|
||||
"defaultValue": "uniqueDnsNameForPublicIP",
|
||||
"metadata": {
|
||||
"Description": "This is the unique DNS name of the for the public IP for your VM"
|
||||
}
|
||||
},
|
||||
"adminUserName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"Description": "This is the the username you wish to assign to your VMs admin account"
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"Description": "This is the the password you wish to assign to your VMs admin account"
|
||||
}
|
||||
},
|
||||
"osType" : {
|
||||
"type" : "string",
|
||||
"allowedValues" : [
|
||||
"windows",
|
||||
"linux"
|
||||
],
|
||||
"metadata": {
|
||||
"Description": "This is the OS that your VM will be running"
|
||||
}
|
||||
},
|
||||
"subscriptionId":{
|
||||
"type" : "string",
|
||||
"metadata": {
|
||||
"Description": "This is your Azure Subscription ID"
|
||||
}
|
||||
},
|
||||
"location": {
|
||||
"type": "String",
|
||||
"defaultValue" : "West Europe",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the region where you want to deploy your VM"
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_A2",
|
||||
"metadata": {
|
||||
"Description": "This is the size of your VM"
|
||||
}
|
||||
},
|
||||
"publicIPAddressName": {
|
||||
"type": "string",
|
||||
"defaultValue" : "myPublicIP",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the Public IP assigned to your VM"
|
||||
}
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"defaultValue" : "myVM",
|
||||
"metadata": {
|
||||
"Description": "This is the name of your VM"
|
||||
}
|
||||
},
|
||||
"virtualNetworkName":{
|
||||
"type" : "string",
|
||||
"defaultValue" : "myVNET",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the Virtual Network that your VM is a part of"
|
||||
}
|
||||
},
|
||||
"nicName":{
|
||||
"type" : "string",
|
||||
"defaultValue":"myNIC",
|
||||
"metadata": {
|
||||
"Description": "This is the name of the NIC assigned to your VM"
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"addressPrefix":"10.0.0.0/16",
|
||||
"subnet1Name": "Subnet-1",
|
||||
"subnet2Name": "Subnet-2",
|
||||
"subnet1Prefix" : "10.0.0.0/24",
|
||||
"subnet2Prefix" : "10.0.1.0/24",
|
||||
"publicIPAddressType" : "Dynamic",
|
||||
"vnetID":"[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]",
|
||||
"subnet1Ref" : "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
|
||||
"userImageName" : "[concat('http://',parameters('userImageStorageAccountName'),'.blob.core.windows.net/',parameters('userImageStorageContainerName'),'/',parameters('userImageVhdName'))]",
|
||||
"osDiskVhdName" : "[concat('http://',parameters('userImageStorageAccountName'),'.blob.core.windows.net/',parameters('userImageStorageContainerName'),'/',parameters('vmName'),'osDisk.vhd')]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[parameters('publicIPAddressName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[parameters('virtualNetworkName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnet1Name')]",
|
||||
"properties" : {
|
||||
"addressPrefix": "[variables('subnet1Prefix')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "[variables('subnet2Name')]",
|
||||
"properties" : {
|
||||
"addressPrefix": "[variables('subnet2Prefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[parameters('nicName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', parameters('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',parameters('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnet1Ref')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[parameters('vmName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/networkInterfaces/', parameters('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[parameters('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computername": "[parameters('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"osDisk" : {
|
||||
"name" : "[concat(parameters('vmName'),'-osDisk')]",
|
||||
"osType" : "[parameters('osType')]",
|
||||
"caching" : "ReadWrite",
|
||||
"image" : {
|
||||
"uri" : "[variables('userImageName')]"
|
||||
},
|
||||
"vhd" : {
|
||||
"uri" : "[variables('osDiskVhdName')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces" : [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',parameters('nicName'))]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"itemDisplayName": "Create a Virtual Machine from a User Image",
|
||||
"description": "This template allows you to create a Virtual Machines from a User image. This template also deploys a Virtual Network, Public IP addresses and a Network Interface.",
|
||||
"summary": "Create a Virtual Machine from a User Image",
|
||||
"githubUsername": "mahthi",
|
||||
"dateUpdated": "2015-04-04"
|
||||
}
|
Загрузка…
Ссылка в новой задаче