зеркало из https://github.com/Azure/AzureVM.git
package files
This commit is contained in:
Родитель
a8fd2ff0a4
Коммит
145a033221
|
@ -258,4 +258,7 @@ paket-files/
|
|||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.pyc
|
||||
.Rproj.user
|
||||
|
||||
misc/
|
||||
|
|
|
@ -6,7 +6,7 @@ AlwaysSaveHistory: Default
|
|||
|
||||
EnableCodeIndexing: Yes
|
||||
UseSpacesForTab: Yes
|
||||
NumSpacesForTab: 2
|
||||
NumSpacesForTab: 4
|
||||
Encoding: UTF-8
|
||||
|
||||
RnwWeave: Sweave
|
|
@ -1,16 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>6de3bb1a-b329-4fe9-ab83-68fa617ed20f</ProjectGuid>
|
||||
<ProjectGuid>3a83e24d-1301-4e05-8f0c-c03e51731e02</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
|
||||
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupFile>Script.R</StartupFile>
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties />
|
||||
|
@ -21,5 +18,5 @@
|
|||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\RTVS\Rules\rtvs.rules.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\RTVS\Rules\rtvs.rules.props') And !Exists('$(MSBuildUserExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\RTVS\Rules\rtvs.rules.props')" />
|
||||
<Import Project="$(MSBuildUserExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\RTVS\Targets\Microsoft.R.targets" Condition="Exists('$(MSBuildUserExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\RTVS\Targets\Microsoft.R.targets')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\RTVS\Targets\Microsoft.R.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\RTVS\Targets\Microsoft.R.targets') And !Exists('$(MSBuildUserExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\RTVS\Targets\Microsoft.R.targets')" />
|
||||
<Import Project="rAzureVM.InMemory.Targets" Condition="Exists('rAzureVM.InMemory.Targets')" />
|
||||
<Import Project="AzureVM.InMemory.Targets" Condition="Exists('AzureVM.InMemory.Targets')" />
|
||||
</Project>
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27428.2043
|
||||
VisualStudioVersion = 15.0.27703.2000
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{DA7A21FA-8162-4350-AD77-A8D1B671F3ED}") = "rAzureVM", "rAzureVM.rxproj", "{6DE3BB1A-B329-4FE9-AB83-68FA617ED20F}"
|
||||
Project("{DA7A21FA-8162-4350-AD77-A8D1B671F3ED}") = "AzureVM", "AzureVM.rxproj", "{3A83E24D-1301-4E05-8F0C-C03E51731E02}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -11,15 +11,15 @@ Global
|
|||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6DE3BB1A-B329-4FE9-AB83-68FA617ED20F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6DE3BB1A-B329-4FE9-AB83-68FA617ED20F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6DE3BB1A-B329-4FE9-AB83-68FA617ED20F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6DE3BB1A-B329-4FE9-AB83-68FA617ED20F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3A83E24D-1301-4E05-8F0C-C03E51731E02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3A83E24D-1301-4E05-8F0C-C03E51731E02}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3A83E24D-1301-4E05-8F0C-C03E51731E02}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3A83E24D-1301-4E05-8F0C-C03E51731E02}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {F15580F8-FF27-4BCE-B576-848930340342}
|
||||
SolutionGuid = {14E682DA-3134-49C7-A0E8-A98CCBFAB864}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,18 @@
|
|||
Package: AzureVM
|
||||
Title: Virtual Machines in Azure
|
||||
Version: 0.0.1
|
||||
Authors@R: c(
|
||||
person("Hong", "Ooi", , "hongooi@microsoft.com", role = c("aut", "cre")),
|
||||
person("Microsoft", role="cph")
|
||||
)
|
||||
Description: A package for managing virtual machines in Azure.
|
||||
License: file LICENSE
|
||||
Encoding: UTF-8
|
||||
Depends:
|
||||
R (>= 3.3),
|
||||
Imports:
|
||||
httr (>= 1.3),
|
||||
jsonlite,
|
||||
R6,
|
||||
AzureRMR
|
||||
RoxygenNote: 6.0.1
|
|
@ -0,0 +1,8 @@
|
|||
# Generated by roxygen2: do not edit by hand
|
||||
|
||||
export(az_vm_resource)
|
||||
export(az_vm_template)
|
||||
export(is_raw_vm)
|
||||
export(is_vm)
|
||||
export(list_vm_sizes)
|
||||
import(AzureRMR)
|
|
@ -0,0 +1,80 @@
|
|||
## extend subscription methods
|
||||
AzureRMR::az_subscription$set("public", "list_vm_sizes", function(location, all_info=TRUE)
|
||||
{
|
||||
provider <- "Microsoft.Compute"
|
||||
path <- "locations"
|
||||
api_version <- self$get_provider_api_version(provider, path)
|
||||
|
||||
op <- file.path("providers", provider, path, location, "vmSizes")
|
||||
res <- call_azure_rm(self$token, self$id, op, api_version=api_version)
|
||||
|
||||
if(all_info)
|
||||
do.call(rbind, lapply(res$value, data.frame, stringsAsFactors=FALSE))
|
||||
else lapply(res$value, `[[`, "name")
|
||||
})
|
||||
|
||||
|
||||
AzureRMR::az_subscription$set("public", "create_vm", function(name, location, ..., resource_group=name)
|
||||
{
|
||||
if(is_resource_group(resource_group))
|
||||
{
|
||||
if(missing(location))
|
||||
location <- resource_group$location
|
||||
resource_group <- resource_group$name
|
||||
}
|
||||
|
||||
rgnames <- names(self$list_resource_groups())
|
||||
exclusive_group <- !(resource_group %in% rgnames)
|
||||
if(exclusive_group)
|
||||
{
|
||||
message("Creating resource group '", resource_group, "'")
|
||||
self$create_resource_group(resource_group, location=location)
|
||||
}
|
||||
az_vm_template$new(self$token, self$id, resource_group, name, location, ..., exclusive_group=exclusive_group)
|
||||
})
|
||||
|
||||
|
||||
AzureRMR::az_subscription$set("public", "get_vm", function(name, resource_group=name)
|
||||
{
|
||||
if(!is_resource_group(resource_group))
|
||||
resource_group <- self$get_resource_group(resource_group)
|
||||
|
||||
resource_group$get_vm(name)
|
||||
})
|
||||
|
||||
|
||||
AzureRMR::az_subscription$set("public", "delete_vm", function(name, confirm=TRUE, free_resources=TRUE,
|
||||
resource_group=vm_name)
|
||||
{
|
||||
if(!is_resource_group(resource_group))
|
||||
resource_group <- self$get_resource_group(resource_group)
|
||||
|
||||
resource_group$delete_vm(name, confirm=confirm, free_resources=free_resources)
|
||||
})
|
||||
|
||||
|
||||
##
|
||||
## extend resource group methods
|
||||
AzureRMR::az_resource_group$set("public", "create_vm", function(name, location, ...)
|
||||
{
|
||||
az_vm_template$new(self$token, self$subscription, self$name, name, location, ...)
|
||||
})
|
||||
|
||||
|
||||
AzureRMR::az_resource_group$set("public", "get_vm", function(name)
|
||||
{
|
||||
az_vm_template$new(self$token, self$id, name)
|
||||
})
|
||||
|
||||
|
||||
AzureRMR::az_resource_group$set("public", "delete_vm", function(name, confirm=TRUE, free_resources=TRUE)
|
||||
{
|
||||
self$get_vm(name)$delete(confirm=confirm, free_resources=free_resources)
|
||||
})
|
||||
|
||||
|
||||
#' @export
|
||||
list_vm_sizes <- function(token, subscription, location, all_info=TRUE)
|
||||
{
|
||||
AzureRMR::az_subscription$new(token, subscription)$list_vm_sizes(location, all_info)
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
#' @export
|
||||
az_vm_resource <- R6::R6Class("az_vm", inherit=AzureRMR::az_resource,
|
||||
|
||||
public=list(
|
||||
disks=NULL,
|
||||
status=NULL,
|
||||
|
||||
sync_vm_status=function()
|
||||
{
|
||||
get_status <- function(lst)
|
||||
{
|
||||
status <- lapply(lst, `[[`, "code")
|
||||
names(status) <- sapply(status, function(x) sub("/.*$", "", x))
|
||||
vapply(status, function(x) sub("$[^/]+/", "", x), FUN.VALUE=character(1))
|
||||
}
|
||||
|
||||
res <- self$do_operation(http_verb="GET", "instanceView")
|
||||
self$statuses <- get_status(res$statuses)
|
||||
|
||||
disks <- named_list(res$disks)
|
||||
self$disks <- lapply(disks, function(d) get_status(d$status))
|
||||
|
||||
invisible(NULL)
|
||||
},
|
||||
|
||||
start=function(wait=TRUE)
|
||||
{
|
||||
message("Starting VM '", self$name, "'")
|
||||
self$do_operation(http_verb="POST", "start")
|
||||
if(wait)
|
||||
{
|
||||
for(i in 1:100)
|
||||
{
|
||||
self$sync_vm_status()
|
||||
if(self$status["PowerState"] == "running")
|
||||
break
|
||||
Sys.sleep(5)
|
||||
}
|
||||
if(self$status["PowerState"] != "running")
|
||||
stop("Unable to start VM", call.=FALSE)
|
||||
}
|
||||
},
|
||||
|
||||
stop=function(deallocate=TRUE, wait=FALSE)
|
||||
{
|
||||
msg <- "Shutting down"
|
||||
if(deallocate)
|
||||
msg <- paste(msg, "and deallocating")
|
||||
msg <- paste0(msg, " VM '", self$name, "'")
|
||||
message(msg)
|
||||
|
||||
self$do_operation(http_verb="POST", "powerOff")
|
||||
if(deallocate)
|
||||
self$do_operation(http_verb="POST", "deallocate")
|
||||
if(wait)
|
||||
{
|
||||
for(i in 1:100)
|
||||
{
|
||||
self$sync_vm_status()
|
||||
if(self$status["PowerState"] != "running")
|
||||
break
|
||||
Sys.sleep(5)
|
||||
}
|
||||
if(self$status["PowerState"] == "running")
|
||||
stop("Unable to shut down VM", call.=FALSE)
|
||||
}
|
||||
},
|
||||
|
||||
add_extension=function(...) { },
|
||||
|
||||
run_script=function(...) { }
|
||||
),
|
||||
|
||||
private=list(
|
||||
|
||||
init_and_deploy=function(...)
|
||||
{
|
||||
stop("Do not use 'az_vm_resource' to create a new VM", call.=FALSE)
|
||||
}
|
||||
))
|
||||
|
||||
|
||||
#' @export
|
||||
is_vm <- function(object)
|
||||
{
|
||||
R6::is.R6(object) && inherits(object, "az_raw_vm")
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
#' @export
|
||||
az_vm_template <- R6::R6Class("az_vm_template", inherit=AzureRMR::az_template,
|
||||
|
||||
public=list(
|
||||
disks=NULL,
|
||||
status=NULL,
|
||||
|
||||
initialize=function(token, subscription, resource_group, name=NULL, location, os=c("Windows", "Ubuntu"),
|
||||
size="Standard_DS2_v2", username=NULL, passkey=NULL, userauth_type=c("password", "key"),
|
||||
template, parameters, ..., exclusive_group=FALSE, wait=TRUE)
|
||||
{
|
||||
# if no parameters were supplied, we want to retrieve an existing template
|
||||
if(!(missing(location) && missing(size) && missing(os) &&
|
||||
missing(username) && missing(userauth_type) && missing(passkey)))
|
||||
{
|
||||
os <- match.arg(os)
|
||||
userauth_type <- match.arg(userauth_type)
|
||||
|
||||
if(is_empty(username) || is_empty(passkey))
|
||||
stop("Must supply login username and password/private key", call.=FALSE)
|
||||
|
||||
# find template given input args
|
||||
if(missing(template))
|
||||
template <- get_template(os, userauth_type)
|
||||
|
||||
# convert input args into parameter list for template
|
||||
if(missing(parameters))
|
||||
parameters <- make_param_list(username, userauth_type, passkey, size, template)
|
||||
|
||||
template <- system.file("templates", paste0(template, ".json"), package="AzureVM")
|
||||
}
|
||||
|
||||
super$initialize(token, subscription, resource_group, name, template, parameters, ..., wait=wait)
|
||||
private$vm <- az_vm_resource$new(self$token, self$subscription, self$resource_group,
|
||||
type="Microsoft.Compute/virtualMachines", name=self$name)
|
||||
|
||||
private$exclusive_group <- exclusive_group
|
||||
NULL
|
||||
},
|
||||
|
||||
sync_vm_status=function()
|
||||
{
|
||||
private$vm$sync_vm_status()
|
||||
self$disks <- vm$disks
|
||||
self$status <- vm$status
|
||||
invisible(NULL)
|
||||
},
|
||||
|
||||
start=function(wait=TRUE)
|
||||
{
|
||||
private$vm$start(wait=wait)
|
||||
self$sync_vm_status()
|
||||
},
|
||||
|
||||
stop=function(deallocate=TRUE, wait=TRUE)
|
||||
{
|
||||
private$vm$stop(deallocate=deallocate, wait=wait)
|
||||
self$sync_vm_status()
|
||||
},
|
||||
|
||||
add_extension=function(...)
|
||||
{
|
||||
private$vm$add_extension(...)
|
||||
},
|
||||
|
||||
run_script=function(...)
|
||||
{
|
||||
private$vm$run_script(...)
|
||||
}
|
||||
),
|
||||
|
||||
private=list(
|
||||
exclusive_group=NULL,
|
||||
vm=NULL,
|
||||
|
||||
get_template=function(os, userauth_type)
|
||||
{
|
||||
if(os == "ubuntu")
|
||||
{
|
||||
if(userauth_type == "password")
|
||||
"ubuntu_dsvm"
|
||||
else "ubuntu_dsvm_key"
|
||||
}
|
||||
else "win2016_dsvm"
|
||||
},
|
||||
|
||||
# params for VM templates generally require lists of (value=x) rather than vectors as inputs
|
||||
make_param_list=function(name, username, userauth_type, passkey, size, template)
|
||||
{
|
||||
parm_map <- param_mappings[[template]]
|
||||
# TODO: match by argname, not position
|
||||
params <- lapply(c(username, passkey, name, size), function(x) list(value=x))
|
||||
names(params) <- parm_map
|
||||
params
|
||||
}
|
||||
))
|
||||
|
||||
|
||||
#' @export
|
||||
is_vm <- function(object)
|
||||
{
|
||||
R6::is.R6(object) && inherits(object, "az_vm_template")
|
||||
}
|
||||
|
||||
|
||||
#' @export
|
||||
is_raw_vm <- function(object)
|
||||
{
|
||||
R6::is.R6(object) && inherits(object, "az_vm_resource")
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
param_mappings <- new.env()
|
||||
|
||||
param_mappings$win2016_dsvm <- c(
|
||||
username="adminUsername",
|
||||
passkey="adminPassword",
|
||||
name="vmName",
|
||||
size="vmSize"
|
||||
)
|
||||
|
||||
param_mappings$win2016_dsvm_cl_ext <- c(
|
||||
username="adminUsername",
|
||||
passkey="adminPassword",
|
||||
name="vmName",
|
||||
size="vmSize",
|
||||
nclust="numberOfInstances",
|
||||
file_uris="fileUris",
|
||||
command="commandToExecute"
|
||||
)
|
||||
|
||||
param_mappings$ubuntu_dsvm <- c(
|
||||
username="adminUsername",
|
||||
passkey="adminPassword",
|
||||
name="vmName",
|
||||
size="vmSize"
|
||||
)
|
||||
|
||||
param_mappings$ubuntu_dsvm_key <- c(
|
||||
username="adminUsername",
|
||||
passkey="sshKeyData",
|
||||
name="vmName",
|
||||
size="vmSize"
|
||||
)
|
||||
|
||||
param_mappings$ubuntu_dsvm_ext <- c(
|
||||
username="adminUsername",
|
||||
passkey="adminPassword",
|
||||
name="vmName",
|
||||
size="vmSize",
|
||||
file_uris="fileUris",
|
||||
command="commandToExecute",
|
||||
command_parm="commandParameter"
|
||||
)
|
||||
|
||||
param_mappings$ubuntu_dsvm_cl <- c(
|
||||
username="adminUsername",
|
||||
passkey="adminPassword",
|
||||
name="vmName",
|
||||
size="vmSize",
|
||||
nclust="numberOfInstances"
|
||||
)
|
||||
|
||||
param_mappings$ubuntu_dsvm_cl_ext <- c(
|
||||
username="adminUsername",
|
||||
passkey="adminPassword",
|
||||
name="vmName",
|
||||
size="vmSize",
|
||||
nclust="numberOfInstances",
|
||||
file_uris="fileUris",
|
||||
command="commandToExecute"
|
||||
)
|
|
@ -0,0 +1,2 @@
|
|||
#' @import AzureRMR
|
||||
NULL
|
|
@ -0,0 +1,208 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "Password for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Name Prefix for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_DS3_v2",
|
||||
"allowedValues": [
|
||||
"Basic_A3",
|
||||
"Standard_A2_v2",
|
||||
"Standard_A4_v2",
|
||||
"Standard_A8_v2",
|
||||
"Standard_DS2_v2",
|
||||
"Standard_DS3_v2",
|
||||
"Standard_DS4_v2",
|
||||
"Standard_DS12_v2",
|
||||
"Standard_DS13_v2",
|
||||
"Standard_DS14_v2",
|
||||
"Standard_NC6",
|
||||
"Standard_NC12",
|
||||
"Standard_NC24"
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Size for the Virtual Machine."
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"imagePublisher": "microsoft-ads",
|
||||
"imageOffer": "linux-data-science-vm-ubuntu",
|
||||
"OSDiskName": "osdiskforlinuxsimple",
|
||||
"DataDiskName": "datadiskforlinuxsimple",
|
||||
"sku": "linuxdsvmubuntu",
|
||||
"nicName": "[parameters('vmName')]",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"subnetName": "Subnet",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'lindsvm')]",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"publicIPAddressName": "[parameters('vmName')]",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[parameters('vmName')]",
|
||||
"vmSize": "[parameters('vmSize')]",
|
||||
"virtualNetworkName": "[parameters('vmName')]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[variables('publicIPAddressName')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[variables('nicName')]",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[variables('vmName')]",
|
||||
"location": "[variables('location')]",
|
||||
"plan": {
|
||||
"name": "[variables('sku')]",
|
||||
"product": "[variables('imageOffer')]",
|
||||
"publisher": "[variables('imagePublisher')]"
|
||||
},
|
||||
"tags": {
|
||||
"Application": "DataScience"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[variables('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[variables('imagePublisher')]",
|
||||
"offer": "[variables('imageOffer')]",
|
||||
"sku": "[variables('sku')]",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'), variables('vmName'), '.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"name": "data-0",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('DataDiskName'), variables('vmName'), '.vhd')]"
|
||||
},
|
||||
"createOption": "fromImage",
|
||||
"lun": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"DataScienceVmUrl": { "type": "string", "value": "[concat('https://ms.portal.azure.com/#resource/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachines/', variables('vmName'))]" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,230 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "Password for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"numberOfInstances": {
|
||||
"type": "string",
|
||||
"defaultValue": "1",
|
||||
"metadata": {
|
||||
"description": "Number of VMs to deploy."
|
||||
}
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Name Prefix for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_DS3_v2",
|
||||
"allowedValues": [
|
||||
"Basic_A3",
|
||||
"Standard_A2_v2",
|
||||
"Standard_A4_v2",
|
||||
"Standard_A8_v2",
|
||||
"Standard_DS2_v2",
|
||||
"Standard_DS3_v2",
|
||||
"Standard_DS4_v2",
|
||||
"Standard_DS12_v2",
|
||||
"Standard_DS13_v2",
|
||||
"Standard_DS14_v2",
|
||||
"Standard_NC6",
|
||||
"Standard_NC12",
|
||||
"Standard_NC24",
|
||||
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Size for the Virtual Machine."
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"numberOfInstances": "[int(parameters('numberOfInstances'))]",
|
||||
"imagePublisher": "microsoft-ads",
|
||||
"imageOffer": "linux-data-science-vm-ubuntu",
|
||||
"OSDiskName": "osdiskforlinuxsimple",
|
||||
"DataDiskName": "datadiskforlinuxsimple",
|
||||
"sku": "linuxdsvmubuntu",
|
||||
"nicName": "[parameters('vmName')]",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"subnetName": "Subnet",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'lindsvm')]",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"publicIPAddressName": "[parameters('vmName')]",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[parameters('vmName')]",
|
||||
"vmSize": "[parameters('vmSize')]",
|
||||
"virtualNetworkName": "[parameters('vmName')]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[concat(variables('publicIPAddressName'), copyindex())]",
|
||||
"location": "[variables('location')]",
|
||||
"copy": {
|
||||
"name": "publicIPLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[concat(variables('publicIPAddressName'), copyindex())]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[concat(variables('nicName'), copyindex())]",
|
||||
"location": "[variables('location')]",
|
||||
"copy": {
|
||||
"name": "nicLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', concat(variables('publicIPAddressName'),copyindex()))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('publicIPAddressName'),copyindex()))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[concat(variables('vmName'), copyIndex())]",
|
||||
"location": "[variables('location')]",
|
||||
"copy": {
|
||||
"name": "virtualMachineLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"plan": {
|
||||
"name": "[variables('sku')]",
|
||||
"product": "[variables('imageOffer')]",
|
||||
"publisher": "[variables('imagePublisher')]"
|
||||
},
|
||||
"tags": {
|
||||
"Application": "DataScience"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyindex())]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[concat(variables('vmName'), copyIndex())]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[variables('imagePublisher')]",
|
||||
"offer": "[variables('imageOffer')]",
|
||||
"sku": "[variables('sku')]",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'), variables('vmName'), copyIndex(), '.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"name": "data-0",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('DataDiskName'), variables('vmName'), copyIndex(), '.vhd')]"
|
||||
},
|
||||
"createOption": "fromImage",
|
||||
"lun": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'), copyindex()))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"firstDataScienceVmUrl": { "type": "string", "value": "[concat('https://ms.portal.azure.com/#resource/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachines/', variables('vmName'), '0')]" },
|
||||
"numInstances": { "type": "string", "value": "[parameters('numberOfInstances')]" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,265 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "Password for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"numberOfInstances": {
|
||||
"type": "string",
|
||||
"defaultValue": "1",
|
||||
"metadata": {
|
||||
"description": "Number of VMs to deploy."
|
||||
}
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Name Prefix for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_DS3_v2",
|
||||
"allowedValues": [
|
||||
"Basic_A3",
|
||||
"Standard_A2_v2",
|
||||
"Standard_A4_v2",
|
||||
"Standard_A8_v2",
|
||||
"Standard_DS2_v2",
|
||||
"Standard_DS3_v2",
|
||||
"Standard_DS4_v2",
|
||||
"Standard_DS12_v2",
|
||||
"Standard_DS13_v2",
|
||||
"Standard_DS14_v2",
|
||||
"Standard_NC6",
|
||||
"Standard_NC12",
|
||||
"Standard_NC24"
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Size for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"fileUris": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "URL of the extension package or file"
|
||||
}
|
||||
},
|
||||
"commandToExecute": {
|
||||
"type": "string",
|
||||
"defaultValue": "install.sh",
|
||||
"metadata": {
|
||||
"description": "Extension bash script command to execute"
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"numberOfInstances": "[int(parameters('numberOfInstances'))]",
|
||||
"imagePublisher": "microsoft-ads",
|
||||
"imageOffer": "linux-data-science-vm-ubuntu",
|
||||
"OSDiskName": "osdiskforlinuxsimple",
|
||||
"DataDiskName": "datadiskforlinuxsimple",
|
||||
"sku": "linuxdsvmubuntu",
|
||||
"nicName": "[parameters('vmName')]",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"subnetName": "Subnet",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'lindsvm')]",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"publicIPAddressName": "[parameters('vmName')]",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[parameters('vmName')]",
|
||||
"vmSize": "[parameters('vmSize')]",
|
||||
"virtualNetworkName": "[parameters('vmName')]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"fileUris": "[parameters('fileUris')]",
|
||||
"commandToExecute": "[concat('bash ', parameters('commandToExecute'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[concat(variables('publicIPAddressName'), copyindex())]",
|
||||
"location": "[variables('location')]",
|
||||
"copy": {
|
||||
"name": "publicIPLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[concat(variables('publicIPAddressName'), copyindex())]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[concat(variables('nicName'), copyindex())]",
|
||||
"location": "[variables('location')]",
|
||||
"copy": {
|
||||
"name": "nicLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', concat(variables('publicIPAddressName'),copyindex()))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('publicIPAddressName'),copyindex()))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[concat(variables('vmName'), copyIndex())]",
|
||||
"location": "[variables('location')]",
|
||||
"copy": {
|
||||
"name": "virtualMachineLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"plan": {
|
||||
"name": "[variables('sku')]",
|
||||
"product": "[variables('imageOffer')]",
|
||||
"publisher": "[variables('imagePublisher')]"
|
||||
},
|
||||
"tags": {
|
||||
"Application": "DataScience"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyindex())]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[concat(variables('vmName'), copyIndex())]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[variables('imagePublisher')]",
|
||||
"offer": "[variables('imageOffer')]",
|
||||
"sku": "[variables('sku')]",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'), variables('vmName'), copyIndex(), '.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"name": "data-0",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('DataDiskName'), variables('vmName'), copyIndex(), '.vhd')]"
|
||||
},
|
||||
"createOption": "fromImage",
|
||||
"lun": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'), copyindex()))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "extensions",
|
||||
"name": "[variables('vmName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'),copyindex())]"
|
||||
],
|
||||
"properties": {
|
||||
"publisher": "Microsoft.OSTCExtensions",
|
||||
"type": "CustomScriptForLinux",
|
||||
"typeHandlerVersion": "1.4",
|
||||
"autoUpgradeMinorVersion": true,
|
||||
"settings": {
|
||||
"fileUris": "[split(variables('fileUris'), ' ')]",
|
||||
"commandToExecute": "[variables('commandToExecute')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"firstDataScienceVmUrl": { "type": "string", "value": "[concat('https://ms.portal.azure.com/#resource/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachines/', variables('vmName'), '0')]" },
|
||||
"numInstances": { "type": "string", "value": "[parameters('numberOfInstances')]" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,252 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "Password for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Name Prefix for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_DS3_v2",
|
||||
"allowedValues": [
|
||||
"Basic_A3",
|
||||
"Standard_A2_v2",
|
||||
"Standard_A4_v2",
|
||||
"Standard_A8_v2",
|
||||
"Standard_DS2_v2",
|
||||
"Standard_DS3_v2",
|
||||
"Standard_DS4_v2",
|
||||
"Standard_DS12_v2",
|
||||
"Standard_DS13_v2",
|
||||
"Standard_DS14_v2",
|
||||
"Standard_NC6",
|
||||
"Standard_NC12",
|
||||
"Standard_NC24",
|
||||
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Size for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"fileUris": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "URL of the extension package or file"
|
||||
}
|
||||
},
|
||||
"commandToExecute": {
|
||||
"type": "string",
|
||||
"defaultValue": "install.sh",
|
||||
"metadata": {
|
||||
"description": "Extension bash script command to execute"
|
||||
}
|
||||
},
|
||||
"commandParameter": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Extension bash script command parameter"
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"imagePublisher": "microsoft-ads",
|
||||
"imageOffer": "linux-data-science-vm-ubuntu",
|
||||
"OSDiskName": "osdiskforlinuxsimple",
|
||||
"DataDiskName": "datadiskforlinuxsimple",
|
||||
"sku": "linuxdsvmubuntu",
|
||||
"nicName": "[parameters('vmName')]",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"subnetName": "Subnet",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'lindsvm')]",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"publicIPAddressName": "[parameters('vmName')]",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[parameters('vmName')]",
|
||||
"vmSize": "[parameters('vmSize')]",
|
||||
"virtualNetworkName": "[parameters('vmName')]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"fileUris": "[parameters('fileUris')]",
|
||||
"commandToExecute": "[concat('bash ', parameters('commandToExecute'), ' ', parameters('commandParameter'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[variables('publicIPAddressName')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[variables('nicName')]",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[variables('vmName')]",
|
||||
"location": "[variables('location')]",
|
||||
"plan": {
|
||||
"name": "[variables('sku')]",
|
||||
"product": "[variables('imageOffer')]",
|
||||
"publisher": "[variables('imagePublisher')]"
|
||||
},
|
||||
"tags": {
|
||||
"Application": "DataScience"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[variables('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[variables('imagePublisher')]",
|
||||
"offer": "[variables('imageOffer')]",
|
||||
"sku": "[variables('sku')]",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'), variables('vmName'), '.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"name": "data-0",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('DataDiskName'), variables('vmName'), '.vhd')]"
|
||||
},
|
||||
"createOption": "fromImage",
|
||||
"lun": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "extensions",
|
||||
"name": "[variables('vmName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName')]"
|
||||
],
|
||||
"properties": {
|
||||
"publisher": "Microsoft.OSTCExtensions",
|
||||
"type": "CustomScriptForLinux",
|
||||
"typeHandlerVersion": "1.4",
|
||||
"autoUpgradeMinorVersion": true,
|
||||
"settings": {
|
||||
"fileUris": "[split(variables('fileUris'), ' ')]",
|
||||
"commandToExecute": "[variables('commandToExecute')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"DataScienceVmUrl": { "type": "string", "value": "[concat('https://ms.portal.azure.com/#resource/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachines/', variables('vmName'))]" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"sshKeyData": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "SSH public key data as a string."
|
||||
}
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Name Prefix for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_DS3_v2",
|
||||
"allowedValues": [
|
||||
"Basic_A3",
|
||||
"Standard_A2_v2",
|
||||
"Standard_A4_v2",
|
||||
"Standard_A8_v2",
|
||||
"Standard_DS2_v2",
|
||||
"Standard_DS3_v2",
|
||||
"Standard_DS4_v2",
|
||||
"Standard_DS12_v2",
|
||||
"Standard_DS13_v2",
|
||||
"Standard_DS14_v2",
|
||||
"Standard_NC6",
|
||||
"Standard_NC12",
|
||||
"Standard_NC24",
|
||||
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Size for the Virtual Machine."
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"imagePublisher": "microsoft-ads",
|
||||
"imageOffer": "linux-data-science-vm-ubuntu",
|
||||
"OSDiskName": "osdiskforlinuxsimple",
|
||||
"DataDiskName": "datadiskforlinuxsimple",
|
||||
"sku": "linuxdsvmubuntu",
|
||||
"nicName": "[parameters('vmName')]",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"subnetName": "Subnet",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'lindsvm')]",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"publicIPAddressName": "[parameters('vmName')]",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[parameters('vmName')]",
|
||||
"vmSize": "[parameters('vmSize')]",
|
||||
"virtualNetworkName": "[parameters('vmName')]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[variables('publicIPAddressName')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[variables('nicName')]",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[variables('vmName')]",
|
||||
"location": "[variables('location')]",
|
||||
"plan": {
|
||||
"name": "[variables('sku')]",
|
||||
"product": "[variables('imageOffer')]",
|
||||
"publisher": "[variables('imagePublisher')]"
|
||||
},
|
||||
"tags": {
|
||||
"Application": "DataScience"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[variables('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"linuxConfiguration": {
|
||||
"disablePasswordAuthentication": "true",
|
||||
"ssh": {
|
||||
"publicKeys": [
|
||||
{
|
||||
"path": "[variables('sshKeyPath')]",
|
||||
"keyData": "[parameters('sshKeyData')]"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[variables('imagePublisher')]",
|
||||
"offer": "[variables('imageOffer')]",
|
||||
"sku": "[variables('sku')]",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'), variables('vmName'), '.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
},
|
||||
"dataDisks": [
|
||||
{
|
||||
"name": "data-0",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('DataDiskName'), variables('vmName'), '.vhd')]"
|
||||
},
|
||||
"createOption": "fromImage",
|
||||
"lun": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"DataScienceVmUrl": { "type": "string", "value": "[concat('https://ms.portal.azure.com/#resource/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachines/', variables('vmName'))]" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,194 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "Password for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Name for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_DS3_v2",
|
||||
"allowedValues": [
|
||||
"Basic_A3",
|
||||
"Standard_A2_v2",
|
||||
"Standard_A4_v2",
|
||||
"Standard_A8_v2",
|
||||
"Standard_DS3_v2",
|
||||
"Standard_DS4_v2",
|
||||
"Standard_DS12_v2",
|
||||
"Standard_DS13_v2",
|
||||
"Standard_DS14_v2",
|
||||
"Standard_D4s_v3"
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Size for the Virtual Machine."
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"imagePublisher": "microsoft-ads",
|
||||
"imageOffer": "windows-data-science-vm",
|
||||
"OSDiskName": "osdiskforwindowssimple",
|
||||
"sku": "windows2016",
|
||||
"nicName": "[parameters('vmName')]",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"subnetName": "Subnet",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'windsvm')]",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"publicIPAddressName": "[parameters('vmName')]",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[parameters('vmName')]",
|
||||
"vmSize": "[parameters('vmSize')]",
|
||||
"virtualNetworkName": "[parameters('vmName')]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[variables('publicIPAddressName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[variables('publicIPAddressName')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[variables('nicName')]",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[variables('vmName')]",
|
||||
"location": "[variables('location')]",
|
||||
"plan": {
|
||||
"name": "windows2016",
|
||||
"publisher": "microsoft-ads",
|
||||
"product": "windows-data-science-vm"
|
||||
},
|
||||
"tags": {
|
||||
"Application": "DataScience"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[variables('vmName')]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[variables('imagePublisher')]",
|
||||
"offer": "[variables('imageOffer')]",
|
||||
"sku": "[variables('sku')]",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'), variables('vmName'), '.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
}
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"DataScienceVmUrl": { "type": "string", "value": "[concat('https://ms.portal.azure.com/#resource/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachines/', variables('vmName'))]" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,254 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"adminUsername": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Username for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"adminPassword": {
|
||||
"type": "securestring",
|
||||
"metadata": {
|
||||
"description": "Password for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"numberOfInstances": {
|
||||
"type": "string",
|
||||
"defaultValue": "1",
|
||||
"metadata": {
|
||||
"description": "Number of VMs to deploy."
|
||||
}
|
||||
},
|
||||
"vmName": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "Name Prefix for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"vmSize": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_DS3_v2",
|
||||
"allowedValues": [
|
||||
"Basic_A3",
|
||||
"Standard_A2_v2",
|
||||
"Standard_A4_v2",
|
||||
"Standard_A8_v2",
|
||||
"Standard_DS2_v2",
|
||||
"Standard_DS3_v2",
|
||||
"Standard_DS4_v2",
|
||||
"Standard_DS12_v2",
|
||||
"Standard_DS13_v2",
|
||||
"Standard_DS14_v2",
|
||||
"Standard_NC6",
|
||||
"Standard_NC12",
|
||||
"Standard_NC24"
|
||||
],
|
||||
"metadata": {
|
||||
"description": "Size for the Virtual Machine."
|
||||
}
|
||||
},
|
||||
"fileUris": {
|
||||
"type": "string",
|
||||
"metadata": {
|
||||
"description": "URL of the extension package or file"
|
||||
}
|
||||
},
|
||||
"commandToExecute": {
|
||||
"type": "string",
|
||||
"defaultValue": "install.ps1",
|
||||
"metadata": {
|
||||
"description": "Extension powershell script command to execute"
|
||||
}
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"location": "[resourceGroup().location]",
|
||||
"numberOfInstances": "[int(parameters('numberOfInstances'))]",
|
||||
"imagePublisher": "microsoft-ads",
|
||||
"imageOffer": "windows-data-science-vm",
|
||||
"OSDiskName": "osdisk",
|
||||
"sku": "windows2016",
|
||||
"nicName": "[parameters('vmName')]",
|
||||
"addressPrefix": "10.0.0.0/16",
|
||||
"subnetName": "Subnet",
|
||||
"subnetPrefix": "10.0.0.0/24",
|
||||
"storageAccountType": "Standard_LRS",
|
||||
"storageAccountName": "[concat(uniquestring(resourceGroup().id), 'windsvm')]",
|
||||
"publicIPAddressType": "Dynamic",
|
||||
"publicIPAddressName": "[parameters('vmName')]",
|
||||
"vmStorageAccountContainerName": "vhds",
|
||||
"vmName": "[parameters('vmName')]",
|
||||
"vmSize": "[parameters('vmSize')]",
|
||||
"virtualNetworkName": "[parameters('vmName')]",
|
||||
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||
"fileUris": "[parameters('fileUris')]",
|
||||
"commandToExecute": "[concat('powershell.exe -ExecutionPolicy Unrestricted -File ', parameters('commandToExecute'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"name": "[variables('storageAccountName')]",
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"accountType": "[variables('storageAccountType')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/publicIPAddresses",
|
||||
"name": "[concat(variables('publicIPAddressName'), copyindex())]",
|
||||
"location": "[variables('location')]",
|
||||
"copy": {
|
||||
"name": "publicIPLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"properties": {
|
||||
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||
"dnsSettings": {
|
||||
"domainNameLabel": "[concat(variables('publicIPAddressName'), copyindex())]"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/virtualNetworks",
|
||||
"name": "[variables('virtualNetworkName')]",
|
||||
"location": "[variables('location')]",
|
||||
"properties": {
|
||||
"addressSpace": {
|
||||
"addressPrefixes": [
|
||||
"[variables('addressPrefix')]"
|
||||
]
|
||||
},
|
||||
"subnets": [
|
||||
{
|
||||
"name": "[variables('subnetName')]",
|
||||
"properties": {
|
||||
"addressPrefix": "[variables('subnetPrefix')]"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-05-01-preview",
|
||||
"type": "Microsoft.Network/networkInterfaces",
|
||||
"name": "[concat(variables('nicName'), copyindex())]",
|
||||
"location": "[variables('location')]",
|
||||
"copy": {
|
||||
"name": "nicLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Network/publicIPAddresses/', concat(variables('publicIPAddressName'),copyindex()))]",
|
||||
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||
],
|
||||
"properties": {
|
||||
"ipConfigurations": [
|
||||
{
|
||||
"name": "ipconfig1",
|
||||
"properties": {
|
||||
"privateIPAllocationMethod": "Dynamic",
|
||||
"publicIPAddress": {
|
||||
"id": "[resourceId('Microsoft.Network/publicIPAddresses',concat(variables('publicIPAddressName'),copyindex()))]"
|
||||
},
|
||||
"subnet": {
|
||||
"id": "[variables('subnetRef')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"apiVersion": "2015-06-15",
|
||||
"type": "Microsoft.Compute/virtualMachines",
|
||||
"name": "[concat(variables('vmName'), copyIndex())]",
|
||||
"location": "[variables('location')]",
|
||||
"copy": {
|
||||
"name": "virtualMachineLoop",
|
||||
"count": "[variables('numberOfInstances')]"
|
||||
},
|
||||
"plan": {
|
||||
"name": "[variables('sku')]",
|
||||
"product": "[variables('imageOffer')]",
|
||||
"publisher": "[variables('imagePublisher')]"
|
||||
},
|
||||
"tags": {
|
||||
"Application": "DataScience"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
||||
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyindex())]"
|
||||
],
|
||||
"properties": {
|
||||
"hardwareProfile": {
|
||||
"vmSize": "[variables('vmSize')]"
|
||||
},
|
||||
"osProfile": {
|
||||
"computerName": "[concat(variables('vmName'), copyIndex())]",
|
||||
"adminUsername": "[parameters('adminUsername')]",
|
||||
"adminPassword": "[parameters('adminPassword')]"
|
||||
},
|
||||
"storageProfile": {
|
||||
"imageReference": {
|
||||
"publisher": "[variables('imagePublisher')]",
|
||||
"offer": "[variables('imageOffer')]",
|
||||
"sku": "[variables('sku')]",
|
||||
"version": "latest"
|
||||
},
|
||||
"osDisk": {
|
||||
"name": "osdisk",
|
||||
"vhd": {
|
||||
"uri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'), variables('vmName'), copyIndex(), '.vhd')]"
|
||||
},
|
||||
"caching": "ReadWrite",
|
||||
"createOption": "FromImage"
|
||||
}
|
||||
},
|
||||
"networkProfile": {
|
||||
"networkInterfaces": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/networkInterfaces',concat(variables('nicName'), copyindex()))]"
|
||||
}
|
||||
]
|
||||
},
|
||||
"diagnosticsProfile": {
|
||||
"bootDiagnostics": {
|
||||
"enabled": "true",
|
||||
"storageUri": "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net')]"
|
||||
}
|
||||
}
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"type": "extensions",
|
||||
"name": "[variables('vmName')]",
|
||||
"apiVersion": "2015-06-15",
|
||||
"location": "[variables('location')]",
|
||||
"dependsOn": [
|
||||
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'),copyindex())]"
|
||||
],
|
||||
"properties": {
|
||||
"publisher": "Microsoft.Compute",
|
||||
"type": "CustomScriptExtension",
|
||||
"typeHandlerVersion": "1.8",
|
||||
"autoUpgradeMinorVersion": true,
|
||||
"settings": {
|
||||
"fileUris": "[split(variables('fileUris'), ' ')]",
|
||||
"commandToExecute": "[variables('commandToExecute')]"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
"firstDataScienceVmUrl": { "type": "string", "value": "[concat('https://ms.portal.azure.com/#resource/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Compute/virtualMachines/', variables('vmName'), '0')]" },
|
||||
"numInstances": { "type": "string", "value": "[parameters('numberOfInstances')]" }
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче