From 4b139d1f4a972956c2d34fe3510fdba3f7c364f6 Mon Sep 17 00:00:00 2001 From: Tania Allard Date: Thu, 23 May 2019 11:30:50 +0100 Subject: [PATCH] Tackle PR comments --- docs/howto/providers/azure.rst | 2 + docs/install/azure.rst | 14 +- template | 248 +++++++++++++++++++++++++++++++++ 3 files changed, 252 insertions(+), 12 deletions(-) create mode 100644 template diff --git a/docs/howto/providers/azure.rst b/docs/howto/providers/azure.rst index b3d84a0..e7417b2 100644 --- a/docs/howto/providers/azure.rst +++ b/docs/howto/providers/azure.rst @@ -14,3 +14,5 @@ To do either of this: .. image:: ../../images/providers/azure/delete-vm.png :alt: Delete vm + +.. note:: It is important to mention that even if you stop the machine you will still be charged for the use of the data disk. diff --git a/docs/install/azure.rst b/docs/install/azure.rst index 0734b9b..dea6f4d 100644 --- a/docs/install/azure.rst +++ b/docs/install/azure.rst @@ -14,7 +14,7 @@ Prerequisites * A Microsoft Azure account. -* To get started you can get a free account which includes 150 dollars worth of Azure credits (`get a free account here `_) +* To get started you can get a free account which includes 150 dollars worth of Azure credits (`get a free account here `_) These instructions cover how to set up a Virtual Machine on Microsoft Azure. For subsequent information about creating @@ -72,7 +72,7 @@ We will start by creating the Virtual Machine in which we can run TLJH (The Litt .. image:: ../images/providers/azure/size-vm.png :alt: Choose vm size - * Select a suitable image (to check available images and prices in your region `click on this link `_. + * Select a suitable image (to check available images and prices in your region `click on this link `_. #. Disks (Storage): * **Disk options**: slect the OS disk type there are options for SDD and HDD. **SSD persistent disk** gives you a faster but more expensive @@ -168,13 +168,3 @@ Step 3: Install conda / pip packages for all users ================================================== .. include:: add_packages.txt - -(optional) Delete your virtual machine -======================================= - -* Go to "Virtual Machines" -* Click on your machine name -* Click on "Stop" to stop the machine temporarily, or "Delete" to delete it permanently. - -.. image:: ../images/providers/azure/delete-vm.png - :alt: Delete vm diff --git a/template b/template new file mode 100644 index 0000000..44018e2 --- /dev/null +++ b/template @@ -0,0 +1,248 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string" + }, + "networkInterfaceName": { + "type": "string" + }, + "networkSecurityGroupName": { + "type": "string" + }, + "networkSecurityGroupRules": { + "type": "array" + }, + "subnetName": { + "type": "string" + }, + "virtualNetworkName": { + "type": "string" + }, + "addressPrefixes": { + "type": "array" + }, + "subnets": { + "type": "array" + }, + "publicIpAddressName": { + "type": "string" + }, + "publicIpAddressType": { + "type": "string" + }, + "publicIpAddressSku": { + "type": "string" + }, + "virtualMachineName": { + "type": "string" + }, + "virtualMachineRG": { + "type": "string" + }, + "osDiskType": { + "type": "string" + }, + "dataDisks": { + "type": "array" + }, + "dataDiskResources": { + "type": "array" + }, + "virtualMachineSize": { + "type": "string" + }, + "adminUsername": { + "type": "string" + }, + "adminPassword": { + "type": "secureString" + }, + "customData": { + "type": "string" + }, + "diagnosticsStorageAccountName": { + "type": "string" + }, + "diagnosticsStorageAccountId": { + "type": "string" + }, + "diagnosticsStorageAccountType": { + "type": "string" + }, + "diagnosticsStorageAccountKind": { + "type": "string" + } + }, + "variables": { + "nsgId": "[resourceId(resourceGroup().name, 'Microsoft.Network/networkSecurityGroups', parameters('networkSecurityGroupName'))]", + "vnetId": "[resourceId(resourceGroup().name,'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]", + "subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]" + }, + "resources": [ + { + "name": "[parameters('networkInterfaceName')]", + "type": "Microsoft.Network/networkInterfaces", + "apiVersion": "2018-10-01", + "location": "[parameters('location')]", + "dependsOn": [ + "[concat('Microsoft.Network/networkSecurityGroups/', parameters('networkSecurityGroupName'))]", + "[concat('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]", + "[concat('Microsoft.Network/publicIpAddresses/', parameters('publicIpAddressName'))]" + ], + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "subnet": { + "id": "[variables('subnetRef')]" + }, + "privateIPAllocationMethod": "Dynamic", + "publicIpAddress": { + "id": "[resourceId(resourceGroup().name, 'Microsoft.Network/publicIpAddresses', parameters('publicIpAddressName'))]" + } + } + } + ], + "networkSecurityGroup": { + "id": "[variables('nsgId')]" + } + } + }, + { + "name": "[parameters('networkSecurityGroupName')]", + "type": "Microsoft.Network/networkSecurityGroups", + "apiVersion": "2018-08-01", + "location": "[parameters('location')]", + "properties": { + "securityRules": "[parameters('networkSecurityGroupRules')]" + } + }, + { + "name": "[parameters('virtualNetworkName')]", + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2018-08-01", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": "[parameters('addressPrefixes')]" + }, + "subnets": "[parameters('subnets')]" + } + }, + { + "name": "[parameters('publicIpAddressName')]", + "type": "Microsoft.Network/publicIpAddresses", + "apiVersion": "2018-08-01", + "location": "[parameters('location')]", + "properties": { + "publicIpAllocationMethod": "[parameters('publicIpAddressType')]" + }, + "sku": { + "name": "[parameters('publicIpAddressSku')]" + } + }, + { + "name": "[parameters('dataDiskResources')[copyIndex()].name]", + "type": "Microsoft.Compute/disks", + "apiVersion": "2018-06-01", + "location": "[parameters('location')]", + "properties": { + "diskSizeGB": "[parameters('dataDiskResources')[copyIndex()].diskSizeGB]", + "creationData": "[parameters('dataDiskResources')[copyIndex()].creationData]" + }, + "sku": { + "name": "[parameters('dataDiskResources')[copyIndex()].sku]" + }, + "copy": { + "name": "managedDiskResources", + "count": "[length(parameters('dataDiskResources'))]" + } + }, + { + "name": "[parameters('virtualMachineName')]", + "type": "Microsoft.Compute/virtualMachines", + "apiVersion": "2018-10-01", + "location": "[parameters('location')]", + "dependsOn": [ + "managedDiskResources", + "[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]", + "[concat('Microsoft.Storage/storageAccounts/', parameters('diagnosticsStorageAccountName'))]" + ], + "properties": { + "hardwareProfile": { + "vmSize": "[parameters('virtualMachineSize')]" + }, + "storageProfile": { + "osDisk": { + "createOption": "fromImage", + "managedDisk": { + "storageAccountType": "[parameters('osDiskType')]" + } + }, + "imageReference": { + "publisher": "Canonical", + "offer": "UbuntuServer", + "sku": "18.04-LTS", + "version": "latest" + }, + "copy": [ + { + "name": "dataDisks", + "count": "[length(parameters('dataDisks'))]", + "input": { + "lun": "[parameters('dataDisks')[copyIndex('dataDisks')].lun]", + "createOption": "[parameters('dataDisks')[copyIndex('dataDisks')].createOption]", + "caching": "[parameters('dataDisks')[copyIndex('dataDisks')].caching]", + "writeAcceleratorEnabled": "[parameters('dataDisks')[copyIndex('dataDisks')].writeAcceleratorEnabled]", + "diskSizeGB": "[parameters('dataDisks')[copyIndex('dataDisks')].diskSizeGB]", + "managedDisk": { + "id": "[coalesce(parameters('dataDisks')[copyIndex('dataDisks')].id, if(equals(parameters('dataDisks')[copyIndex('dataDisks')].name, json('null')), json('null'), resourceId('Microsoft.Compute/disks', parameters('dataDisks')[copyIndex('dataDisks')].name)))]", + "storageAccountType": "[parameters('dataDisks')[copyIndex('dataDisks')].storageAccountType]" + } + } + } + ] + }, + "networkProfile": { + "networkInterfaces": [ + { + "id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]" + } + ] + }, + "osProfile": { + "computerName": "[parameters('virtualMachineName')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]", + "customData": "[parameters('customData')]" + }, + "diagnosticsProfile": { + "bootDiagnostics": { + "enabled": true, + "storageUri": "[concat('https://', parameters('diagnosticsStorageAccountName'), '.blob.core.windows.net/')]" + } + } + } + }, + { + "name": "[parameters('diagnosticsStorageAccountName')]", + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-07-01", + "location": "[parameters('location')]", + "properties": {}, + "kind": "[parameters('diagnosticsStorageAccountKind')]", + "sku": { + "name": "[parameters('diagnosticsStorageAccountType')]" + } + } + ], + "outputs": { + "adminUsername": { + "type": "string", + "value": "[parameters('adminUsername')]" + } + } +} \ No newline at end of file