зеркало из
1
0
Форкнуть 0
This commit is contained in:
Andrew Oakley 2016-08-16 14:44:08 -07:00
Коммит a5df61cea4
127 изменённых файлов: 7972 добавлений и 0 удалений

66
.gitattributes поставляемый Normal file
Просмотреть файл

@ -0,0 +1,66 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
# Keep shell scripts with LF
*.sh text eol=lf
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

212
.gitignore поставляемый Normal file
Просмотреть файл

@ -0,0 +1,212 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

123
Deployment.targets Normal file
Просмотреть файл

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputPath>bin\$(Configuration)\</OutputPath>
<DebugSymbols>false</DebugSymbols>
<SkipCopyBuildProduct>true</SkipCopyBuildProduct>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
<TargetRuntime>None</TargetRuntime>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">obj\</BaseIntermediateOutputPath>
<BaseIntermediateOutputPath Condition=" !HasTrailingSlash('$(BaseIntermediateOutputPath)') ">$(BaseIntermediateOutputPath)\</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)$(Configuration)\</IntermediateOutputPath>
<ProjectReferencesOutputPath Condition=" '$(ProjectReferencesOutputPath)' == '' ">$(IntermediateOutputPath)ProjectReferences</ProjectReferencesOutputPath>
<ProjectReferencesOutputPath Condition=" !HasTrailingSlash('$(ProjectReferencesOutputPath)') ">$(ProjectReferencesOutputPath)\</ProjectReferencesOutputPath>
<StageArtifacts Condition=" '$(StageArtifacts)' == '' ">true</StageArtifacts>
</PropertyGroup>
<PropertyGroup>
<DefineCommonItemSchemas>false</DefineCommonItemSchemas>
<DefineCommonCapabilities>false</DefineCommonCapabilities>
</PropertyGroup>
<ProjectExtensions>
<ProjectCapabilities>
<DeploymentProject />
</ProjectCapabilities>
</ProjectExtensions>
<ItemDefinitionGroup>
<Content>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<ProjectReference>
<Private>false</Private>
<Targets>Build</Targets>
</ProjectReference>
</ItemDefinitionGroup>
<Target Name="CreateManifestResourceNames" />
<PropertyGroup>
<StageArtifactsDependsOn>
_GetDeploymentProjectContent;
_CalculateContentOutputRelativePaths;
_GetReferencedProjectsOutput;
_CalculateArtifactStagingDirectory;
_CopyOutputToArtifactStagingDirectory;
</StageArtifactsDependsOn>
</PropertyGroup>
<Target Name="_CopyOutputToArtifactStagingDirectory">
<Copy SourceFiles="@(DeploymentProjectContentOutput)" DestinationFiles="$(ArtifactStagingDirectory)\$(MSBuildProjectName)%(RelativePath)" />
<Copy SourceFiles="@(BuildProjectReferencesOutput)" DestinationFiles="$(ArtifactStagingDirectory)%(ProjectName)\%(RecursiveDir)%(FileName)%(Extension)" />
</Target>
<Target Name="_GetDeploymentProjectContent">
<MSBuild Projects="$(MSBuildProjectFile)" Targets="ContentFilesProjectOutputGroup">
<Output TaskParameter="TargetOutputs" ItemName="DeploymentProjectContentOutput" />
</MSBuild>
</Target>
<Target Name="_GetReferencedProjectsOutput">
<PropertyGroup>
<MsBuildProperties>Configuration=$(Configuration);Platform=$(Platform)</MsBuildProperties>
</PropertyGroup>
<MSBuild Projects="@(ProjectReference)"
BuildInParallel="$(BuildInParallel)"
Properties="$(MsBuildProperties)"
Targets="%(ProjectReference.Targets)" />
<ItemGroup>
<BuildProjectReferencesOutput Include="%(ProjectReference.IncludeFilePath)">
<ProjectName>$([System.IO.Path]::GetFileNameWithoutExtension('%(ProjectReference.Identity)'))</ProjectName>
</BuildProjectReferencesOutput>
</ItemGroup>
</Target>
<Target Name="_CalculateArtifactStagingDirectory" Condition=" '$(ArtifactStagingDirectory)'=='' ">
<PropertyGroup>
<ArtifactStagingDirectory Condition=" '$(OutDir)'!='' ">$(OutDir)</ArtifactStagingDirectory>
<ArtifactStagingDirectory Condition=" '$(ArtifactStagingDirectory)'=='' ">$(OutputPath)</ArtifactStagingDirectory>
<ArtifactStagingDirectory Condition=" !HasTrailingSlash('$(ArtifactStagingDirectory)') ">$(ArtifactStagingDirectory)\</ArtifactStagingDirectory>
<ArtifactStagingDirectory>$(ArtifactStagingDirectory)staging\</ArtifactStagingDirectory>
<ArtifactStagingDirectory Condition=" '$(TF_Build)' == 'True' ">$(Build_StagingDirectory)</ArtifactStagingDirectory>
</PropertyGroup>
</Target>
<!-- Appends each of the deployment project's content output files with metadata indicating its relative path from the deployment project's folder. -->
<Target Name="_CalculateContentOutputRelativePaths"
Outputs="%(DeploymentProjectContentOutput.Identity)">
<PropertyGroup>
<_OriginalIdentity>%(DeploymentProjectContentOutput.Identity)</_OriginalIdentity>
<_RelativePath>$(_OriginalIdentity.Replace('$(MSBuildProjectDirectory)', ''))</_RelativePath>
</PropertyGroup>
<ItemGroup>
<DeploymentProjectContentOutput>
<RelativePath>$(_RelativePath)</RelativePath>
</DeploymentProjectContentOutput>
</ItemGroup>
</Target>
<Target Name="CoreCompile" />
<PropertyGroup>
<StageArtifactsAfterTargets Condition=" '$(StageArtifacts)' == 'true' ">
PrepareForRun
</StageArtifactsAfterTargets>
</PropertyGroup>
<Target Name="StageArtifacts" DependsOnTargets="$(StageArtifactsDependsOn)" AfterTargets="$(StageArtifactsAfterTargets)"/>
<!-- Custom target to clean up local deployment staging files -->
<Target Name="DeleteBinObjFolders" BeforeTargets="Clean">
<RemoveDir Directories="$(OutputPath)" />
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
</Target>
</Project>

Просмотреть файл

@ -0,0 +1,27 @@
#!/bin/bash
usage(){
echo "Invalid option: -$OPTARG"
echo "Usage: deploy-template-with-param -n [Resource group name]"
echo " -l [Resource group location]"
echo " -t [Template file]"
echo " -p [Template parameters file]"
exit 1
}
while getopts ":n:l:f:e:c:" opt; do
case $opt in
n)GROUP_NAME=$OPTARG;;
l)LOCATION=$OPTARG;;
f)TEMPLATE=$OPTARG;;
e)PARAMETERS=$OPTARG;;
*)usage;;
esac
done
cat $PARAMETERS | tr '\n' ' ' | sed "s/\"customData[^{]*{[^}]*}/$(sed 's:/:\\/:g' updatepattern.txt)/" > parms.json
azure config mode arm
azure group create -n "$GROUP_NAME" -l "$LOCATION" -f $TEMPLATE -e ./parms.json -v
rm parms.json

Просмотреть файл

@ -0,0 +1,67 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"templateFileUri": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Template file to deploy."
}
},
"templateParamUri": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Template parameters file to deploy alowgwith the template."
}
}
},
"variables": {
"templateParts": "[split(parameters('templateParamUri'),'/')]",
"templateDescription": "[variables('templateParts')[sub(length(variables('templateParts')), 1)]]",
"collectorTemplate": "[uri(deployment().properties.templateLink.uri, '../../Templates/resources/common/collector.json')]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2016-02-01",
"name": "[concat('deploy-', variables('templateDescription'))]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[parameters('templateFileUri')]",
"contentVersion": "1.0.0.0"
},
"parametersLink": {
"uri": "[parameters('templateParamUri')]",
"contentVersion": "1.0.0.0"
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2016-02-01",
"name": "[concat('output-', variables('templateDescription'))]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('collectorTemplate')]",
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "output"
}
},
"source": { "value": "[reference(concat('deploy-', variables('templateDescription'))).outputResources]" },
"context": { "value": { } },
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'output-mapper.json')]" }
}
}
}
],
"outputs": {
}
}

Просмотреть файл

@ -0,0 +1,44 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"templateFileUri": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Template file to deploy."
}
},
"templateParamUri": {
"type": "string",
"minLength": 1,
"metadata": {
"description": "Template parameters file to deploy alowgwith the template."
}
}
},
"variables": {
"templateParts": "[split(parameters('templateParamUri'),'/')]",
"templateDescription": "[variables('templateParts')[sub(length(variables('templateParts')), 1)]]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2016-02-01",
"name": "[concat('deploy-', variables('templateDescription'))]",
"properties": {
"mode": "Complete",
"templateLink": {
"uri": "[parameters('templateFileUri')]",
"contentVersion": "1.0.0.0"
},
"parametersLink": {
"uri": "[parameters('templateParamUri')]",
"contentVersion": "1.0.0.0"
}
}
}
],
"outputs": {
}
}

Просмотреть файл

@ -0,0 +1,8 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"templateFileUri": { "value": "https://pnparmtest.blob.core.windows.net/rohittest/ARMBuildingBlocks/Templates/buildingBlocks/multi-vm-n-nic-m-storage/azuredeploy.json" },
"templateParamUri": { "value": "https://pnparmtest.blob.core.windows.net/rohittest/ARMBuildingBlocks/Templates/buildingBlocks/multi-vm-n-nic-m-storage/azuredeploy.parameters.json" }
}
}

Просмотреть файл

@ -0,0 +1,79 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"referenceTemplate": "[uri(deployment().properties.templateLink.uri, '../../Templates/resources/common/reference.json')]",
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"idParts": "[split(parameters('source').id, '/')]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-resRef', parameters('iteration'), '-', variables('templateUniqueString'))]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('referenceTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString') , '-resRef', parameters('iteration'))]"
}
},
"resourceType": {
"value": "[concat(variables('idParts')[0], '/', variables('idParts')[1])]"
},
"resourceName1": {
"value": "[variables('idParts')[2]]"
}
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-output', parameters('iteration'), '-', variables('templateUniqueString'))]",
"properties": {
"mode": "Incremental",
"parameters": { },
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"variables": { },
"resources": [ ],
"outputs": {
"instance": {
"type": "array",
"value": [
"[reference(concat(parameters('deploymentContext').parentTemplateUniqueString, '-resRef', parameters('iteration'), '-', variables('templateUniqueString'))).outputs.reference.value]"
]
}
}
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), reference(concat(parameters('deploymentContext').parentTemplateUniqueString, '-output', parameters('iteration'), '-', variables('templateUniqueString'))).outputs.instance.value)]"
}
}
}

Просмотреть файл

@ -0,0 +1,40 @@
param(
[parameter(Mandatory=$true)]$SubscriptionName,
[parameter(Mandatory=$true)]$ResourceGroupName,
[parameter(Mandatory=$true)]$Location,
[parameter(Mandatory=$true)]$DeploymentName,
[parameter(Mandatory=$true)]$TemplateUri,
[parameter(Mandatory=$true)]$TemplateParametersUri
)
# Login to Azure and select your subscription
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName $SubscriptionName | Out-Null
################################################################################################################
# Make sure that the following parameters match the ones in the template if you're using existing infrastructure
#$ResourceGroupName='myapp-rg'
#$DeploymentName='myapp-rg-dep'
#$Location='West US'
$resourceGroup = Get-AzureRmResourceGroup -Name $ResourceGroupName -Location $Location | Out-Null
if ($resourceGroup -eq $null) {
# We need to create the resource group
$resourceGroup = New-AzureRmResourceGroup -Name $ResourceGroupName -Location $Location
}
# Template and parameters file URIs
#$TemplateUri = 'https://raw.githubusercontent.com/mspnp/blueprints/kirpas/buildingblocks/ARMBuildingBlocks/ARMBuildingBlocks/Templates/buildingBlocks/vnet-n-subnet/azuredeploy.json'
#$templateParamUri='https://raw.githubusercontent.com/mspnp/blueprints/kirpas/buildingblocks/ARMBuildingBlocks/ARMBuildingBlocks/Templates/buildingBlocks/vnet-n-subnet/scenarios/azuredeploy.parameters.json'
$result = Test-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroup.ResourceGroupName -TemplateUri $TemplateUri -TemplateParameterUri $TemplateParametersUri
# Test-AzureRmResourceGroupDeployment returns a list of PSResourceManagerError objects, so a count of 0 is all clear signal!
if ($result.Count -eq 0) {
New-AzureRmResourceGroupDeployment -Name $DeploymentName -ResourceGroupName $resourceGroup.ResourceGroupName -TemplateUri $TemplateUri -TemplateParameterUri $TemplateParametersUri
}
else{
$($result)
}

Просмотреть файл

@ -0,0 +1,30 @@
#
# Deploys a vnet and subnets in a resource group creating a 3 tier IaaS architecture
#
# Login to Azure and select your subscription
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionName 'Pnp Networking'
################################################################################################################
# Make sure that the following parameters match the ones in the template if you're using existing infrastructure
$resourceGroupName='myapp-rg'
$deploymentName='myapp-rg-dep'
$location='West US'
# Create new resource group
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
# Template and parameters file URIs
$templateUri = 'https://raw.githubusercontent.com/mspnp/blueprints/kirpas/buildingblocks/ARMBuildingBlocks/ARMBuildingBlocks/Templates/buildingBlocks/vnet-n-subnet/azuredeploy.json'
$templateParamUri='https://raw.githubusercontent.com/mspnp/blueprints/kirpas/buildingblocks/ARMBuildingBlocks/ARMBuildingBlocks/Templates/buildingBlocks/vnet-n-subnet/scenarios/azuredeploy.parameters.json'
$result = Test-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateUri -TemplateParameterUri $templateParamUri
# Test-AzureRmResourceGroupDeployment returns a list of PSResourceManagerError objects, so a count of 0 is all clear signal!
if($result.Count -eq 0){
New-AzureRmResourceGroupDeployment -Name $deploymentName -ResourceGroupName $resourceGroupName -TemplateUri $templateUri -TemplateParameterUri $templateParamUri -Verbose
}else{
$result
}

Просмотреть файл

@ -0,0 +1,103 @@
#Requires -Version 3.0
#Requires -Module AzureRM.Resources
#Requires -Module Azure.Storage
Param(
[string] [Parameter(Mandatory=$true)] $ResourceGroupLocation,
[string] $ResourceGroupName = 'ARMBuildingBlocks',
[switch] $UploadArtifacts,
[string] $StorageAccountName,
[string] $StorageAccountResourceGroupName,
[string] $StorageContainerName = $ResourceGroupName.ToLowerInvariant() + '-stageartifacts',
[string] $TemplateFile = '..\Templates\azuredeploy.json',
[string] $TemplateParametersFile = '..\Templates\azuredeploy.parameters.json',
[string] $ArtifactStagingDirectory = '..\bin\Debug\staging',
[string] $AzCopyPath = '..\Tools\AzCopy.exe',
[string] $DSCSourceFolder = '..\DSC'
)
Import-Module Azure -ErrorAction SilentlyContinue
try {
[Microsoft.Azure.Common.Authentication.AzureSession]::ClientFactory.AddUserAgent("VSAzureTools-$UI$($host.name)".replace(" ","_"), "2.8")
} catch { }
Set-StrictMode -Version 3
$OptionalParameters = New-Object -TypeName Hashtable
$TemplateFile = [System.IO.Path]::Combine($PSScriptRoot, $TemplateFile)
$TemplateParametersFile = [System.IO.Path]::Combine($PSScriptRoot, $TemplateParametersFile)
if ($UploadArtifacts) {
# Convert relative paths to absolute paths if needed
$AzCopyPath = [System.IO.Path]::Combine($PSScriptRoot, $AzCopyPath)
$ArtifactStagingDirectory = [System.IO.Path]::Combine($PSScriptRoot, $ArtifactStagingDirectory)
$DSCSourceFolder = [System.IO.Path]::Combine($PSScriptRoot, $DSCSourceFolder)
Set-Variable ArtifactsLocationName '_artifactsLocation' -Option ReadOnly -Force
Set-Variable ArtifactsLocationSasTokenName '_artifactsLocationSasToken' -Option ReadOnly -Force
$OptionalParameters.Add($ArtifactsLocationName, $null)
$OptionalParameters.Add($ArtifactsLocationSasTokenName, $null)
# Parse the parameter file and update the values of artifacts location and artifacts location SAS token if they are present
$JsonContent = Get-Content $TemplateParametersFile -Raw | ConvertFrom-Json
$JsonParameters = $JsonContent | Get-Member -Type NoteProperty | Where-Object {$_.Name -eq "parameters"}
if ($JsonParameters -eq $null) {
$JsonParameters = $JsonContent
}
else {
$JsonParameters = $JsonContent.parameters
}
$JsonParameters | Get-Member -Type NoteProperty | ForEach-Object {
$ParameterValue = $JsonParameters | Select-Object -ExpandProperty $_.Name
if ($_.Name -eq $ArtifactsLocationName -or $_.Name -eq $ArtifactsLocationSasTokenName) {
$OptionalParameters[$_.Name] = $ParameterValue.value
}
}
$StorageAccountKey = (Get-AzureRmStorageAccountKey -ResourceGroupName $StorageAccountResourceGroupName -Name $StorageAccountName).Key1
$StorageAccountContext = (Get-AzureRmStorageAccount -ResourceGroupName $StorageAccountResourceGroupName -Name $StorageAccountName).Context
# Create DSC configuration archive
if (Test-Path $DSCSourceFolder) {
Add-Type -Assembly System.IO.Compression.FileSystem
$ArchiveFile = Join-Path $ArtifactStagingDirectory "dsc.zip"
Remove-Item -Path $ArchiveFile -ErrorAction SilentlyContinue
[System.IO.Compression.ZipFile]::CreateFromDirectory($DSCSourceFolder, $ArchiveFile)
}
# Generate the value for artifacts location if it is not provided in the parameter file
$ArtifactsLocation = $OptionalParameters[$ArtifactsLocationName]
if ($ArtifactsLocation -eq $null) {
$ArtifactsLocation = $StorageAccountContext.BlobEndPoint + $StorageContainerName
$OptionalParameters[$ArtifactsLocationName] = $ArtifactsLocation
}
# Use AzCopy to copy files from the local storage drop path to the storage account container
& $AzCopyPath """$ArtifactStagingDirectory""", $ArtifactsLocation, "/DestKey:$StorageAccountKey", "/S", "/Y", "/Z:$env:LocalAppData\Microsoft\Azure\AzCopy\$ResourceGroupName"
if ($LASTEXITCODE -ne 0) { return }
# Generate the value for artifacts location SAS token if it is not provided in the parameter file
$ArtifactsLocationSasToken = $OptionalParameters[$ArtifactsLocationSasTokenName]
if ($ArtifactsLocationSasToken -eq $null) {
# Create a SAS token for the storage container - this gives temporary read-only access to the container
$ArtifactsLocationSasToken = New-AzureStorageContainerSASToken -Container $StorageContainerName -Context $StorageAccountContext -Permission r -ExpiryTime (Get-Date).AddHours(4)
$ArtifactsLocationSasToken = ConvertTo-SecureString $ArtifactsLocationSasToken -AsPlainText -Force
$OptionalParameters[$ArtifactsLocationSasTokenName] = $ArtifactsLocationSasToken
}
}
# Create or update the resource group using the specified template file and template parameters file
New-AzureRmResourceGroup -Name $ResourceGroupName -Location $ResourceGroupLocation -Verbose -Force -ErrorAction Stop
New-AzureRmResourceGroupDeployment -Name ((Get-ChildItem $TemplateFile).BaseName + '-' + ((Get-Date).ToUniversalTime()).ToString('MMdd-HHmm')) `
-ResourceGroupName $ResourceGroupName `
-TemplateFile $TemplateFile `
-TemplateParameterFile $TemplateParametersFile `
@OptionalParameters `
-Force -Verbose

11
scripts/apache.sh Normal file
Просмотреть файл

@ -0,0 +1,11 @@
#!/bin/bash
apt-get -y update
# install Apache2
apt-get -y install apache2
# write some HTML
echo \<center\>\<h1\>My Demo App\</h1\>\<br/\>\</center\> > /var/www/html/demo.html
# restart Apache
apachectl restart

23
scripts/iisaspnet.ps1 Normal file
Просмотреть файл

@ -0,0 +1,23 @@
Configuration IISASPNET
{
Node localhost
{
#Install the IIS Role
WindowsFeature IIS
{
Ensure = "Present"
Name = "Web-Server"
}
#Install ASP.NET 4.5
WindowsFeature ASP
{
Ensure = "Present"
Name = "Web-Asp-Net45"
}
WindowsFeature WebServerManagementConsole
{
Name = "Web-Mgmt-Console"
Ensure = "Present"
}
}
}

Двоичные данные
scripts/iisaspnet.ps1.zip Normal file

Двоичный файл не отображается.

3
scripts/nva.sh Normal file
Просмотреть файл

@ -0,0 +1,3 @@
#!/bin/bash
sudo bash -c "echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf"
sudo sysctl -p /etc/sysctl.conf

Просмотреть файл

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|AnyCPU">
<Configuration>Debug</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|AnyCPU">
<Configuration>Release</Configuration>
<Platform>AnyCPU</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>06c057fd-2159-461b-90af-f2551fa1c2e0</ProjectGuid>
</PropertyGroup>
<PropertyGroup>
<TargetFrameworkIdentifier>Deployment</TargetFrameworkIdentifier>
<TargetFrameworkVersion>1.0</TargetFrameworkVersion>
<PrepareForBuildDependsOn>
</PrepareForBuildDependsOn>
</PropertyGroup>
<Import Condition=" Exists('Deployment.targets') " Project="Deployment.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<!-- vertag<:>start tokens<:>maj.min -->
<Import Condition=" Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Deployment\1.1\DeploymentProject.targets') " Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Deployment\1.1\DeploymentProject.targets" />
<!-- vertag<:>end -->
<ItemGroup>
<None Include="Deployment.targets">
<Visible>False</Visible>
</None>
<Content Include="Scripts\Deploy-AzureResourceGroup.ps1" />
<None Include="drivers\Bash\deploy-template-with-param.sh" />
<None Include="drivers\Json\deploy-template-with-param.json" />
<None Include="drivers\Json\deploy-template-with-param.parameters.json" />
<None Include="drivers\Json\deploy-template-return-outputs.json" />
<None Include="drivers\Json\output-mapper.json" />
<None Include="drivers\Powershell\Deploy-Template.ps1" />
<None Include="drivers\Powershell\deploy-vnet-n-subnets.ps1" />
<None Include="scripts\apache.sh" />
<None Include="scripts\iisaspnet.ps1" />
<None Include="scripts\iisaspnet.ps1.zip" />
<None Include="scripts\nva.sh" />
<None Include="templates\buildingBlocks\loadBalancer-backend-n-vm\azuredeploy.json" />
<None Include="templates\buildingBlocks\loadBalancer-backend-n-vm\azuredeploy.parameters.json" />
<None Include="templates\buildingBlocks\loadBalancer-backend-n-vm\scenarios\internal-loadBalancer.parameters.json" />
<None Include="templates\buildingBlocks\loadBalancer-backend-n-vm\scenarios\public-loadBalancer.parameters.json" />
<None Include="templates\buildingBlocks\multi-vm-n-nic-m-storage\azuredeploy.json" />
<None Include="templates\buildingBlocks\multi-vm-n-nic-m-storage\azuredeploy.parameters.json" />
<None Include="templates\buildingBlocks\multi-vm-n-nic-m-storage\scenarios\4-vm-2-sa-2-nic-3-dd-public-ip.parameters.json" />
<None Include="templates\buildingBlocks\multi-vm-n-nic-m-storage\scenarios\nic-test1.parameters.json" />
<None Include="templates\buildingBlocks\multi-vm-n-nic-m-storage\scenarios\nic-test2.parameters.json" />
<None Include="templates\buildingBlocks\networkSecurityGroups\azuredeploy.json" />
<None Include="templates\buildingBlocks\networkSecurityGroups\azuredeploy.parameters.json" />
<None Include="templates\buildingBlocks\nvas-ntier-network\azuredeploy.json" />
<None Include="templates\buildingBlocks\nvas-ntier-network\azuredeploy.parameters.json" />
<None Include="templates\buildingBlocks\nvas-ntier-network\scenarios\2-nva-gwy-vm-ipfwding-enabled.parameters.json" />
<None Include="templates\buildingBlocks\nvas-ntier-network\scenarios\network-topology.png" />
<None Include="templates\buildingBlocks\nvas-ntier-network\scenarios\setup-script.ps1" />
<None Include="templates\buildingBlocks\userDefinedRoutes\azuredeploy.json" />
<None Include="templates\buildingBlocks\userDefinedRoutes\azuredeploy.parameters.json" />
<None Include="templates\buildingBlocks\vnet-n-subnet\azuredeploy.parameters.json" />
<None Include="templates\buildingBlocks\vnet-n-subnet\scenarios\vnet-with-2-subnets-1-dns.parameters.json" />
<None Include="templates\buildingBlocks\vnet-n-subnet\scenarios\vnet-with-3tier-subnets.parameters.json" />
<None Include="templates\buildingBlocks\vnet-n-subnet\azuredeploy.json" />
<None Include="templates\buildingBlocks\vpn-gateway-vpn-connection\azuredeploy.json" />
<None Include="templates\buildingBlocks\vpn-gateway-vpn-connection\azuredeploy.parameters.json" />
<None Include="templates\buildingBlocks\vpn-gateway-vpn-er-failover\azuredeploy.json" />
<None Include="templates\buildingBlocks\vpn-gateway-vpn-er-failover\azuredeploy.parameters.json" />
<None Include="templates\resources\common\collector-internal.json" />
<None Include="templates\resources\common\collector-nop.json" />
<None Include="templates\resources\common\collector.json" />
<None Include="templates\resources\common\reference.json" />
<None Include="templates\resources\common\referenceOneParameter.json" />
<None Include="templates\resources\common\referenceTwoParameters.json" />
<None Include="templates\resources\common\replicator-internal.json" />
<None Include="templates\resources\common\replicator-nop.json" />
<None Include="templates\resources\common\replicator.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\availabilitySet-empty.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\availabilitySet-existing.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\availabilitySet-new.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\availabilitySet-neworempty.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\enable-default-gateway-multi-nic\enable-default-gateway.sh" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\enable-default-gateway-multi-nic\extension-enable-default-gateway.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\enable-ip-forwarding\enable-ip-forwarding.sh" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\enable-ip-forwarding\extension-enable-ip-forwarding.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\enable-iptables-routes\enable-iptables-routes.sh" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\enable-iptables-routes\extension-enable-iptables-routes.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\extension-custom-script-for-linux.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\extension-os-patching-for-linux.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\jmeter\2.8\extension-jmeter-2.8.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\jmeter\2.8\install-jmeter-2.8.sh" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\windows\enable-default-gateway-multi-nic\enable-default-gateway.ps1" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\windows\extension-powershell-dsc.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\n-vm-m-storage.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\n-vm-n-nic.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\private-dynamic-nics-settings.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\private-static-nics-settings.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\public-nic-dynamic-private-settings.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\public-nic-static-private-settings.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\single-vm-n-nic-avset.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\single-vm-n-nic-no-avset.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\single-vm-n-nic.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\virtualMachine-configuration-settings-linux-password.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\virtualMachine-configuration-settings-linux-ssh.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\virtualMachine-configuration-settings-linux.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\virtualMachine-configuration-settings-windows.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\virtualMachine-datadisk.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\virtualMachine-nic.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\virtualMachines-nics-settings.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\virtualMachines-settings.json" />
<None Include="templates\resources\Microsoft.Compute\virtualMachines\vm-per-storage-helper.json" />
<None Include="templates\resources\Microsoft.Network\connections\connection-ExpressRoute.json" />
<None Include="templates\resources\Microsoft.Network\connections\connection-IPsec.json" />
<None Include="templates\resources\Microsoft.Network\connections\connection-Vnet2Vnet.json" />
<None Include="templates\resources\Microsoft.Network\connections\connection.json" />
<None Include="templates\resources\Microsoft.Network\expressRouteCircuits\expressRouteCircuit.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-add-backendPool-nics.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-backendPools.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-empty-nic-array-helper.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-frontendIPConfiguration-internal.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-frontendIPConfiguration-public.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-frontendIPConfiguration-settings.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-inboundNatRules-all-settings.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-inboundNatRules-all.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-inboundNatRules-floatingIp-settings.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-inboundNatRules-single-settings.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-inboundNatRules.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-loadBalancingRules.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-nic-backendPools-array-helper.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-nic-natRuleArray-helper.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-nic-natRuleArray-processTypeAll.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-nic-natRuleArray-update.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-probes.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-update-internal-nic-backendPools.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-update-nics.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\lb-update-public-nic-backendPools.json" />
<None Include="templates\resources\Microsoft.Network\loadBalancer\loadBalancer.json" />
<None Include="templates\resources\Microsoft.Network\networkSecurityGroups\networkSecurityGroup-networkInterfaces.json" />
<None Include="templates\resources\Microsoft.Network\networkSecurityGroups\networkSecurityGroup-nop.json" />
<None Include="templates\resources\Microsoft.Network\networkSecurityGroups\networkSecurityGroup-securityRules.json" />
<None Include="templates\resources\Microsoft.Network\networkSecurityGroups\networkSecurityGroup-subnets.json" />
<None Include="templates\resources\Microsoft.Network\networkSecurityGroups\networkSecurityGroup.json" />
<None Include="templates\resources\Microsoft.Network\networkSecurityGroups\networkSecurityGroups.json" />
<None Include="templates\resources\Microsoft.Network\routeTables\routeTable-routes.json" />
<None Include="templates\resources\Microsoft.Network\routeTables\routeTable.json" />
<None Include="templates\resources\Microsoft.Network\routeTables\routeTables.json" />
<None Include="templates\resources\Microsoft.Network\routeTables\rt-routes-no-next-hop-ip-address.json" />
<None Include="templates\resources\Microsoft.Network\routeTables\rt-routes-with-next-hop-ip-address.json" />
<None Include="templates\resources\Microsoft.Network\virtualNetworkGateways\virtualNetworkGateway.json" />
<None Include="templates\resources\Microsoft.Network\virtualNetworks\virtualNetwork-subnets.json" />
<None Include="templates\resources\Microsoft.Network\virtualNetworks\virtualNetwork.json" />
<None Include="templates\resources\Microsoft.Storage\storageAccounts\storageAccount.json" />
<None Include="templates\resources\Microsoft.Storage\storageAccounts\storageAccounts.json" />
</ItemGroup>
<ItemGroup>
<Folder Include="templates\resources\Microsoft.Compute\virtualMachines\extensions\linux\os-patching\" />
</ItemGroup>
<Target Name="GetReferenceAssemblyPaths" />
</Project>

Просмотреть файл

@ -0,0 +1,118 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "bbLB"
}
},
"loadBalancerSettings": {
"type": "object",
"metadata": {
"description": "Settings for infrastructure"
}
},
"virtualMachinesSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual machines"
}
},
"virtualNetworkSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual network"
}
},
"buildingBlockSettings": {
"type": "object",
"metadata": {
"description": "Settings for building block"
}
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('loadBalancerSettings')), string(parameters('virtualMachinesSettings')), string(parameters('virtualNetworkSettings')), string(parameters('buildingBlockSettings'))))]",
"location": "[resourceGroup().location]",
"lbName": "[parameters('loadBalancerSettings').name]",
"loadBalancerTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Network/loadBalancer/loadBalancer.json')]",
"multiVMTemplate": "[uri(deployment().properties.templateLink.uri, '../multi-vm-n-nic-m-storage/azuredeploy.json')]",
"backendPoolNicTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Network/loadBalancer/lb-add-backendPool-nics.json')]",
"vmDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployVMs-', variables('templateUniqueString'))]",
"lbDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployLB-', variables('templateUniqueString'))]",
"updateNicDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-addNicsToLbBep-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('vmDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('multiVMTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployVMs')]"
}
},
"virtualMachinesSettings": { "value": "[parameters('virtualMachinesSettings')]" },
"virtualNetworkSettings": { "value": "[parameters('virtualNetworkSettings')]" },
"buildingBlockSettings": { "value": "[parameters('buildingBlockSettings')]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('lbDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('loadBalancerTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployLB')]"
}
},
"loadBalancerSettings": { "value": "[parameters('loadBalancerSettings')]" },
"virtualNetworkSettings": { "value": "[parameters('virtualNetworkSettings')]" },
"buildingBlockSettings": { "value": "[parameters('buildingBlockSettings')]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('updateNicDeploymentName')]",
"dependsOn": [
"[variables('vmDeploymentName')]",
"[variables('lbDeploymentName')]"
],
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('backendPoolNicTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-addNicsToLbBep')]"
}
},
"virtualMachinesSettings": { "value": "[parameters('virtualMachinesSettings')]" },
"vnetName": { "value": "[parameters('virtualNetworkSettings').name]" },
"vmStartIndex": { "value": "[parameters('buildingBlockSettings').vmStartIndex]" },
"vmCount": { "value": "[parameters('buildingBlockSettings').vmCount]" },
"loadBalancerSettings": { "value": "[parameters('loadBalancerSettings')]" }
}
}
}
],
"outputs": {
"resources": {
"type": "array",
"value": "[concat(reference(variables('vmDeploymentName')).outputResources, reference(variables('lbDeploymentName')).outputResources)]"
}
}
}

Просмотреть файл

@ -0,0 +1,146 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"loadBalancerSettings": {
"value": {
"name": "web-lb",
"frontendIPConfigurations": [
{
"name": "lbfe1",
"loadBalancerType": "public",
"internalLoadBalancerSettings": {
"privateIPAddress": "10.0.0.254",
"subnetName": "rs1-web-sn"
}
}
],
"loadBalancingRules": [
{
"name": "lbr1",
"frontendPort": 80,
"backendPort": 80,
"protocol": "Tcp",
"backendPoolName": "lb-bep1",
"frontendIPConfigurationName": "lbfe1"
},
{
"name": "lbr2",
"frontendPort": 443,
"backendPort": 443,
"protocol": "Tcp",
"backendPoolName": "lb-bep2",
"frontendIPConfigurationName": "lbfe1"
}
],
"probes": [
{
"name": "lbp1",
"port": 80,
"protocol": "Http",
"requestPath": "/"
},
{
"name": "lbp2",
"port": 443,
"protocol": "Http",
"requestPath": "/"
}
],
"backendPools": [
{
"name": "lb-bep1",
"nicIndex": 0
},
{
"name": "lb-bep2",
"nicIndex": 0
},
{
"name": "lb-bep3",
"nicIndex": 0
}
]
}
},
"virtualMachinesSettings": {
"value": {
"namePrefix": "rsvm",
"computerNamePrefix": "cn",
"size": "Standard_DS2",
"osType": "windows",
"adminUsername": "testuser",
"adminPassword": "AweS0me@PW",
"osAuthenticationType": "password",
"nics": [
{
"isPublic": "false",
"subnetName": "rs1-web-sn",
"privateIPAllocationMethod": "static",
"startingIPAddress": "10.0.0.240",
"enableIPForwarding": true,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "true"
},
{
"isPublic": "false",
"subnetName": "rs1-biz-sn",
"privateIPAllocationMethod": "dynamic",
"enableIPForwarding": false,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "false"
}
],
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"dataDisks": {
"count": 2,
"properties": {
"diskSizeGB": 127,
"caching": "None",
"createOption": "Empty"
}
},
"osDisk": {
"caching": "ReadWrite"
},
"availabilitySet": {
"useExistingAvailabilitySet": "No",
"name": "rs-as"
}
},
"metadata": {
"description": "Settings for Virtual Machines"
}
},
"virtualNetworkSettings": {
"value": {
"name": "rs1-dev-vnet",
"resourceGroup": "rs-bb1-rg"
},
"metadata": {
"description": "Infrastructure Settings"
}
},
"buildingBlockSettings": {
"value": {
"storageAccountsCount": 1,
"vmCount": 2,
"vmStartIndex": 0
},
"metadata": {
"description": "Settings specific to the building block"
}
}
}
}

Просмотреть файл

@ -0,0 +1,177 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"loadBalancerSettings": {
"value": {
"name": "web-ilb",
"frontendIPConfigurations": [
{
"name": "lbfe1",
"loadBalancerType": "internal",
"internalLoadBalancerSettings": {
"privateIPAddress": "10.0.0.254",
"subnetName": "rs1-web-sn"
}
}
],
"loadBalancingRules": [
{
"name": "lbr1",
"frontendPort": 80,
"backendPort": 80,
"protocol": "Tcp",
"backendPoolName": "lb-bep1",
"frontendIPConfigurationName": "lbfe1"
},
{
"name": "lbr2",
"frontendPort": 443,
"backendPort": 443,
"protocol": "Tcp",
"backendPoolName": "lb-bep2",
"frontendIPConfigurationName": "lbfe1"
}
],
"probes": [
{
"name": "lbp1",
"port": 80,
"protocol": "Http",
"requestPath": "/"
},
{
"name": "lbp2",
"port": 443,
"protocol": "Http",
"requestPath": "/"
}
],
"backendPools": [
{
"name": "lb-bep1",
"nicIndex": 0
},
{
"name": "lb-bep2",
"nicIndex": 0
},
{
"name": "lb-bep3",
"nicIndex": 0
}
],
"inboundNatRules": [
{
"namePrefix": "nat1",
"frontendIPConfigurationName": "lbfe1",
"startingFrontendPort": 50001,
"backendPort": 3389,
"natRuleType": "All",
"protocol": "Tcp",
"nicIndex": 0
},
{
"namePrefix": "nat2",
"frontendIPConfigurationName": "lbfe1",
"frontendPort": 9042,
"backendPort": 9042,
"natRuleType": "Single",
"protocol": "Tcp",
"vmIndex": 1,
"nicIndex": 0
},
{
"namePrefix": "nat3",
"frontendIPConfigurationName": "lbfe1",
"frontendPort": 25,
"natRuleType": "FloatingIp",
"protocol": "Tcp",
"vmIndex": 2,
"nicIndex": 0
}
]
}
},
"virtualMachinesSettings": {
"value": {
"namePrefix": "rsvm",
"computerNamePrefix": "cn",
"size": "Standard_DS2",
"osType": "windows",
"adminUsername": "testuser",
"adminPassword": "AweS0me@PW",
"osAuthenticationType": "password",
"nics": [
{
"isPublic": "true",
"subnetName": "rs1-web-sn",
"privateIPAllocationMethod": "static",
"publicIPAllocationMethod": "dynamic",
"startingIPAddress": "10.0.0.240",
"enableIPForwarding": true,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "true"
},
{
"isPublic": "false",
"subnetName": "rs1-biz-sn",
"privateIPAllocationMethod": "dynamic",
"enableIPForwarding": false,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "false"
}
],
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"dataDisks": {
"count": 2,
"properties": {
"diskSizeGB": 127,
"caching": "None",
"createOption": "Empty"
}
},
"osDisk": {
"caching": "ReadWrite"
},
"availabilitySet": {
"useExistingAvailabilitySet": "No",
"name": "rs-as"
}
},
"metadata": {
"description": "Settings for Virtual Machines"
}
},
"virtualNetworkSettings": {
"value": {
"name": "rs1-dev-vnet",
"resourceGroup": "rs-bb77-rg"
},
"metadata": {
"description": "Infrastructure Settings"
}
},
"buildingBlockSettings": {
"value": {
"storageAccountsCount": 1,
"vmCount": 3,
"vmStartIndex": 0
},
"metadata": {
"description": "Settings specific to the building block"
}
}
}
}

Просмотреть файл

@ -0,0 +1,139 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"loadBalancerSettings": {
"value": {
"name": "web-lb",
"frontendIPConfigurations": [
{
"name": "lbfe1",
"loadBalancerType": "public"
}
],
"loadBalancingRules": [
{
"name": "lbr1",
"frontendPort": 80,
"backendPort": 80,
"protocol": "Tcp",
"backendPoolName": "lb-bep1",
"frontendIPConfigurationName": "lbfe1"
},
{
"name": "lbr2",
"frontendPort": 443,
"backendPort": 443,
"protocol": "Tcp",
"backendPoolName": "lb-bep2",
"frontendIPConfigurationName": "lbfe1"
}
],
"probes": [
{
"name": "lbp1",
"port": 80,
"protocol": "Http",
"requestPath": "/"
},
{
"name": "lbp2",
"port": 443,
"protocol": "Http",
"requestPath": "/"
}
],
"backendPools": [
{
"name": "lb-bep1",
"nicIndex": 0
},
{
"name": "lb-bep2",
"nicIndex": 0
},
{
"name": "lb-bep3",
"nicIndex": 0
}
]
}
},
"virtualMachinesSettings": {
"value": {
"namePrefix": "rsvm",
"computerNamePrefix": "cn",
"size": "Standard_DS2",
"osType": "windows",
"adminUsername": "testuser",
"adminPassword": "AweS0me@PW",
"osAuthenticationType": "password",
"nics": [
{
"isPublic": "false",
"subnetName": "rs1-web-sn",
"privateIPAllocationMethod": "static",
"startingIPAddress": "10.0.0.240",
"enableIPForwarding": true,
"dnsServers": [
],
"isPrimary": "true"
},
{
"isPublic": "false",
"subnetName": "rs1-biz-sn",
"privateIPAllocationMethod": "dynamic",
"enableIPForwarding": false,
"dnsServers": [
"10.0.0.10"
],
"isPrimary": "false"
}
],
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"dataDisks": {
"count": 2,
"properties": {
"diskSizeGB": 127,
"caching": "None",
"createOption": "Empty"
}
},
"osDisk": {
"caching": "ReadWrite"
},
"availabilitySet": {
"useExistingAvailabilitySet": "No",
"name": "rs-as"
}
},
"metadata": {
"description": "Settings for Virtual Machines"
}
},
"virtualNetworkSettings": {
"value": {
"name": "rs1-dev-vnet",
"resourceGroup": "rs-bb22-rg"
},
"metadata": {
"description": "Infrastructure Settings"
}
},
"buildingBlockSettings": {
"value": {
"storageAccountsCount": 1,
"vmCount": 2,
"vmStartIndex": 0
},
"metadata": {
"description": "Settings specific to the building block"
}
}
}
}

Просмотреть файл

@ -0,0 +1,156 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "bbVM"
}
},
"virtualMachinesSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual machines"
}
},
"virtualNetworkSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual network"
}
},
"buildingBlockSettings": {
"type": "object",
"metadata": {
"description": "Settings for building block"
}
}
},
"variables": {
"location": "[resourceGroup().location]",
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualMachinesSettings')), string(parameters('virtualNetworkSettings')), string(parameters('buildingBlockSettings')), resourceGroup().id))]",
"availabilitySetTemplates": {
"yes": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Compute/virtualMachines/availabilitySet-existing.json')]",
"no": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Compute/virtualMachines/availabilitySet-neworempty.json')]"
},
"storageAccount": {
"diagnostic": "[toLower(concat('vm', variables('templateUniqueString'), 'diag'))]",
"vhd": "[toLower(concat('vm', variables('templateUniqueString'), 'st'))]"
},
"storageTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Storage/storageAccounts/storageAccounts.json')]",
"VMsInStorageTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Compute/virtualMachines/n-vm-m-storage.json')]",
"avSetDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployAvSet-', variables('templateUniqueString'))]",
"vmStorageDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployStorage-', variables('templateUniqueString'))]",
"diagnosticStorageDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployDiagStorage-', variables('templateUniqueString'))]",
"vmsInStorageDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployVMsInSt-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('avSetDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('availabilitySetTemplates')[toLower(parameters('virtualMachinesSettings').availabilitySet.useExistingAvailabilitySet)]]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployAvSet')]"
}
},
"availabilitySetSettings": { "value": "[parameters('virtualMachinesSettings').availabilitySet]" },
"vmCount": { "value": "[parameters('buildingBlockSettings').vmCount]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('diagnosticStorageDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('storageTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployDiagStorage')]"
}
},
"name": { "value": "[variables('storageAccount').diagnostic]" },
"location": { "value": "[variables('location')]" },
"storageAccountsCount": { "value": 1 },
"skuName": { "value": "Standard_LRS" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('vmStorageDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('storageTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployStorage')]"
}
},
"name": { "value": "[variables('storageAccount').vhd]" },
"location": { "value": "[variables('location')]" },
"storageAccountsCount": { "value": "[parameters('buildingBlockSettings').storageAccountsCount]" },
"skuName": { "value": "Premium_LRS" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('vmsInStorageDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('VMsInStorageTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployVMsInSt')]"
}
},
"virtualMachinesSettings": { "value": "[parameters('virtualMachinesSettings')]" },
"virtualNetworkSettings": { "value": "[parameters('virtualNetworkSettings')]" },
"buildingBlockSettings": { "value": "[parameters('buildingBlockSettings')]" },
"context": {
"value": {
"storageAccounts": {
"diagnostic": "[variables('storageAccount').diagnostic]",
"vhd": "[variables('storageAccount').vhd]"
},
"availabilitySetName": "[reference(variables('avSetDeploymentName')).outputs.availabilitySetName.value]"
}
}
}
},
"dependsOn": [
"[variables('diagnosticStorageDeploymentName')]",
"[variables('vmStorageDeploymentName')]",
"[variables('avSetDeploymentName')]"
]
}
],
"outputs": {
"resources": {
"type": "array",
"value": "[concat(reference(variables('avSetDeploymentName')).outputResources, reference(variables('diagnosticStorageDeploymentName')).outputResources, reference(variables('vmStorageDeploymentName')).outputResources, reference(variables('vmsInStorageDeploymentName')).outputResources)]"
}
}
}

Просмотреть файл

@ -0,0 +1,85 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachinesSettings": {
"value": {
"namePrefix": "rsvm",
"computerNamePrefix": "cn",
"size": "Standard_DS2",
"osType": "windows",
"adminUsername": "testuser",
"adminPassword": "AweS0me@PW",
"osAuthenticationType": "password",
"nics": [
{
"isPublic": "false",
"subnetName": "rs1-web-sn",
"privateIPAllocationMethod": "static",
"startingIPAddress": "10.0.0.240",
"enableIPForwarding": true,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "true"
},
{
"isPublic": "false",
"subnetName": "rs1-biz-sn",
"privateIPAllocationMethod": "dynamic",
"enableIPForwarding": false,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "false"
}
],
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"dataDisks": {
"count": 0,
"properties": {
"diskSizeGB": 127,
"caching": "None",
"createOption": "Empty"
}
},
"osDisk": {
"caching": "ReadWrite"
},
"availabilitySet": {
"useExistingAvailabilitySet": "No",
"name": "rs1"
}
},
"metadata": {
"description": "Settings for Virtual Machines"
}
},
"virtualNetworkSettings": {
"value": {
"name": "rs1-dev-vnet",
"resourceGroup": "rs-bb22-rg"
},
"metadata": {
"description": "Infrastructure Settings"
}
},
"buildingBlockSettings": {
"value": {
"storageAccountsCount": 1,
"vmCount": 1,
"vmStartIndex": 0
},
"metadata": {
"description": "Settings specific to the building block"
}
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachinesSettings": {
"value": {
"namePrefix": "cn",
"computerNamePrefix": "cn",
"size": "Standard_DS2",
"adminUsername": "testuser",
"adminPassword": "AweS0me@PW",
"osAuthenticationType": "password",
"sshPublicKey": "",
"nics": [
{
"isPublic": "false",
"subnetName": "a0-web-sn",
"privateIPAllocationMethod": "static",
"startingIPAddress": "10.0.0.176",
"enableIPForwarding": true,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "false"
},
{
"isPublic": "true",
"publicIPAllocationMethod": "dynamic",
"subnetName": "a0-data-sn",
"privateIPAllocationMethod": "static",
"startingIPAddress": "10.0.1.176",
"enableIPForwarding": true,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "true"
}
],
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"dataDisks": {
"count": 1,
"properties": {
"diskSizeGB": 127,
"caching": "None",
"createOption": "Empty"
}
},
"osDisk": {
"caching": "ReadWrite"
},
"availabilitySet": {
"useExistingAvailabilitySet": "No",
"name": "a0-web-as"
}
},
"metadata": {
"description": "Settings for Virtual Machines"
}
},
"virtualNetworkSettings": {
"value": {
"name": "a0-vnet",
"resourceGroup": "a0-rg"
},
"metadata": {
"description": "Virtual network settings"
}
},
"buildingBlockSettings": {
"value": {
"storageAccountsCount": 1,
"vmCount": 2,
"vmStartIndex": 6
},
"metadata": {
"description": "Settings specific to the building block"
}
}
}
}

Просмотреть файл

@ -0,0 +1,82 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachinesSettings": {
"value": {
"namePrefix": "rsvm",
"computerNamePrefix": "cn",
"size": "Standard_DS2",
"osType": "windows",
"adminUsername": "testuser",
"adminPassword": "AweS0me@PW",
"osAuthenticationType": "password",
"nics": [
{
"isPublic": "true",
"subnetName": "rs1-web-sn",
"privateIPAllocationMethod": "static",
"publicIPAllocationMethod": "dynamic",
"startingIPAddress": "10.0.0.240",
"enableIPForwarding": true,
"dnsServers": [ ],
"isPrimary": "true"
},
{
"isPublic": "false",
"subnetName": "rs1-biz-sn",
"privateIPAllocationMethod": "dynamic",
"enableIPForwarding": false,
"dnsServers": [
"10.0.0.10"
],
"isPrimary": "false"
}
],
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"dataDisks": {
"count": 0,
"properties": {
"diskSizeGB": 127,
"caching": "None",
"createOption": "Empty"
}
},
"osDisk": {
"caching": "ReadWrite"
},
"availabilitySet": {
"useExistingAvailabilitySet": "No",
"name": "rs1"
}
},
"metadata": {
"description": "Settings for Virtual Machines"
}
},
"virtualNetworkSettings": {
"value": {
"name": "rs1-dev-vnet",
"resourceGroup": "rs-bb33-rg"
},
"metadata": {
"description": "Infrastructure Settings"
}
},
"buildingBlockSettings": {
"value": {
"storageAccountsCount": 1,
"vmCount": 1,
"vmStartIndex": 0
},
"metadata": {
"description": "Settings specific to the building block"
}
}
}
}

Просмотреть файл

@ -0,0 +1,83 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachinesSettings": {
"value": {
"namePrefix": "rsvm",
"computerNamePrefix": "cn",
"size": "Standard_DS2",
"osType": "windows",
"adminUsername": "testuser",
"adminPassword": "AweS0me@PW",
"osAuthenticationType": "password",
"nics": [
{
"isPublic": "false",
"subnetName": "rs1-web-sn",
"privateIPAllocationMethod": "static",
"startingIPAddress": "10.0.0.240",
"enableIPForwarding": true,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "false"
},
{
"isPublic": "true",
"subnetName": "rs1-biz-sn",
"privateIPAllocationMethod": "dynamic",
"publicIPAllocationMethod": "dynamic",
"enableIPForwarding": false,
"dnsServers": [ ],
"isPrimary": "true"
}
],
"imageReference": {
"publisher": "MicrosoftWindowsServer",
"offer": "WindowsServer",
"sku": "2012-R2-Datacenter",
"version": "latest"
},
"dataDisks": {
"count": 0,
"properties": {
"diskSizeGB": 127,
"caching": "None",
"createOption": "Empty"
}
},
"osDisk": {
"caching": "ReadWrite"
},
"availabilitySet": {
"useExistingAvailabilitySet": "No",
"name": "rs1"
}
},
"metadata": {
"description": "Settings for Virtual Machines"
}
},
"virtualNetworkSettings": {
"value": {
"name": "rs1-dev-vnet",
"resourceGroup": "rs-bb44-rg"
},
"metadata": {
"description": "Infrastructure Settings"
}
},
"buildingBlockSettings": {
"value": {
"storageAccountsCount": 1,
"vmCount": 1,
"vmStartIndex": 0
},
"metadata": {
"description": "Settings specific to the building block"
}
}
}
}

Просмотреть файл

@ -0,0 +1,46 @@
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId '6df485a0-aafa-4020-893d-32e833d056d6'
#############################################################################
# Make sure that the following parameters match the ones in the template
$resourceGroupName='app13-rg'
$deploymentName='app13-rg-dep'
$location='West US'
$vnetName='app13-vnet'
$subnetName1='app13-fe-subnet'
$subnetName2='app13-be-subnet'
$avsetName='app13-web-avSet'
$vnetAddressPrefix='10.4.0.0/16'
$subnetAddressPrefix1='10.4.0.0/24'
$subnetAddressPrefix2='10.4.1.0/24'
$diagStorage='app13devdiag'
$vhdStorage='app13devvmst'
# Create new resource group
New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
# Set subnet config
$subNet1=New-AzureRmVirtualNetworkSubnetConfig -Name $subnetName1 -AddressPrefix $subnetAddressPrefix1
$subNet2=New-AzureRmVirtualNetworkSubnetConfig -Name $subnetName2 -AddressPrefix $subnetAddressPrefix2
# Create a new VNet
New-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $resourceGroupName -AddressPrefix $vnetAddressPrefix -Location $location -Subnet $subNet1, $subNet2
# Create a new availability set
New-AzureRmAvailabilitySet -ResourceGroupName $resourceGroupName -Name $avsetName -Location $location -PlatformUpdateDomainCount 5 -PlatformFaultDomainCount 3
# Create storage accounts
New-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $diagStorage -Type Standard_LRS -Location $location
New-AzureRmStorageAccount -ResourceGroupName $resourceGroupName -Name $vhdStorage -Type Premium_LRS -Location $location
# Template and first parameter file URIs
$templateUri = 'https://raw.githubusercontent.com/mspnp/blueprints/refarch/buildingblocks/ARMBuildingBlocks/ARMBuildingBlocks/Templates/resources/virtualMachines/n-vm-n-nic.json'
$templateLocalParam='C:\dev\bbtest\n-vm-n-nic.parameters.json'
Test-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateUri $templateUri -TemplateParameterFile $templateLocalParam
New-AzureRmResourceGroupDeployment -Name $deploymentName -ResourceGroupName $resourceGroupName -TemplateUri $templateUri -TemplateParameterFile $templateLocalParam -Verbose

Просмотреть файл

@ -0,0 +1,58 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "bbNSG"
}
},
"virtualNetworkSettings": {
"type": "object"
},
"networkSecurityGroupsSettings": {
"type": "array",
"metadata": {
"description": "Settings for network security groups"
}
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('networkSecurityGroupsSettings'))))]",
"nsgTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Network/networkSecurityGroups/networkSecurityGroups.json')]",
"deploymentTemplateName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployNSGs-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentTemplateName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('nsgTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployNSGs')]"
}
},
"virtualNetworkSettings": {
"value": "[parameters('virtualNetworkSettings')]"
},
"networkSecurityGroupsSettings": {
"value": "[parameters('networkSecurityGroupsSettings')]"
}
}
}
}
],
"outputs": {
"resources": {
"type": "array",
"value": "[reference(variables('deploymentTemplateName')).outputResources]"
}
}
}

Просмотреть файл

@ -0,0 +1,38 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualNetworkSettings": {
"value": {
"name": "app1-vnet",
"resourceGroup": "app1-dev-rg"
}
},
"networkSecurityGroupsSettings": {
"value": [
{
"name": "app1-nsg",
"subnets": [
"app1-subnet"
],
"networkInterfaces": [
],
"securityRules": [
{
"name": "RDPAllow",
"direction": "Inbound",
"priority": 100,
"sourceAddressPrefix": "*",
"destinationAddressPrefix": "*",
"sourcePortRange": "*",
"destinationPortRange": "3389",
"access": "Allow",
"protocol": "Tcp"
}
]
}
]
}
}
}

Просмотреть файл

@ -0,0 +1,101 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "bbNVAs"
}
},
"loadBalancerSettings": {
"type": "object",
"metadata": {
"description": "Settings for infrastructure"
}
},
"virtualMachinesSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual machines"
}
},
"virtualNetworkSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual network"
}
},
"buildingBlockSettings": {
"type": "object",
"metadata": {
"description": "Settings for building block"
}
},
"routeTableSettings": {
"type": "array",
"metadata": {
"description": "Settings for route table."
}
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('loadBalancerSettings')), string(parameters('virtualMachinesSettings')), string(parameters('virtualNetworkSettings')), string(parameters('buildingBlockSettings')), string(parameters('routeTableSettings'))))]",
"location": "[resourceGroup().location]",
"vmPrefix": "[concat(parameters('virtualMachinesSettings').namePrefix, '-vm')]",
"routeTableTemplate": "[uri(deployment().properties.templateLink.uri, '../userDefinedRoutes/azuredeploy.json')]",
"loadBalancerTemplate": "[uri(deployment().properties.templateLink.uri, '../loadBalancer-backend-n-vm/azuredeploy.json')]",
"routeTableDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployRt-', variables('templateUniqueString'))]",
"lbDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployLbVMs-', variables('templateUniqueString'))]",
"extensionDeploymentNamePrefix": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployVmExt-')]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('routeTableDeploymentName')]",
"dependsOn": [
"[variables('lbDeploymentName')]"
],
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('routeTableTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployRt')]"
}
},
"virtualNetworkSettings": { "value": "[parameters('virtualNetworkSettings')]" },
"routeTableSettings": { "value": "[parameters('routeTableSettings')]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('lbDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('loadBalancerTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployLbVMs')]"
}
},
"virtualMachinesSettings": { "value": "[parameters('virtualMachinesSettings')]" },
"virtualNetworkSettings": { "value": "[parameters('virtualNetworkSettings')]" },
"buildingBlockSettings": { "value": "[parameters('buildingBlockSettings')]" },
"loadBalancerSettings": { "value": "[parameters('loadBalancerSettings')]" }
}
}
}
],
"outputs": {
"resources": {
"type": "array",
"value": "[concat(reference(variables('routeTableDeploymentName')).outputResources, reference(variables('lbDeploymentName')).outputResources)]"
}
}
}

Просмотреть файл

@ -0,0 +1,137 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"loadBalancerSettings": {
"value": {
"name": "nva-ilb",
"frontendIPConfigurations": [
{
"name": "lbfe1",
"loadBalancerType": "internal",
"internalLoadBalancerSettings": {
"privateIPAddress": "10.0.1.250",
"subnetName": "app1-in-subnet"
}
}
],
"loadBalancingRules": [
{
"name": "lbr1",
"frontendPort": 80,
"backendPort": 80,
"protocol": "Tcp",
"backendPoolName": "lb-bep1",
"frontendIPConfigurationName": "lbfe1"
}
],
"probes": [
{
"name": "lbp1",
"port": 80,
"protocol": "Http",
"requestPath": "/"
}
],
"backendPools": [
{
"name": "lb-bep1",
"nicIndex": 0
}
],
"inboundNatRules": [ ]
}
},
"virtualMachinesSettings": {
"value": {
"namePrefix": "app1",
"computerNamePrefix": "cn",
"size": "Standard_DS2",
"osType": "linux",
"adminUsername": "testuser",
"adminPassword": "AweS0me@PW",
"sshPublicKey": "",
"osAuthenticationType": "password",
"nics": [
{
"isPublic": "false",
"subnetName": "app1-in-subnet",
"privateIPAllocationMethod": "static",
"startingIPAddress": "10.0.1.242",
"isPrimary": "true",
"enableIPForwarding": true,
"dnsServers": [ ]
},
{
"isPublic": "false",
"subnetName": "app1-out-subnet",
"privateIPAllocationMethod": "dynamic",
"isPrimary": "false",
"enableIPForwarding": true,
"dnsServers": [ ]
}
],
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "14.04.5-LTS",
"version": "latest"
},
"dataDisks": {
"count": 0,
"properties": {
"diskSizeGB": 128,
"caching": "None",
"createOption": "Empty"
}
},
"osDisk": {
"caching": "ReadWrite"
},
"availabilitySet": {
"useExistingAvailabilitySet": "No",
"name": "app1-dev"
}
}
},
"virtualNetworkSettings": {
"value": {
"name": "app1-vnet",
"resourceGroup": "app1-rg"
}
},
"buildingBlockSettings": {
"value": {
"storageAccountsCount": 1,
"vmCount": 2,
"vmStartIndex": 0
}
},
"routeTableSettings": {
"value": [
{
"name": "app1-in-rt",
"subnets": [
"app1-in-subnet"
],
"routes": [
{
"name": "route1",
"addressPrefix": "10.0.1.0/24",
"nextHopType": "VirtualAppliance",
"nextHopIpAddress": "10.0.255.224"
},
{
"name": "route2",
"addressPrefix": "10.0.2.0/24",
"nextHopType": "VirtualAppliance",
"nextHopIpAddress": "10.0.255.224"
}
]
}
]
}
}
}

Просмотреть файл

@ -0,0 +1,169 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"loadBalancerSettings": {
"value": {
"name": "in-lb",
"frontendIPConfigurations": [
{
"name": "lbfe1",
"loadBalancerType": "public",
"internalLoadBalancerSettings": {
"privateIPAddress": "10.0.1.10",
"subnetName": "app0-in-sn"
}
}
],
"loadBalancingRules": [
{
"name": "lbr1",
"frontendPort": 80,
"backendPort": 80,
"protocol": "Tcp",
"backendPoolName": "lb-bep1",
"frontendIPConfigurationName": "lbfe1"
},
{
"name": "lbr2",
"frontendPort": 443,
"backendPort": 443,
"protocol": "Tcp",
"backendPoolName": "lb-bep2",
"frontendIPConfigurationName": "lbfe1"
}
],
"probes": [
{
"name": "lbp1",
"port": 80,
"protocol": "Http",
"requestPath": "/"
},
{
"name": "lbp2",
"port": 443,
"protocol": "Http",
"requestPath": "/"
}
],
"backendPools": [
{
"name": "lb-bep1",
"nicIndex": 0
},
{
"name": "lb-bep2",
"nicIndex": 0
},
{
"name": "lb-bep3",
"nicIndex": 0
}
]
}
},
"virtualMachinesSettings": {
"value": {
"namePrefix": "cn",
"computerNamePrefix": "cn",
"size": "Standard_DS2",
"adminUsername": "testuser",
"adminPassword": "AweS0me@PW",
"sshPublicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCUXF5vzdgGWymJ+9GtiPxb+H0p6MDh9oAlNklKKz6zp/NkqxMaWb8JJqK5jjfseOVnQWD+BkhA5bwUlULH2UJmjZSL9SFpNqarfM62EFHe416Q/MLMjBfQ+szEm15Jha8ur2VkkzuVDQK6lSVap/B+QU1JVdYLLHi3n7T65mWkOWdOXVAKZvBO+sT2CSRNUXCupsUHjnexeVxXiHrHZq9W62VUNKSpFKSQQt3hJkYaYWsoUjlO45EeQ3f0XjYZw1dfjN6X1wDdghqdbq46XlW8+4yucFyzreJGiF0uJWY7abVHqnfZ3XtLsKvwvC29QCdDftdtRCtqW1I5NXO84XGr kirpas@KIRPASDEV02",
"osAuthenticationType": "sshPublicKey",
"nics": [
{
"isPublic": "false",
"subnetName": "app0-in-sn",
"privateIPAllocationMethod": "static",
"startingIPAddress": "10.0.1.242",
"enableIPForwarding": true,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "true"
},
{
"isPublic": "false",
"subnetName": "app0-out-sn",
"privateIPAllocationMethod": "dynamic",
"enableIPForwarding": true,
"dnsServers": [
"10.0.0.10",
"10.0.0.11"
],
"isPrimary": "false"
}
],
"imageReference": {
"publisher": "Canonical",
"offer": "UbuntuServer",
"sku": "14.04.4-LTS",
"version": "latest"
},
"dataDisks": {
"count": 2,
"properties": {
"diskSizeGB": 127,
"caching": "None",
"createOption": "Empty"
}
},
"osDisk": {
"caching": "ReadWrite"
},
"availabilitySet": {
"useExistingAvailabilitySet": "No",
"name": "cn"
}
},
"metadata": {
"description": "Settings for Virtual Machines"
}
},
"virtualNetworkSettings": {
"value": {
"name": "app0-vnet",
"resourceGroup": "app0-rg"
},
"metadata": {
"description": "Virtual network settings"
}
},
"buildingBlockSettings": {
"value": {
"storageAccountsCount": 1,
"vmCount": 2,
"vmStartIndex": 3
},
"metadata": {
"description": "Settings specific to the building block"
}
},
"routeTableSettings": {
"value": {
"name": "app0-in-rt",
"subnets": [
"app0-in-sn"
],
"routes": [
{
"name": "route1",
"addressPrefix": "10.0.1.10/24",
"nextHopType": "VirtualAppliance",
"nextHopIpAddress": "10.0.255.224"
},
{
"name": "route2",
"addressPrefix": "10.0.2.10/24",
"nextHopType": "VirtualAppliance",
"nextHopIpAddress": "10.0.255.224"
}
]
}
}
}
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 310 KiB

Просмотреть файл

@ -0,0 +1,96 @@
Login-AzureRmAccount
Select-AzureRmSubscription -SubscriptionId '6df485a0-aafa-4020-893d-32e833d056d6'
#############################################################################
# Make sure that the following parameters match the ones in the template
$resourceGroupName='app1-rg'
$deploymentName='app1-rg-dep'
$location='East US'
$vnetName='app1-vnet'
$subnetIn='app1-in-subnet'
$subnetOut='app1-out-subnet'
#$avsetName='app1-web-as'
$vnetAddressPrefix='10.0.0.0/16'
$subnetInPrefix='10.0.1.0/24'
$subnetOutPrefix='10.0.2.0/24'
#$gatewaySubnetNamePrefix='10.0.255.224/27'
#$storageAccountVhd='app1devvmst'
#$storageAccountDiag='app1devdiag'
#$gatewaySubnetName='GatewaySubnet'
# Create new resource group
$resourceGroup = New-AzureRmResourceGroup -Name $resourceGroupName -Location $location
# Set subnet config
$subNet1=New-AzureRmVirtualNetworkSubnetConfig -Name $subnetIn -AddressPrefix $subnetInPrefix
$subNet2=New-AzureRmVirtualNetworkSubnetConfig -Name $subnetOut -AddressPrefix $subnetOutPrefix
#$subNet3=New-AzureRmVirtualNetworkSubnetConfig -Name $gatewaySubnetName -AddressPrefix $gatewaySubnetNamePrefix
# Create a new VNet
New-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $resourceGroup.ResourceGroupName -AddressPrefix $vnetAddressPrefix -Location $location -Subnet $subNet1, $subNet2 #, $subnet3
# Create VPN gateway with a public IP
#$gwpip= New-AzureRmPublicIpAddress -Name gwpip -ResourceGroupName $resourceGroupName -Location $location -AllocationMethod Dynamic
#$vnet = Get-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $resourceGroupName
#$subnet = Get-AzureRmVirtualNetworkSubnetConfig -Name $gatewaySubnetName -VirtualNetwork $vnet
#$gwipconfig = New-AzureRmVirtualNetworkGatewayIpConfig -Name gwipconfig1 -SubnetId $subnet.Id -PublicIpAddressId $gwpip.Id
#New-AzureRmVirtualNetworkGateway -Name vnetgw1 -ResourceGroupName $resourceGroupName -Location $location -IpConfigurations $gwipconfig -GatewayType Vpn -VpnType RouteBased -GatewaySku Standard
# Template and first parameter file URIs
$templateUri = 'https://raw.githubusercontent.com/mspnp/arm-building-blocks/kirpas/nva-buildingBlock/ARMBuildingBlocks/Templates/buildingBlocks/nvas-ntier-network/azuredeploy.json'
$templateParamUri = "https://raw.githubusercontent.com/mspnp/arm-building-blocks/kirpas/nva-buildingBlock/ARMBuildingBlocks/Templates/buildingBlocks/nvas-ntier-network/azuredeploy.parameters.json"
$outputFile = Join-Path (Get-Item -Path ".\" -Verbose).FullName -ChildPath "$resourceGroupName-template-output.json"
$result = Test-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroup.ResourceGroupName -TemplateUri $templateUri -TemplateParameterUri $templateParamUri
if($result.Count -eq 0)
{
New-AzureRmResourceGroupDeployment -Name $deploymentName -ResourceGroupName $resourceGroup.ResourceGroupName -TemplateUri $templateUri -TemplateParameterUri $templateParamUri | ConvertTo-Json | Out-File $outputFile -Force
}
else
{
$result
}
If($resourceGroup -ne $null)
{
Write-Host $resourceGroup.ResourceGroupName
try
{
Write-Host "Getting resource group:$resourceGroupName RM virtual machines type resources"
$azureVMResources = Get-AzureRMVM -ResourceGroupName $resourceGroup.ResourceGroupName -ErrorAction Stop -Verbose
Write-Host "Count of resource group:$resourceGroupName RM virtual machines type resource is $($azureVMResources.Count)"
}
catch [Microsoft.WindowsAzure.Commands.Common.ComputeCloudException],[System.MissingMethodException], [System.Management.Automation.PSInvalidOperationException]
{
Write-Host $_.Exception.Message
throw
}
}
if($azureVMResources -ne $null)
{
try
{
$extensionName = 'nva-configuration'
$fileUri = 'https://raw.githubusercontent.com/mspnp/arm-building-blocks/kirpas/nva-buildingBlock/ARMBuildingBlocks/Templates/resources/Microsoft.Compute/virtualMachines/extensions/linux/enable-iptables-routes/enable-iptables-routes.sh'
$run = 'bash enable-iptables-routes.sh'
$version = 1.8
foreach($azureVMResource in $azureVMResources)
{
Write-Host "Applying custom script extension on: " $azureVMResource.Name
$result = Set-AzureRmVMCustomScriptExtension -ResourceGroupName $resourceGroup.ResourceGroupName -VMName $azureVMResource.Name -Name $extensionName `
-FileUri $fileUri -Run $run -Location $location -TypeHandlerVersion $version -ErrorAction Stop -Verbose
}
}
catch [Microsoft.WindowsAzure.Commands.Common.ComputeCloudException],[System.MissingMethodException], [System.Management.Automation.PSInvalidOperationException]
{
Write-Host $_.Exception.Message
throw
}
}

Просмотреть файл

@ -0,0 +1,61 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "bbUDR"
}
},
"virtualNetworkSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual networks"
}
},
"routeTableSettings": {
"type": "array",
"metadata": {
"description": "Settings for UDRs"
}
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('routeTableSettings'))))]",
"udrTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Network/routeTables/routeTables.json')]",
"deploymentTemplateName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployUDRs-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentTemplateName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('udrTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployUDRs')]"
}
},
"routeTableSettings": {
"value": "[parameters('routeTableSettings')]"
},
"virtualNetworkSettings": {
"value": "[parameters('virtualNetworkSettings')]"
}
}
}
}
],
"outputs": {
"resources": {
"type": "array",
"value": "[reference(variables('deploymentTemplateName')).outputResources]"
}
}
}

Просмотреть файл

@ -0,0 +1,6 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
}
}

Просмотреть файл

@ -0,0 +1,53 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "bbVnet"
}
},
"virtualNetworkSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual network"
}
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualNetworkSettings'))))]",
"virtualNetworkTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Network/virtualNetworks/virtualNetwork.json')]",
"vnetName": "[parameters('virtualNetworkSettings').name]",
"deploymentTemplateName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployVNet-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentTemplateName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('virtualNetworkTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployVNet')]"
}
},
"virtualNetworkSettings": {
"value": "[parameters('virtualNetworkSettings')]"
}
}
}
}
],
"outputs": {
"resources": {
"type": "array",
"value": "[reference(variables('deploymentTemplateName')).outputResources]"
}
}
}

Просмотреть файл

@ -0,0 +1,27 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualNetworkSettings": {
"value": {
"name": "rs1-dev-vnet",
"addressPrefixes": [ "10.0.0.0/16" ],
"subnets": [
{
"name": "rs1-web-sn",
"addressPrefix": "10.0.0.0/24"
},
{
"name": "rs1-biz-sn",
"addressPrefix": "10.0.1.0/24"
},
{
"name": "rs1-data-sn",
"addressPrefix": "10.0.2.0/24"
}
],
"dnsServers": []
}
}
}
}

Просмотреть файл

@ -0,0 +1,27 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualNetworkSettings": {
"value": {
"name": "myapp1-cn-vnet",
"addressPrefixes": [
"10.0.0.0/16"
],
"subnets": [
{
"name": "myapp1-web-sn",
"addressPrefix": "10.0.0.0/24"
},
{
"name": "myapp1-data-sn",
"addressPrefix": "10.0.2.0/24"
}
],
"dnsServers": [
"10.0.0.220"
]
}
}
}
}

Просмотреть файл

@ -0,0 +1,29 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualNetworkSettings": {
"value": {
"name": "a0-cn-vnet",
"addressPrefixes": [
"10.0.0.0/16"
],
"subnets": [
{
"name": "a0-web-sn",
"addressPrefix": "10.0.0.0/24"
},
{
"name": "a0-biz-sn",
"addressPrefix": "10.0.1.0/24"
},
{
"name": "a0-data-sn",
"addressPrefix": "10.0.2.0/24"
}
],
"dnsServers": []
}
}
}
}

Просмотреть файл

@ -0,0 +1,88 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "bbVPN"
}
},
"virtualNetworkSettings": {
"type": "object"
},
"virtualNetworkGatewaySettings": {
"type": "object"
},
"connectionSettings": {
"type": "object"
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualNetworkSettings')), string(parameters('virtualNetworkGatewaySettings')), string(parameters('connectionSettings'))))]",
"virtualNetworkGatewayTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Network/virtualNetworkGateways/virtualNetworkGateway.json')]",
"connectionTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Network/connections/connection.json')]",
"connectionDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployConn-', variables('templateUniqueString'))]",
"virtualNetworkGatewayDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployGW-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('virtualNetworkGatewayDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('virtualNetworkGatewayTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployGW')]"
}
},
"virtualNetworkSettings": {
"value": "[parameters('virtualNetworkSettings')]"
},
"virtualNetworkGatewaySettings": {
"value": "[parameters('virtualNetworkGatewaySettings')]"
}
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('connectionDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('connectionTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployConn')]"
}
},
"connectionSettings": {
"value": "[parameters('connectionSettings')]"
}
}
},
"dependsOn": [
"[variables('virtualNetworkGatewayDeploymentName')]"
]
}
],
"outputs": {
"resources": {
"type": "array",
"value": "[concat(reference(variables('virtualNetworkGatewayDeploymentName')).outputResources, reference(variables('connectionDeploymentName')).outputResources)]"
},
"publicIPAddress": {
"type": "object",
"value": "[reference(variables('virtualNetworkGatewayDeploymentName')).outputs.publicIPAddress.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"baseName": {
"value": "my-base-name"
},
"infrastructureSettings": {
"value": {
"vnetName": "drew-ra-vnet",
"virtualNetworkGateway": {
"name": "drew-ra-gw",
"gatewayType": "Vpn",
"vpnType": "RouteBased",
"sku": "Standard"
},
"connection": {
"name": "drew-ra-vpn",
"connectionType": "IPsec",
"sharedKey": "123secret",
"virtualNetworkGateway1": {
"name": "drew-ra-gw"
},
"localNetworkGateway": {
"name": "drew-ra-lgw",
"ipAddress": "10.20.30.40",
"addressPrefixes": [ "192.168.0.0/16", "10.5.0.0/16" ]
},
"virtualNetworkGateway2": {
"name": "drew-ra-gw2"
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,148 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "bbERVpn"
}
},
"virtualNetworkSettings": {
"type": "object"
},
"vpnGatewaySettings": {
"type": "object"
},
"expressRouteGatewaySettings": {
"type": "object"
},
"vpnConnectionSettings": {
"type": "object"
},
"expressRouteConnectionSettings": {
"type": "object"
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualNetworkSettings')), string(parameters('vpnGatewaySettings')), string(parameters('expressRouteGatewaySettings')), string(parameters('vpnConnectionSettings')), string(parameters('expressRouteConnectionSettings'))))]",
"connectionTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Network/connections/connection.json')]",
"virtualNetworkGatewayTemplate": "[uri(deployment().properties.templateLink.uri, '../../resources/Microsoft.Network/virtualNetworkGateways/virtualNetworkGateway.json')]",
"vpnGatewayDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-', parameters('vpnGatewaySettings').name, '-', variables('templateUniqueString'))]",
"expressRouteGatewayDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-', parameters('expressRouteGatewaySettings').name, '-', variables('templateUniqueString'))]",
"vpnConnectionDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-', parameters('vpnConnectionSettings').name, '-', variables('templateUniqueString'))]",
"expressRouteConnectionDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-', parameters('expressRouteConnectionSettings').name, '-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('expressRouteGatewayDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('virtualNetworkGatewayTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-', parameters('expressRouteGatewaySettings').name)]"
}
},
"virtualNetworkSettings": {
"value": "[parameters('virtualNetworkSettings')]"
},
"virtualNetworkGatewaySettings": {
"value": "[parameters('expressRouteGatewaySettings')]"
}
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('vpnGatewayDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('virtualNetworkGatewayTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-', parameters('vpnGatewaySettings').name)]"
}
},
"virtualNetworkSettings": {
"value": "[parameters('virtualNetworkSettings')]"
},
"virtualNetworkGatewaySettings": {
"value": "[parameters('vpnGatewaySettings')]"
}
}
},
"dependsOn": [
"[variables('expressRouteGatewayDeploymentName')]"
]
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('vpnConnectionDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('connectionTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-', parameters('vpnConnectionSettings').name)]"
}
},
"connectionSettings": {
"value": "[parameters('vpnConnectionSettings')]"
}
}
},
"dependsOn": [
"[variables('vpnGatewayDeploymentName')]"
]
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('expressRouteConnectionDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('connectionTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-', parameters('expressRouteConnectionSettings').name)]"
}
},
"connectionSettings": {
"value": "[parameters('expressRouteConnectionSettings')]"
}
}
},
"dependsOn": [
"[variables('expressRouteGatewayDeploymentName')]"
]
}
],
"outputs": {
"resources": {
"type": "array",
"value": "[concat(reference(variables('expressRouteGatewayDeploymentName')).outputResources, reference(variables('vpnGatewayDeploymentName')).outputResources, reference(variables('vpnConnectionDeploymentName')).outputResources, reference(variables('expressRouteConnectionDeploymentName')).outputResources)]"
},
"publicIPAddress": {
"type": "object",
"value": "[reference(variables('vpnGatewayDeploymentName')).outputs.publicIPAddress.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,43 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"baseName": {
"value": "my-base-name"
},
"infrastructureSettings": {
"value": {
"vnetName": "test-ra-vnet",
"expressRoute": {
"virtualNetworkGateway": {
"name": "test-ra-gw-er",
"gatewayType": "ExpressRoute",
"vpnType": "RouteBased",
"sku": "Standard"
}
},
"ipsec": {
"virtualNetworkGateway": {
"name": "test-ra-gw",
"gatewayType": "Vpn",
"vpnType": "RouteBased",
"sku": "Standard"
},
"connection": {
"name": "test-ra-vpn",
"connectionType": "IPsec",
"sharedKey": "123secret",
"virtualNetworkGateway1": {
"name": "test-ra-gw"
},
"localNetworkGateway": {
"name": "test-ra-lgw",
"ipAddress": "10.20.30.40",
"addressPrefixes": [ "192.168.0.0/16", "10.5.0.0/16" ]
}
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,15 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"availabilitySetSettings": { "type": "object" }
},
"resources": [
],
"outputs": {
"availabilitySetName": {
"value": "",
"type": "string"
}
}
}

Просмотреть файл

@ -0,0 +1,19 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"availabilitySetSettings": { "type": "object" },
"vmCount": { "type": "int" }
},
"variables": {
},
"resources": [
],
"outputs": {
"availabilitySetName": {
"type": "string",
"value": "[parameters('availabilitySetSettings').name]"
}
}
}

Просмотреть файл

@ -0,0 +1,44 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"platformFaultDomainCount": {
"type": "int",
"maxValue": 20,
"defaultValue": 3,
"metadata": {
"description": "Platform domain count value."
}
},
"platformUpdateDomainCount": {
"type": "int",
"maxValue": 20,
"defaultValue": 5,
"metadata": {
"description": "Platform domain count value."
}
},
"availabilitySetSettings": { "type": "object" }
},
"variables": {
"avSetName": "[parameters('availabilitySetSettings').name]"
},
"resources": [
{
"type": "Microsoft.Compute/availabilitySets",
"apiVersion": "2015-06-15",
"name": "[variables('avSetName')]",
"location": "[resourceGroup().location]",
"properties": {
"platformFaultDomainCount": "[parameters('platformFaultDomainCount')]",
"platformUpdateDomainCount": "[parameters('platformUpdateDomainCount')]"
}
}
],
"outputs": {
"availabilitySetName": {
"value": "[variables('avSetName')]",
"type": "string"
}
}
}

Просмотреть файл

@ -0,0 +1,43 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"availabilitySetSettings": { "type": "object" },
"vmCount": { "type": "int" }
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('availabilitySetSettings')), parameters('vmCount')))]",
"index": "[mod(add(sub(parameters('vmCount'), 1), 2), add(sub(parameters('vmCount'), 1), 1))]",
"avSetTemplate": "[variables('avSetTemplates')[variables('index')]]",
"avSetTemplates": [
"[uri(deployment().properties.templateLink.uri, 'availabilitySet-empty.json')]",
"[uri(deployment().properties.templateLink.uri, 'availabilitySet-new.json')]"
],
"templateNamePart": [
"nop",
"new"
],
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-', variables('templateNamePart')[variables('index')], '-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('avSetTemplate')]" },
"parameters": {
"availabilitySetSettings": { "value": "[parameters('availabilitySetSettings')]" }
}
}
}
],
"outputs": {
"availabilitySetName": {
"value": "[reference(variables('deploymentName')).outputs.availabilitySetName.value]",
"type": "string"
}
}
}

Просмотреть файл

@ -0,0 +1,60 @@
#!/bin/bash
firstLine=true
routeTableIndex=2
while IFS= read -r line; do
if [[ "$firstLine" = true ]]
then
defaultGatewayIp=$(echo $line | awk '/default/ { print $3 }')
defaultGatewayIpPrefix=$(echo $defaultGatewayIp | awk -F: '{split($1,a,"."); print a[1]"."a[2]"."a[3];}')
firstLine=false
printf 'Default gateway: %s\n' "$defaultGatewayIp"
printf 'Default gateway prefix: %s\n' "$defaultGatewayIpPrefix"
fi
ethernetIp=$(echo $line | awk '/src/ { print $9 }')
if [[ ! -z $ethernetIp ]]
then
printf 'Ethernet ip: %s\n' "$ethernetIp"
ethernetIpPrefix=$(echo $ethernetIp | awk -F: '{split($1,arr,"."); print arr[1]"."arr[2]"."arr[3];}')
if [[ $ethernetIpPrefix != $defaultGatewayIpPrefix ]]
then
newGateway=${ethernetIpPrefix}".1"
interfaceType=$(echo $line | awk '{ print $2 }')
interfaceName=$(echo $line | awk '{ print $3 }')
printf 'New gateway to add: %s %s\n' "$newGateway" "$restOfSuffix"
# Add a new routing table
rTable="rt$routeTableIndex"
((routeTableIndex++))
echo "1 $rTable" >>/etc/iproute2/rt_tables
printf 'New route table: %s\n' "$rTable"
# Grab subnet address
#subnetIp=$(ip -o -f inet addr show | awk '/scope global eth1/ {print $4}')
subnetPrefix=$(echo $line | awk '{ print $1 }')
# Compose route commands
routeAddCommand1="ip route add $subnetPrefix $interfaceType $interfaceName src $ethernetIp table $rTable"
routeAddCommand2="ip route add default via $newGateway $interfaceType $interfaceName table $rTable"
# Compose rule commands
ruleAddCommand1="ip rule add from $ethernetIp/32 table $rTable"
ruleAddCommand2="ip rule add to $ethernetIp/32 table $rTable"
printf 'Commands to execute:\n'
printf '%s\n' "$routeAddCommand1"
printf '%s\n' "$routeAddCommand2"
printf '%s\n' "$ruleAddCommand1"
printf '%s\n' "$ruleAddCommand2"
eval $routeAddCommand1
eval $routeAddCommand2
eval $ruleAddCommand1
eval $ruleAddCommand2
fi
fi
done < <(ip route)

Просмотреть файл

@ -0,0 +1,4 @@
#!/bin/bash
sed -i "s/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/" /etc/sysctl.conf
sysctl -p /etc/sysctl.conf

Просмотреть файл

@ -0,0 +1,42 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachineSettings": {
"type": "object"
}
},
"variables": {
"extensionName": "extension-enable-ip-forwarding",
"templateName": "[concat(parameters('virtualMachineSettings').name, '-', variables('extensionName'))]",
"templateUri": "[uri(deployment().properties.templateLink.uri, '../extension-custom-script-for-linux.json')]",
"extensionSettings": {
"fileUris": [
"[uri(deployment().properties.templateLink.uri, 'enable-ip-forwarding.sh')]"
],
"commandToExecute": "sh enable-ip-forwarding.sh"
}
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('templateName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('templateUri')]" },
"parameters": {
"settings": {
"value": "[variables('extensionSettings')]"
}
}
}
}
],
"outputs": {
"properties": {
"type": "object",
"value": "[reference(variables('templateName')).outputs.properties.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,22 @@
#!/bin/bash
bash -c "echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf"
sysctl -p /etc/sysctl.conf
PRIVATE_IP_ADDRESS=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
PUBLIC_IP_ADDRESS=$(wget http://ipinfo.io/ip -qO -)
iptables -F
iptables -t nat -F
iptables -X
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.0.1.254:80
iptables -t nat -A POSTROUTING -p tcp -d 10.0.1.254 --dport 80 -j SNAT --to-source $PRIVATE_IP_ADDRESS
iptables -t nat -A POSTROUTING -p tcp -d 10.0.1.254 --dport 80 -j SNAT --to-source $PUBLIC_IP_ADDRESS
iptables -t nat -A PREROUTING -p tcp --dport 443 -j DNAT --to-destination 10.0.1.254:443
iptables -t nat -A POSTROUTING -p tcp -d 10.0.1.254 --dport 443 -j SNAT --to-source $PRIVATE_IP_ADDRESS
iptables -t nat -A POSTROUTING -p tcp -d 10.0.1.254 --dport 443 -j SNAT --to-source $PUBLIC_IP_ADDRESS
service ufw stop
service ufw start
DEBIAN_FRONTEND=noninteractive aptitude install -y -q iptables-persistent
/etc/init.d/iptables-persistent save
update-rc.d iptables-persistent defaults

Просмотреть файл

@ -0,0 +1,42 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachineSettings": {
"type": "object"
}
},
"variables": {
"extensionName": "extension-enable-iptables-routes",
"templateName": "[concat(parameters('virtualMachineSettings').name, '-', variables('extensionName'))]",
"templateUri": "[uri(deployment().properties.templateLink.uri, '../extension-custom-script-for-linux.json')]",
"extensionSettings": {
"fileUris": [
"[uri(deployment().properties.templateLink.uri, 'enable-ip-forwarding.sh')]"
],
"commandToExecute": "sh enable-iptables-routes.sh"
}
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('templateName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('templateUri')]" },
"parameters": {
"settings": {
"value": "[variables('extensionSettings')]"
}
}
}
}
],
"outputs": {
"properties": {
"type": "object",
"value": "[reference(variables('templateName')).outputs.properties.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,28 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"typeHandlerVersion": {
"type": "string",
"defaultValue": "1.4"
},
"settings": {
"type": "object"
}
},
"variables": {
},
"resources": [
],
"outputs": {
"properties": {
"type": "object",
"value": {
"publisher": "Microsoft.OSTCExtensions",
"type": "CustomScriptForLinux",
"typeHandlerVersion": "[parameters('typeHandlerVersion')]",
"settings": "[parameters('settings')]"
}
}
}
}

Просмотреть файл

@ -0,0 +1,28 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"typeHandlerVersion": {
"type": "string",
"defaultValue": "2.0"
},
"settings": {
"type": "object"
}
},
"variables": {
},
"resources": [
],
"outputs": {
"properties": {
"type": "object",
"value": {
"publisher": "Microsoft.OSTCExtensions",
"type": "OSPatchingForLinux",
"typeHandlerVersion": "[parameters('typeHandlerVersion')]",
"settings": "[parameters('settings')]"
}
}
}
}

Просмотреть файл

@ -0,0 +1,48 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"virtualMachineSettings": {
"type": "object"
},
"extensionSettings": {
"type": "object",
"defaultValue": {
"arguments": ""
}
}
},
"variables": {
"extensionName": "extension-jmeter-2.8",
"templateName": "[concat(parameters('virtualMachineSettings').name, '-', variables('extensionName'))]",
"templateUri": "[uri(deployment().properties.templateLink.uri, '../../extension-custom-script-for-linux.json')]",
"extensionSettings": {
"fileUris": [
"[uri(deployment().properties.templateLink.uri, 'install-jmeter-2.8.sh')]"
],
"commandToExecute": "[concat('bash install-jmeter-2.8.sh ', parameters('extensionSettings').arguments)]"
}
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('templateName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('templateUri')]" },
"parameters": {
"settings": {
"value": "[variables('extensionSettings')]"
}
}
}
}
],
"outputs": {
"properties": {
"type": "object",
"value": "[reference(variables('templateName')).outputs.properties.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,63 @@
#!/bin/bash
trap 'errhandle $LINENO $?' SIGINT ERR
errhandle()
{
echo "Error or Interruption at line ${1} exit code ${2} "
exit ${2}
}
LOCATION=centralus
IS_MASTER=0
REMOTE_HOSTS=""
while [[ $# > 0 ]]
do
key="$1"
case $key in
-m|--master)
IS_MASTER=1
;;
-r|--REMOTE_HOSTS)
REMOTE_HOSTS="$2"
shift
;;
*)
echo Unknown option "$1"
exit 1
;;
esac
shift
done
apt-get -y update
apt-get -y install jmeter
if [ ${IS_MASTER} -ne 1 ];
then
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 4441 -j ACCEPT
# Configure ports
sed -i "s/#client.rmi.localport=0/client.rmi.localport=4441/" /usr/share/jmeter/bin/jmeter.properties
sed -i "s/#server.rmi.localport=4000/server.rmi.localport=4440/" /usr/share/jmeter/bin/jmeter.properties
# Set the startup
cat << EOF > /etc/init/jmeter.conf
description "JMeter Service"
start on starting
script
/usr/share/jmeter/bin/jmeter-server
end script
EOF
service jmeter start
else
iptables -A INPUT -p tcp --match multiport --dports 4440:4445 -j ACCEPT
iptables -A OUTPUT -p tcp --match multiport --dports 4440:4445 -j ACCEPT
# Configure ports
sed -i "s/#client.rmi.localport=0/client.rmi.localport=4440/" /usr/share/jmeter/bin/jmeter.properties
sed -i "s/remote_hosts=127.0.0.1/remote_hosts=${REMOTE_HOSTS}/" /usr/share/jmeter/bin/jmeter.properties
fi

Просмотреть файл

@ -0,0 +1,22 @@
#
# enable_default_gateway.ps1
#
# Obtain the IP configuration for the NIC that doesn't has the default gateway enabled
$ipConfigs = Get-NetIPConfiguration | Where-Object -FilterScript {$_.IPv4DefaultGateway -eq $null}
if($ipConfigs -ne $null)
{
foreach($ipConfig in $ipConfigs)
{
$interfaceIndex = $ipConfig.InterfaceIndex
$ipAddress=$ipConfig.IPv4Address.IPAddress
# TODO: Verify with Telmo - Using the default IP address format of the NIC to construct gateway string
$gatewayAddress=$ipAddress.substring(0, $ipAddress.lastIndexOf('.') + 1) +'1'
New-NetRoute -DestinationPrefix '0.0.0.0/0' -InterfaceIndex $interfaceIndex -NextHop $gatewayAddress
}
}
# Tested the above implementation with a ping of external subnet address via the non primary NIC IP address
# Before running the script ping failed, however afterwards it worked. May require more testing but not
# sure right now!

Просмотреть файл

@ -0,0 +1,28 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"typeHandlerVersion": {
"type": "string",
"defaultValue": "2.8"
},
"settings": {
"type": "object"
}
},
"variables": {
},
"resources": [
],
"outputs": {
"properties": {
"type": "object",
"value": {
"publisher": "Microsoft.Powershell",
"type": "DSC",
"typeHandlerVersion": "[parameters('typeHandlerVersion')]",
"settings": "[parameters('settings')]"
}
}
}
}

Просмотреть файл

@ -0,0 +1,117 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "bbVM"
}
},
"virtualMachinesSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual machines"
}
},
"virtualNetworkSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual network"
}
},
"buildingBlockSettings": {
"type": "object",
"metadata": {
"description": "Settings for building block"
}
},
"context": {
"type": "object",
"metadata": {
"description": "Settings for other parameters such as load balancer backend pool, storage account names."
}
}
},
"variables": {
"location": "[resourceGroup().location]",
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualMachinesSettings')), string(parameters('virtualNetworkSettings')), string(parameters('buildingBlockSettings')), string(parameters('context')), resourceGroup().id))]",
"nVirtualMachinesTemplate": "[uri(deployment().properties.templateLink.uri, 'n-vm-n-nic.json')]",
"replicatorTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/replicator.json')]",
"vmIndexPerStorageDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-vmIndexPerStorage-', variables('templateUniqueString'))]",
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('vmIndexPerStorageDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('replicatorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-vmIndexPerStorage')]"
}
},
"source": { "value": { } },
"context": {
"value": {
"storageAccountsCount": "[parameters('buildingBlockSettings').storageAccountsCount]",
"vmCount": "[parameters('buildingBlockSettings').vmCount]"
}
},
"state": {
"value": [
{
"vmCount": 0,
"index": 0
}
]
},
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'vm-per-storage-helper.json')]" },
"copies": { "value": "[parameters('buildingBlockSettings').storageAccountsCount]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-vmsInSt', copyindex(), '-', variables('templateUniqueString'))]",
"copy": {
"name": "virtualMachinesSetIterator",
"count": "[parameters('buildingBlockSettings').storageAccountsCount]"
},
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('nVirtualMachinesTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-vmsInSt', copyindex())]"
}
},
"virtualMachinesSettings": { "value": "[parameters('virtualMachinesSettings')]" },
"virtualNetworkSettings": { "value": "[parameters('virtualNetworkSettings')]" },
"context": {
"value": {
"storageAccounts": {
"diagnostic": "[concat(parameters('context').storageAccounts.diagnostic, 1)]",
"vhd": "[concat(parameters('context').storageAccounts.vhd, copyIndex(1))]"
},
"availabilitySetName": "[parameters('context').availabilitySetName]",
"vmCount": "[reference(variables('vmIndexPerStorageDeploymentName')).outputs.result.value[copyindex(1)].vmCount]",
"deployedVMCount": "[reference(variables('vmIndexPerStorageDeploymentName')).outputs.result.value[copyindex(1)].index]",
"vmStartIndex": "[parameters('buildingBlockSettings').vmStartIndex]",
"iteration": "[copyindex()]"
}
}
}
}
}
],
"outputs": {
}
}

Просмотреть файл

@ -0,0 +1,104 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "nVM"
}
},
"virtualMachinesSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual machines"
}
},
"virtualNetworkSettings": {
"type": "object",
"metadata": {
"description": "Settings for virtual network"
}
},
"context": {
"type": "object",
"metadata": {
"description": "Settings for other parameters such as load balancer backend pool, storage account names."
}
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualMachinesSettings')), string(parameters('virtualNetworkSettings')), string(parameters('context'))))]",
"replicatorTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/replicator.json')]",
"singleVMTemplate": "[uri(deployment().properties.templateLink.uri, 'single-vm-n-nic.json')]",
"vmSettingsDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-vmSettings-', variables('templateUniqueString'))]",
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('vmSettingsDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('replicatorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-vmSettings')]"
}
},
"source": { "value": "[parameters('virtualMachinesSettings')]" },
"context": {
"value": {
"vnetName": "[parameters('virtualNetworkSettings').name]",
"vnetResourceGroup": "[parameters('virtualNetworkSettings').resourceGroup]",
"vmNamePrefix": "[parameters('virtualMachinesSettings').namePrefix]",
"vmNamePostFixStartIndex": "[add(parameters('context').vmStartIndex, parameters('context').deployedVMCount)]",
"deployedVMCount": "[parameters('context').deployedVMCount]",
"storageAccounts": {
"diagnostic": "[parameters('context').storageAccounts.diagnostic]",
"vhd": "[parameters('context').storageAccounts.vhd]"
},
"availabilitySetName": "[parameters('context').availabilitySetName]"
}
},
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'virtualMachines-settings.json')]" },
"copies": { "value": "[parameters('context').vmCount]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployVM', add(add(parameters('context').vmStartIndex, parameters('context').deployedVMCount), copyindex()), '-', variables('templateUniqueString'))]",
"apiVersion": "2015-01-01",
"copy": {
"name": "vmCount",
"count": "[parameters('context').vmCount]"
},
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('singleVMTemplate')]",
"contentVersion": "1.0.0.0"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployVM', add(add(parameters('context').vmStartIndex, parameters('context').deployedVMCount), copyindex()))]"
}
},
"virtualMachinesSetting": {
"value": "[reference(variables('vmSettingsDeploymentName')).outputs.result.value[copyindex()]]"
}
}
}
}
],
"outputs": {
"vmsettings": {
"type": "array",
"value": "[reference(variables('vmSettingsDeploymentName')).outputs.result.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,49 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"instance": [
{
"name": "[concat(parameters('context').vmName, '-nic', add(parameters('iteration') ,1))]",
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "dynamic",
"subnet": { "id": "[resourceId(parameters('context').vnetResourceGroup, 'Microsoft.Network/virtualNetworks/subnets', parameters('context').vnetName, parameters('source').subnetName)]" }
}
}
],
"primary": "[parameters('source').isPrimary]",
"enableIPForwarding": "[parameters('source').enableIPForwarding]",
"dnsSettings": {
"dnsServers": "[parameters('source').dnsServers]",
"appliedDnsServers": "[parameters('source').dnsServers]"
}
}
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[variables('instance')]"
}
}
}

Просмотреть файл

@ -0,0 +1,57 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"ipAddressArray": "[split(parameters('source').startingIPAddress, '.')]",
"updatedIPAddressInDecimal": "[add(add(add(mul(int(variables('ipAddressArray')[0]), 16777216), mul(int(variables('ipAddressArray')[1]), 65536)), add(mul(int(variables('ipAddressArray')[2]), 256), mul(int(variables('ipAddressArray')[3]), 1))), parameters('context').vmIndex)]",
"newIPAddress_part1": "[div(variables('updatedIPAddressInDecimal'), 16777216)]",
"newIPAddress_part2": "[div(mod(variables('updatedIPAddressInDecimal'), 16777216), 65536)]",
"newIPAddress_part3": "[div(mod(variables('updatedIPAddressInDecimal'), 65536), 256)]",
"newIPAddress_part4": "[div(mod(variables('updatedIPAddressInDecimal'), 256), 1)]",
"updatedIPAddressString": "[concat(string(variables('newIPAddress_part1')), '.', string(variables('newIPAddress_part2')), '.', string(variables('newIPAddress_part3')), '.', string(variables('newIPAddress_part4')))]",
"instance": [
{
"name": "[concat(parameters('context').vmName, '-nic', add(parameters('iteration'), 1))]",
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"privateIPAllocationMethod": "static",
"subnet": { "id": "[resourceId(parameters('context').vnetResourceGroup, 'Microsoft.Network/virtualNetworks/subnets', parameters('context').vnetName, parameters('source').subnetName)]" },
"privateIPAddress": "[variables('updatedIPAddressString')]"
}
}
],
"primary": "[parameters('source').isPrimary]",
"enableIPForwarding": "[parameters('source').enableIPForwarding]",
"dnsSettings": {
"dnsServers": "[parameters('source').dnsServers]",
"appliedDnsServers": "[parameters('source').dnsServers]"
}
}
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[variables('instance')]"
}
}
}

Просмотреть файл

@ -0,0 +1,79 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-publicDynamic-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"resources": [
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"name": "[concat(parameters('context').vmName, '-nic', add(parameters('iteration') , 1), '-pip')]",
"properties": {
"publicIPAllocationMethod": "[parameters('source').publicIPAllocationMethod]"
}
}
],
"outputs": {
"instance": {
"type": "array",
"value": [
{
"name": "[concat(parameters('context').vmName, '-nic', add(parameters('iteration') ,1))]",
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(parameters('context').vmName, '-nic', add(parameters('iteration') , 1), '-pip'))]" },
"privateIPAllocationMethod": "dynamic",
"subnet": { "id": "[resourceId(parameters('context').vnetResourceGroup, 'Microsoft.Network/virtualNetworks/subnets', parameters('context').vnetName, parameters('source').subnetName)]" }
}
}
],
"primary": "[parameters('source').isPrimary]",
"enableIPForwarding": "[parameters('source').enableIPForwarding]",
"dnsSettings": {
"dnsServers": "[parameters('source').dnsServers]",
"appliedDnsServers": "[parameters('source').dnsServers]"
}
}
]
}
}
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[reference(variables('deploymentName')).outputs.instance.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"ipAddressArray": "[split(parameters('source').startingIPAddress, '.')]",
"updatedIPAddressInDecimal": "[add(add(add(mul(int(variables('ipAddressArray')[0]), 16777216), mul(int(variables('ipAddressArray')[1]), 65536)), add(mul(int(variables('ipAddressArray')[2]), 256), mul(int(variables('ipAddressArray')[3]), 1))), parameters('context').vmIndex)]",
"newIPAddress_part1": "[div(variables('updatedIPAddressInDecimal'), 16777216)]",
"newIPAddress_part2": "[div(mod(variables('updatedIPAddressInDecimal'), 16777216), 65536)]",
"newIPAddress_part3": "[div(mod(variables('updatedIPAddressInDecimal'), 65536), 256)]",
"newIPAddress_part4": "[div(mod(variables('updatedIPAddressInDecimal'), 256), 1)]",
"updatedIPAddressString": "[concat(string(variables('newIPAddress_part1')), '.', string(variables('newIPAddress_part2')), '.', string(variables('newIPAddress_part3')), '.', string(variables('newIPAddress_part4')))]",
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-publicStatic-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"resources": [
{
"type": "Microsoft.Network/publicIPAddresses",
"apiVersion": "2016-03-30",
"location": "[resourceGroup().location]",
"name": "[concat(parameters('context').vmName, '-nic', add(parameters('iteration') , 1), '-pip')]",
"properties": {
"publicIPAllocationMethod": "[parameters('source').publicIPAllocationMethod]"
}
}
],
"outputs": {
"instance": {
"type": "array",
"value": [
{
"name": "[concat(parameters('context').vmName, '-nic', add(parameters('iteration') ,1))]",
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses', concat(parameters('context').vmName, '-nic', add(parameters('iteration') , 1), '-pip'))]" },
"privateIPAllocationMethod": "static",
"subnet": { "id": "[resourceId(parameters('context').vnetResourceGroup, 'Microsoft.Network/virtualNetworks/subnets', parameters('context').vnetName, parameters('source').subnetName)]" },
"privateIPAddress": "[variables('updatedIPAddressString')]"
}
}
],
"primary": "[parameters('source').isPrimary]",
"enableIPForwarding": "[parameters('source').enableIPForwarding]",
"dnsSettings": {
"dnsServers": "[parameters('source').dnsServers]",
"appliedDnsServers": "[parameters('source').dnsServers]"
}
}
]
}
}
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[reference(variables('deploymentName')).outputs.instance.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,85 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"virtualMachinesSetting": {
"type": "object",
"metadata": {
"description": "Settings for virtual machines."
}
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualMachinesSetting'))))]",
"location": "[resourceGroup().location]",
"collectorTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/collector.json')]",
"nicsDeployment": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployNics-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('nicsDeployment')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('collectorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployNics')]"
}
},
"source": { "value": "[parameters('virtualMachinesSetting').nics]" },
"context": { "value": { } },
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'virtualMachine-nic.json')]" }
}
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('virtualMachinesSetting').vmName]",
"location": "[variables('location')]",
"tags": { "displayName": "VM" },
"dependsOn": [
"[concat('Microsoft.Resources/deployments/', variables('nicsDeployment'))]"
],
"properties": {
"availabilitySet": { "id": "[resourceId('Microsoft.Compute/availabilitySets', parameters('virtualMachinesSetting').availabilitySetName)]" },
"hardwareProfile": { "vmSize": "[parameters('virtualMachinesSetting').size]" },
"osProfile": {
"computerName": "[parameters('virtualMachinesSetting').computerName]",
"adminUsername": "[parameters('virtualMachinesSetting').adminUsername]",
"adminPassword": "[parameters('virtualMachinesSetting').adminPassword]",
"[concat(toLower(parameters('virtualMachinesSetting').osType), 'Configuration')]": "[parameters('virtualMachinesSetting')[concat(toLower(parameters('virtualMachinesSetting').osType), 'Configuration')]]"
},
"storageProfile": {
"imageReference": {
"publisher": "[parameters('virtualMachinesSetting').imageReference.publisher]",
"offer": "[parameters('virtualMachinesSetting').imageReference.offer]",
"sku": "[parameters('virtualMachinesSetting').imageReference.sku]",
"version": "[parameters('virtualMachinesSetting').imageReference.version]"
},
"osDisk": {
"name": "[parameters('virtualMachinesSetting').osDisk.name]",
"vhd": { "uri": "[parameters('virtualMachinesSetting').osDisk.vhd.uri]" },
"caching": "[parameters('virtualMachinesSetting').osDisk.caching]",
"createOption": "[parameters('virtualMachinesSetting').osDisk.createOption]"
},
"dataDisks": "[parameters('virtualMachinesSetting').dataDisks]"
},
"networkProfile": {
"networkInterfaces": "[reference(concat('Microsoft.Resources/deployments/', variables('nicsDeployment'))).outputs.result.value]"
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": "true",
"storageUri": "[parameters('virtualMachinesSetting').diagnosticsStorageUri]"
}
}
}
}
]
}

Просмотреть файл

@ -0,0 +1,84 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"virtualMachinesSetting": {
"type": "object",
"metadata": {
"description": "Settings for virtual machines."
}
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualMachinesSetting'))))]",
"location": "[resourceGroup().location]",
"collectorTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/collector.json')]",
"nicsDeployment": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployNics-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('nicsDeployment')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('collectorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-deployNics')]"
}
},
"source": { "value": "[parameters('virtualMachinesSetting').nics]" },
"context": { "value": { } },
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'virtualMachine-nic.json')]" }
}
}
},
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Compute/virtualMachines",
"name": "[parameters('virtualMachinesSetting').vmName]",
"location": "[variables('location')]",
"tags": { "displayName": "VM" },
"dependsOn": [
"[concat('Microsoft.Resources/deployments/', variables('nicsDeployment'))]"
],
"properties": {
"hardwareProfile": { "vmSize": "[parameters('virtualMachinesSetting').size]" },
"osProfile": {
"computerName": "[parameters('virtualMachinesSetting').computerName]",
"adminUsername": "[parameters('virtualMachinesSetting').adminUsername]",
"adminPassword": "[parameters('virtualMachinesSetting').adminPassword]",
"[concat(toLower(parameters('virtualMachinesSetting').osType), 'Configuration')]": "[parameters('virtualMachinesSetting')[concat(toLower(parameters('virtualMachinesSetting').osType), 'Configuration')]]"
},
"storageProfile": {
"imageReference": {
"publisher": "[parameters('virtualMachinesSetting').imageReference.publisher]",
"offer": "[parameters('virtualMachinesSetting').imageReference.offer]",
"sku": "[parameters('virtualMachinesSetting').imageReference.sku]",
"version": "[parameters('virtualMachinesSetting').imageReference.version]"
},
"osDisk": {
"name": "[parameters('virtualMachinesSetting').osDisk.name]",
"vhd": { "uri": "[parameters('virtualMachinesSetting').osDisk.vhd.uri]" },
"caching": "[parameters('virtualMachinesSetting').osDisk.caching]",
"createOption": "[parameters('virtualMachinesSetting').osDisk.createOption]"
},
"dataDisks": "[parameters('virtualMachinesSetting').dataDisks]"
},
"networkProfile": {
"networkInterfaces": "[reference(concat('Microsoft.Resources/deployments/', variables('nicsDeployment'))).outputs.result.value]"
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": "true",
"storageUri": "[parameters('virtualMachinesSetting').diagnosticsStorageUri]"
}
}
}
}
]
}

Просмотреть файл

@ -0,0 +1,50 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object",
"defaultValue": {
"parentTemplateUniqueString": "singleVM"
}
},
"virtualMachinesSetting": {
"type": "object",
"metadata": {
"description": "Settings for virtual machines."
}
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualMachinesSetting'))))]",
"avSetTemplates": [
"[uri(deployment().properties.templateLink.uri, 'single-vm-n-nic-no-avset.json')]",
"[uri(deployment().properties.templateLink.uri, 'single-vm-n-nic-avset.json')]"
],
"templateToInvoke": "[variables('avSetTemplates')[mod(add(length(parameters('virtualMachinesSetting').availabilitySetName), 2), add(length(parameters('virtualMachinesSetting').availabilitySetName), 1))]]",
"deploymentSuffixes": [
"noAvSet",
"inAvSet"
],
"suffixToUse": "[variables('deploymentSuffixes')[mod(add(length(parameters('virtualMachinesSetting').availabilitySetName), 2), add(length(parameters('virtualMachinesSetting').availabilitySetName), 1))]]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-', variables('suffixToUse'), '-', variables('templateUniqueString'))]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('templateToInvoke')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-', variables('suffixToUse'))]"
}
},
"virtualMachinesSetting": { "value": "[parameters('virtualMachinesSetting')]" }
}
}
}
]
}

Просмотреть файл

@ -0,0 +1,22 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"source": {
"type": "object"
}
},
"variables": {
},
"resources": [
],
"outputs": {
"result": {
"type": "object",
"value": {
"adminPassword": "[parameters('source').adminPassword]",
"configuration": null
}
}
}
}

Просмотреть файл

@ -0,0 +1,32 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"source": {
"type": "object"
}
},
"variables": {
},
"resources": [
],
"outputs": {
"result": {
"type": "object",
"value": {
"adminPassword": null,
"configuration": {
"disablePasswordAuthentication": "true",
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('source').adminUsername, '/.ssh/authorized_keys')]",
"keyData": "[parameters('source').sshPublicKey]"
}
]
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,42 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": {
"type": "object"
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source'))))]",
"configurationTemplate": {
"password": "[uri(deployment().properties.templateLink.uri, 'virtualMachine-configuration-settings-linux-password.json')]",
"ssh": "[uri(deployment().properties.templateLink.uri, 'virtualMachine-configuration-settings-linux-ssh.json')]"
},
"configurationTemplateName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-', parameters('source').osAuthenticationType, '-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('configurationTemplateName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('configurationTemplate')[parameters('source').osAuthenticationType]]"
},
"parameters": {
"source": {
"value": "[parameters('source')]"
}
}
}
}
],
"outputs": {
"result": {
"type": "object",
"value": "[reference(variables('configurationTemplateName')).outputs.result.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,23 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": {
"type": "object"
}
},
"variables": {
},
"resources": [
],
"outputs": {
"result": {
"type": "object",
"value": {
"adminPassword": "[parameters('source').adminPassword]",
"configuration": null
}
}
}
}

Просмотреть файл

@ -0,0 +1,37 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"instance": [
{
"name": "[concat('dataDisk', add(parameters('iteration'), 1))]",
"diskSizeGB": "[parameters('source').diskSizeGB]",
"lun": "[parameters('iteration')]",
"vhd": { "uri": "[concat('http://', parameters('context').storageAccounts.vhd, '.blob.core.windows.net/vhds/', parameters('context').vmName, '-dataDisk', add(parameters('iteration'), 1), '.vhd')]" },
"caching": "[parameters('source').caching]",
"createOption": "[parameters('source').createOption]"
}
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), variables('instance'))]"
}
}
}

Просмотреть файл

@ -0,0 +1,71 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-nic', parameters('iteration'), '-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"resources": [
{
"apiVersion": "2016-03-30",
"type": "Microsoft.Network/networkInterfaces",
"name": "[parameters('source').name]",
"location": "[resourceGroup().location]",
"properties": {
"ipConfigurations": "[parameters('source').ipConfigurations]",
"enableIPForwarding": "[parameters('source').enableIPForwarding]",
"dnsSettings": "[parameters('source').dnsSettings]"
},
"tags": {
"displayName": "nic"
}
}
],
"outputs": {
"instance": {
"type": "array",
"value": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('source').name)]",
"properties": {
"primary": "[parameters('source').primary]"
}
}
]
}
}
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), reference(variables('deploymentName')).outputs.instance.value)]"
}
}
}

Просмотреть файл

@ -0,0 +1,59 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"nicTemplate": {
"false": {
"static": "[uri(deployment().properties.templateLink.uri, 'private-static-nics-settings.json')]",
"dynamic": "[uri(deployment().properties.templateLink.uri, 'private-dynamic-nics-settings.json')]"
},
"true": {
"static": "[uri(deployment().properties.templateLink.uri, 'public-nic-static-private-settings.json')]",
"dynamic": "[uri(deployment().properties.templateLink.uri, 'public-nic-dynamic-private-settings.json')]"
}
},
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-nicSetting-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('nicTemplate')[parameters('source').isPublic][parameters('source').privateIPAllocationMethod]]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-nicSetting')]"
}
},
"source": { "value": "[parameters('source')]" },
"context": { "value": "[parameters('context')]" },
"state": { "value": "[parameters('state')]" },
"iteration": { "value": "[parameters('iteration')]" }
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), reference(variables('deploymentName')).outputs.collection.value)]"
}
}
}

Просмотреть файл

@ -0,0 +1,157 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"replicatorTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/replicator.json')]",
"collectorTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/collector.json')]",
"storageAccountContainerName": "vhds",
"vmName": "[concat(parameters('context').vmNamePrefix, '-vm', add(parameters('context').vmNamePostFixStartIndex, parameters('iteration')))]",
"computerName": "[concat(parameters('source').computerNamePrefix, add(parameters('context').vmNamePostFixStartIndex, parameters('iteration')))]",
"osSettingDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-osSetting-', variables('templateUniqueString'))]",
"nicSettingDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-nicSettings-', variables('templateUniqueString'))]",
"dataDiskSettingDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-dataDiskSettings-', variables('templateUniqueString'))]",
"vmSettingDeploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-vmSetting-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('osSettingDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[uri(deployment().properties.templateLink.uri, concat('virtualMachine-configuration-settings-', toLower(parameters('source').osType), '.json'))]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-osSetting')]"
}
},
"source": {
"value": "[parameters('source')]"
}
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('nicSettingDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('collectorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-nicSettings')]"
}
},
"source": { "value": "[parameters('source').nics]" },
"context": {
"value": {
"vnetName": "[parameters('context').vnetName]",
"vnetResourceGroup": "[parameters('context').vnetResourceGroup]",
"vmName": "[variables('vmName')]",
"vmIndex": "[add(parameters('iteration'), parameters('context').deployedVMCount)]"
}
},
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'virtualMachines-nics-settings.json')]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('dataDiskSettingDeploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('replicatorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-dataDiskSettings')]"
}
},
"source": { "value": "[parameters('source').dataDisks.properties]" },
"context": {
"value": {
"vnetName": "[parameters('context').vnetName]",
"storageAccounts": "[parameters('context').storageAccounts]",
"vmName": "[variables('vmName')]",
"vmIndex": "[parameters('iteration')]"
}
},
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'virtualMachine-datadisk.json')]" },
"copies": { "value": "[parameters('source').dataDisks.count]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('vmSettingDeploymentName')]",
"properties": {
"mode": "Incremental",
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"resources": [ ],
"outputs": {
"instance": {
"type": "array",
"value": [
{
"vmName": "[variables('vmName')]",
"computerName": "[variables('computerName')]",
"availabilitySetName": "[parameters('context').availabilitySetName]",
"size": "[parameters('source').size]",
"adminUsername": "[parameters('source').adminUsername]",
"adminPassword": "[reference(variables('osSettingDeploymentName')).outputs.result.value.adminPassword]",
"osType": "[toLower(parameters('source').osType)]",
"[concat(toLower(parameters('source').osType), 'Configuration')]": "[reference(variables('osSettingDeploymentName')).outputs.result.value.configuration]",
"nics": "[reference(variables('nicSettingDeploymentName')).outputs.result.value]",
"imageReference": {
"publisher": "[parameters('source').imageReference.publisher]",
"offer": "[parameters('source').imageReference.offer]",
"sku": "[parameters('source').imageReference.sku]",
"version": "[parameters('source').imageReference.version]"
},
"osDisk": {
"name": "[concat(variables('vmName'), '-os.vhd')]",
"vhd": { "uri": "[concat('http://', parameters('context').storageAccounts.vhd, '.blob.core.windows.net/', variables('storageAccountContainerName'), '/', concat(variables('vmName'), '-os.vhd'))]" },
"createOption": "FromImage",
"caching": "[parameters('source').osDisk.caching]"
},
"dataDisks": "[reference(variables('dataDiskSettingDeploymentName')).outputs.result.value]",
"diagnosticsStorageUri": "[concat('http://', parameters('context').storageAccounts.diagnostic, '.blob.core.windows.net')]"
}
]
}
}
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), reference(variables('vmSettingDeploymentName')).outputs.instance.value)]"
}
}
}

Просмотреть файл

@ -0,0 +1,38 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"minVMPerGroup": "[div(parameters('context').vmCount, parameters('context').storageAccountsCount)]",
"vmsToAdjust": "[mod(parameters('context').vmCount, parameters('context').storageAccountsCount)]",
"vmInIteration": "[add(variables('minVMPerGroup'), div(sub(add(variables('vmsToAdjust'), parameters('context').storageAccountsCount), add(parameters('iteration'), 1)), parameters('context').storageAccountsCount))]",
"instance": [
{
"vmCount": "[variables('vmInIteration')]",
"index": "[add(parameters('state')[parameters('iteration')].vmCount, parameters('state')[parameters('iteration')].index)]"
}
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), variables('instance'))]"
}
}
}

Просмотреть файл

@ -0,0 +1,27 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connectionSettings": {
"type": "object"
}
},
"variables": {
},
"resources": [ ],
"outputs": {
"properties": {
"type": "object",
"value": {
"connectionType": "ExpressRoute",
"routingWeight": 10,
"virtualNetworkGateway1": {
"id": "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('connectionSettings').virtualNetworkGateway1.name)]"
},
"peer": {
"id": "[resourceId('Microsoft.Network/expressRouteCircuits', parameters('connectionSettings').expressRouteCircuit.name)]"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,41 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connectionSettings": {
"type": "object"
}
},
"variables": {
},
"resources": [
{
"apiVersion": "2016-03-30",
"type": "Microsoft.Network/localNetworkGateways",
"name": "[parameters('connectionSettings').localNetworkGateway.name]",
"location": "[resourceGroup().location]",
"properties": {
"localNetworkAddressSpace": {
"addressPrefixes": "[parameters('connectionSettings').localNetworkGateway.addressPrefixes]"
},
"gatewayIpAddress": "[parameters('connectionSettings').localNetworkGateway.ipAddress]"
}
}
],
"outputs": {
"properties": {
"type": "object",
"value": {
"connectionType": "IPsec",
"routingWeight": 10,
"sharedKey": "[parameters('connectionSettings').sharedKey]",
"virtualNetworkGateway1": {
"id": "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('connectionSettings').virtualNetworkGateway1.name)]"
},
"localNetworkGateway2": {
"id": "[resourceId('Microsoft.Network/localNetworkGateways', parameters('connectionSettings').localNetworkGateway.name)]"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,29 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connectionSettings": {
"type": "object"
}
},
"variables": {
},
"resources": [
],
"outputs": {
"properties": {
"type": "object",
"value": {
"connectionType": "Vnet2Vnet",
"routingWeight": 10,
"sharedKey": "[parameters('connectionSettings').sharedKey]",
"virtualNetworkGateway1": {
"id": "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('connectionSettings').virtualNetworkGateway1.name)]"
},
"virtualNetworkGateway2": {
"id": "[resourceId('Microsoft.Network/virtualNetworkGateways', parameters('connectionSettings').virtualNetworkGateway2.name)]"
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,47 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"connectionSettings": {
"type": "object"
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('connectionSettings'))))]",
"templates": {
"IPsec": "connection-IPsec.json",
"Vnet2Vnet": "connection-Vnet2Vnet.json",
"ExpressRoute": "connection-ExpressRoute.json"
},
"connectionTemplate": "[uri(deployment().properties.templateLink.uri, variables('templates')[parameters('connectionSettings').connectionType])]",
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-', parameters('connectionSettings').name, '-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('connectionTemplate')]"
},
"parameters": {
"connectionSettings": {
"value": "[parameters('connectionSettings')]"
}
}
}
},
{
"apiVersion": "2016-03-30",
"name": "[parameters('connectionSettings').name]",
"type": "Microsoft.Network/connections",
"location": "[resourceGroup().location]",
"properties": "[reference(variables('deploymentName')).outputs.properties.value]"
}
],
"outputs": {
}
}

Просмотреть файл

@ -0,0 +1,37 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": {
"type": "object"
},
"expressRouteCircuitSettings": {
"type": "object"
}
},
"variables": {
},
"resources": [
{
"type": "Microsoft.Network/expressRouteCircuits",
"apiVersion": "2016-03-30",
"name": "[parameters('expressRouteCircuitSettings').name]",
"location": "[resourceGroup().location]",
"sku": {
"name": "[concat(parameters('expressRouteCircuitSettings').skuTier, '_', parameters('expressRouteCircuitSettings').skuFamily)]",
"tier": "[parameters('expressRouteCircuitSettings').skuTier]",
"family": "[parameters('expressRouteCircuitSettings').skuFamily]"
},
"properties": {
"serviceProviderProperties": {
"serviceProviderName": "[parameters('expressRouteCircuitSettings').serviceProviderName]",
"peeringLocation": "[parameters('expressRouteCircuitSettings').peeringLocation]",
"bandwidthInMbps": "[parameters('expressRouteCircuitSettings').bandwidthInMbps]"
},
"allowClassicOperations": "[parameters('expressRouteCircuitSettings').allowClassicOperations]"
}
}
],
"outputs": {
}
}

Просмотреть файл

@ -0,0 +1,150 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"virtualMachinesSettings": { "type": "object" },
"vnetName": { "type": "string" },
"vmStartIndex": { "type": "int" },
"vmCount": { "type": "int" },
"loadBalancerSettings": { "type": "object" }
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualMachinesSettings')), parameters('vnetName'), parameters('vmStartIndex'), parameters('vmCount'), string(parameters('loadBalancerSettings'))))]",
"collectorTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/collector.json')]",
"replicatorTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/replicator.json')]",
"updateNicsTemplate": "[uri(deployment().properties.templateLink.uri, 'lb-update-nics.json')]",
"emptyNicArrayTemplate": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-emptyNicArray-', variables('templateUniqueString'))]",
"emptyVMNicArrayTemplate": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-emptyVMNicArray-', variables('templateUniqueString'))]",
"expandedNatRulesArrayTemplate": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-natRulesArray-', variables('templateUniqueString'))]",
"nicBepArrayTemplate": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-nicBepArray-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('emptyNicArrayTemplate')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('replicatorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString') , '-emptyNicArray')]"
}
},
"source": { "value": { } },
"context": { "value": { } },
"copies": { "value": "[length(parameters('virtualMachinesSettings').nics)]" },
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'lb-empty-nic-array-helper.json')]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('nicBepArrayTemplate')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('collectorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString') , '-nicBepArray')]"
}
},
"source": { "value": "[parameters('loadBalancerSettings').backendPools]" },
"context": {
"value": {
"loadBalancerName": "[parameters('loadBalancerSettings').name]"
}
},
"state": { "value": "[reference(variables('emptyNicArrayTemplate')).outputs.result.value]" },
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'lb-nic-backendPools-array-helper.json')]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('emptyVMNicArrayTemplate')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('replicatorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString') , '-emptyVMNicArray')]"
}
},
"source": { "value": { } },
"context": { "value": { } },
"copies": { "value": "[mul(length(parameters('virtualMachinesSettings').nics), parameters('vmCount'))]" },
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'lb-empty-nic-array-helper.json')]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('expandedNatRulesArrayTemplate')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('collectorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString') , '-natRulesArray')]"
}
},
"source": { "value": "[parameters('loadBalancerSettings').inboundNatRules]" },
"context": {
"value": {
"loadBalancerName": "[parameters('loadBalancerSettings').name]",
"vmCount": "[parameters('vmCount')]",
"nicCount": "[length(parameters('virtualMachinesSettings').nics)]",
"vmStartIndex": "[parameters('vmStartIndex')]"
}
},
"state": { "value": "[reference(variables('emptyVMNicArrayTemplate')).outputs.result.value]" },
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'lb-nic-natRuleArray-helper.json')]" }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-updateVM', copyindex(), '-', variables('templateUniqueString'))]",
"copy": {
"name": "VMCount",
"count": "[parameters('vmCount')]"
},
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('updateNicsTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString') , '-updateVM', copyindex())]"
}
},
"virtualMachinesSettings": { "value": "[parameters('virtualMachinesSettings')]" },
"vmStartIndex": { "value": "[parameters('vmStartIndex')]" },
"vmCount": { "value": "[parameters('vmCount')]" },
"loadBalancerBackendAddressPools": { "value": "[reference(variables('nicBepArrayTemplate')).outputs.result.value]" },
"loadBalancerNatRules": { "value": "[reference(variables('expandedNatRulesArrayTemplate')).outputs.result.value]" },
"vmIndex": { "value": "[add(copyindex(), parameters('vmStartIndex'))]" },
"vnetName": { "value": "[parameters('vnetName')]" }
}
}
}
],
"outputs": {
"result": {
"type": "array",
"value": "[reference(variables('nicBepArrayTemplate')).outputs.result.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,34 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"instance": [
{
"name": "[parameters('source').name]"
}
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), variables('instance'))]"
}
}
}

Просмотреть файл

@ -0,0 +1,32 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"instance": [
[ ]
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), variables('instance'))]"
}
}
}

Просмотреть файл

@ -0,0 +1,36 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"instance": [
{
"name": "[parameters('source').name]",
"properties": {
"privateIPAllocationMethod": "Static",
"privateIPAddress": "[parameters('source').internalLoadBalancerSettings.privateIPAddress]",
"subnet": { "id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('context').vetName, parameters('source').internalLoadBalancerSettings.subnetName)]" }
}
}
]
},
"resources": [],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), variables('instance'))]"
}
}
}

Просмотреть файл

@ -0,0 +1,70 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"publicIpAddressName": "[concat(parameters('source').name, parameters('iteration'), '-pip')]",
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-deployPIP-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"parameters": { },
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"variables": { },
"resources": [
{
"apiVersion": "2016-03-30",
"type": "Microsoft.Network/publicIPAddresses",
"name": "[variables('publicIpAddressName')]",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "Dynamic"
}
}
],
"outputs": {
"instance": {
"type": "array",
"value": [
{
"name": "[parameters('source').name]",
"properties": {
"privateIPAllocationMethod": "Dynamic",
"publicIPAddress": { "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIpAddressName'))]" }
}
}
]
}
}
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), reference(variables('deploymentName')).outputs.instance.value)]"
}
}
}

Просмотреть файл

@ -0,0 +1,54 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"ipConfigurations": {
"public": "[uri(deployment().properties.templateLink.uri, 'lb-frontendIPConfiguration-public.json')]",
"internal": "[uri(deployment().properties.templateLink.uri, 'lb-frontendIPConfiguration-internal.json')]"
},
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-config', parameters('iteration'), '-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('ipConfigurations')[parameters('source').loadBalancerType]]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString') , '-config', parameters('iteration'))]"
}
},
"source": { "value": "[parameters('source')]" },
"context": { "value": "[parameters('context')]" },
"state": { "value": "[parameters('state')]" },
"iteration": { "value": "[parameters('iteration')]" }
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), reference(variables('deploymentName')).outputs.collection.value)]"
}
}
}

Просмотреть файл

@ -0,0 +1,41 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"frontendIPConfiguration": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', parameters('context').loadBalancerName, parameters('source').frontendIPConfigurationName)]",
"instance": [
{
"name": "[concat(parameters('source').namePrefix, '-vm', add(parameters('iteration'), parameters('context').buildingBlockSettings.vmStartIndex))]",
"properties": {
"frontendIPConfiguration": { "id": "[variables('frontendIPConfiguration')]" },
"frontendPort": "[add(parameters('source').startingFrontendPort, parameters('iteration'))]",
"backendPort": "[parameters('source').backendPort]",
"protocol": "[parameters('source').protocol]",
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4
}
}
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), variables('instance'))]"
}
}
}

Просмотреть файл

@ -0,0 +1,54 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"frontendIPConfiguration": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', parameters('context').loadBalancerName, parameters('source').frontendIPConfigurationName)]",
"replicatorTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/replicator.json')]",
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-natRuleAll-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('replicatorTemplate')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-natRuleAll')]"
}
},
"source": { "value": "[parameters('source')]" },
"context": { "value": "[parameters('context')]" },
"state": { "value": [ ] },
"copies": { "value": "[parameters('context').buildingBlockSettings.vmCount]" },
"mapperTemplateUri": { "value": "[uri(deployment().properties.templateLink.uri, 'lb-inboundNatRules-all-settings.json')]" }
}
}
}
],
"outputs": {
"instance": {
"type": "array",
"value": "[reference(variables('deploymentName')).outputs.result.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,40 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"frontendIPConfiguration": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', parameters('context').loadBalancerName, parameters('source').frontendIPConfigurationName)]",
},
"resources": [
],
"outputs": {
"instance": {
"type": "array",
"value": [
{
"name": "[concat(parameters('source').namePrefix, '-vm', add(parameters('source').vmIndex, parameters('context').buildingBlockSettings.vmStartIndex))]",
"properties": {
"frontendIPConfiguration": { "id": "[variables('frontendIPConfiguration')]" },
"frontendPort": "[parameters('source').frontendPort]",
"backendPort": "[parameters('source').frontendPort]",
"protocol": "[parameters('source').protocol]",
"enableFloatingIP": true,
"idleTimeoutInMinutes": 4
}
}
]
}
}
}

Просмотреть файл

@ -0,0 +1,40 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"frontendIPConfiguration": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', parameters('context').loadBalancerName, parameters('source').frontendIPConfigurationName)]",
},
"resources": [
],
"outputs": {
"instance": {
"type": "array",
"value": [
{
"name": "[concat(parameters('source').namePrefix, '-vm', add(parameters('source').vmIndex, parameters('context').buildingBlockSettings.vmStartIndex))]",
"properties": {
"frontendIPConfiguration": { "id": "[variables('frontendIPConfiguration')]" },
"frontendPort": "[parameters('source').frontendPort]",
"backendPort": "[parameters('source').backendPort]",
"protocol": "[parameters('source').protocol]",
"enableFloatingIP": false,
"idleTimeoutInMinutes": 4
}
}
]
}
}
}

Просмотреть файл

@ -0,0 +1,54 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"natRuleTypeTemplates": {
"all": "[uri(deployment().properties.templateLink.uri, 'lb-inboundNatRules-all.json')]",
"single": "[uri(deployment().properties.templateLink.uri, 'lb-inboundNatRules-single-settings.json')]",
"floatingip": "[uri(deployment().properties.templateLink.uri, 'lb-inboundNatRules-floatingIp-settings.json')]"
},
"deploymentName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-natRuleType', parameters('iteration'), '-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('natRuleTypeTemplates')[tolower(parameters('source').natRuleType)]]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString') , '-natRuleType', parameters('iteration'))]"
}
},
"source": { "value": "[parameters('source')]" },
"context": { "value": "[parameters('context')]" },
"state": { "value": "[parameters('state')]" },
"iteration": { "value": "[parameters('iteration')]" }
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), reference(variables('deploymentName')).outputs.instance.value)]"
}
}
}

Просмотреть файл

@ -0,0 +1,43 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"frontendIPConfiguration": "[resourceId('Microsoft.Network/loadBalancers/frontendIPConfigurations', parameters('context').loadBalancerName, parameters('source').frontendIPConfigurationName)]",
"backendAddressPoolId": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', parameters('context').loadBalancerName, parameters('source').backendPoolName)]",
"instance": [
{
"name": "[parameters('source').name]",
"properties": {
"frontendIPConfiguration": { "id": "[variables('frontendIPConfiguration')]" },
"backendAddressPool": { "id": "[variables('backendAddressPoolId')]" },
"frontendPort": "[parameters('source').frontendPort]",
"backendPort": "[parameters('source').backendPort]",
"protocol": "[parameters('source').protocol]"
}
}
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), variables('instance'))]"
}
}
}

Просмотреть файл

@ -0,0 +1,37 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"nicBackendPools": "[parameters('state')[parameters('source').nicIndex]]",
"backendPoolId": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/backendAddressPools', parameters('context').loadBalancerName, parameters('source').name)]"
}
],
"updatedBackendPools": [
"[concat(variables('nicBackendPools'), variables('backendPoolId'))]"
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(take(parameters('state'), parameters('source').nicIndex), variables('updatedBackendPools'), skip(parameters('state'), add(parameters('source').nicIndex, 1)))]"
}
}
}

Просмотреть файл

@ -0,0 +1,55 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"natRuleTypeTemplates": {
"all": "[uri(deployment().properties.templateLink.uri, 'lb-nic-natRuleArray-processTypeAll.json')]",
"single": "[uri(deployment().properties.templateLink.uri, 'lb-nic-natRuleArray-update.json')]",
"floatingip": "[uri(deployment().properties.templateLink.uri, 'lb-nic-natRuleArray-update.json')]"
},
"deploymentTemplateName": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-rule', parameters('iteration'), '-', variables('templateUniqueString'))]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[variables('deploymentTemplateName')]",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('natRuleTypeTemplates')[tolower(parameters('source').natRuleType)]]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-rule', parameters('iteration'))]"
}
},
"source": { "value": "[parameters('source')]" },
"context": { "value": "[parameters('context')]" },
"state": { "value": "[parameters('state')]" },
"iteration": { "value": "[parameters('iteration')]" }
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[reference(variables('deploymentTemplateName')).outputs.collection.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,91 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('source')), string(parameters('context')), string(parameters('state')), parameters('iteration')))]",
"updateNatRulesArrayUri": "[uri(deployment().properties.templateLink.uri, 'lb-nic-natRuleArray-update.json')]"
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-nics0-', variables('templateUniqueString'))]",
"properties": {
"mode": "Incremental",
"parameters": { },
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"variables": { },
"resources": [ ],
"outputs": {
"collection": {
"type": "array",
"value": "[parameters('state')]"
}
}
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-nics', copyindex(1), '-', variables('templateUniqueString'))]",
"dependsOn": [
"[concat('Microsoft.Resources/deployments/', parameters('deploymentContext').parentTemplateUniqueString, '-nics', copyindex(), '-', variables('templateUniqueString'))]"
],
"copy": {
"name": "iterator",
"count": "[parameters('context').vmCount]"
},
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('updateNatRulesArrayUri')]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString') , '-nics', copyindex(1))]"
}
},
"source": {
"value": {
"namePrefix": "[parameters('source').namePrefix]",
"frontendIPConfigurationName": "[parameters('source').frontendIPConfigurationName]",
"startingFrontendPort": "[parameters('source').startingFrontendPort]",
"backendPort": "[parameters('source').backendPort]",
"natRuleType": "[parameters('source').natRuleType]",
"protocol": "[parameters('source').protocol]",
"vmIndex": "[copyindex()]",
"nicIndex": "[parameters('source').nicIndex]"
}
},
"context": { "value": "[parameters('context')]" },
"state": { "value": "[reference(concat(parameters('deploymentContext').parentTemplateUniqueString, '-nics', copyindex(), '-', variables('templateUniqueString'))).outputs.collection.value]" },
"iteration": { "value": "[parameters('iteration')]" }
}
}
}
],
"outputs": {
"collection": {
"type": "array",
"value": "[reference(concat(parameters('deploymentContext').parentTemplateUniqueString, '-nics', parameters('context').vmCount, '-', variables('templateUniqueString'))).outputs.collection.value]"
}
}
}

Просмотреть файл

@ -0,0 +1,39 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"deployedVMIndex": "[add(parameters('source').vmIndex, parameters('context').vmStartIndex)]",
"itemsToSkip": "[add(mul(parameters('source').vmIndex, parameters('context').nicCount), parameters('source').nicIndex)]",
"nicNatRules": "[parameters('state')[variables('itemsToSkip')]]",
"natRuleId": [
{
"id": "[resourceId('Microsoft.Network/loadBalancers/inboundNatRules', parameters('context').loadBalancerName, concat(parameters('source').namePrefix, '-vm', variables('deployedVMIndex')))]"
}
],
"updatedNicNatRules": [ "[concat(variables('nicNatRules'), variables('natRuleId'))]" ]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(take(parameters('state'), variables('itemsToSkip')), variables('updatedNicNatRules'), skip(parameters('state'), add(variables('itemsToSkip'), 1)))]"
}
}
}

Просмотреть файл

@ -0,0 +1,42 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"source": { "type": "object" },
"context": { "type": "object" },
"state": {
"type": "array",
"defaultValue": [ ]
},
"iteration": {
"type": "int",
"defaultValue": 0
}
},
"variables": {
"location": "[resourceGroup().location]",
"instance": [
{
"name": "[parameters('source').name]",
"properties": {
"port": "[parameters('source').port]",
"protocol": "[parameters('source').protocol]",
"requestPath": "[parameters('source').requestPath]",
"intervalInSeconds": 15,
"numberOfProbes": 2
}
}
]
},
"resources": [
],
"outputs": {
"collection": {
"type": "array",
"value": "[concat(parameters('state'), variables('instance'))]"
}
}
}

Просмотреть файл

@ -0,0 +1,42 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"nicReference": { "type": "object" },
"loadBalancerBackendAddressPools": { "type": "array" },
"loadBalancerNatRules": { "type": "array" }
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('nicReference'))))]",
"referenceTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/referenceOneParameter.json')]"
},
"resources": [
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2016-03-30",
"name": "[parameters('nicReference').name]",
"location": "[resourceGroup().location]",
"properties": {
"ipConfigurations": [
{
"name": "[parameters('nicReference').properties.ipConfigurations[0].name]",
"properties": {
"privateIPAddress": "[parameters('nicReference').properties.ipConfigurations[0].properties.privateIPAddress]",
"privateIPAllocationMethod": "[parameters('nicReference').properties.ipConfigurations[0].properties.privateIPAllocationMethod]",
"subnet": "[parameters('nicReference').properties.ipConfigurations[0].properties.subnet]",
"primary": "[parameters('nicReference').properties.ipConfigurations[0].properties.primary]",
"loadBalancerBackendAddressPools": "[parameters('loadBalancerBackendAddressPools')]",
"loadBalancerInboundNatRules": "[parameters('loadBalancerNatRules')]"
}
}
],
"dnsSettings": "[parameters('nicReference').properties.dnsSettings]",
"enableIPForwarding": "[parameters('nicReference').properties.enableIPForwarding]",
"primary": "[parameters('nicReference').properties.primary]"
}
}
],
"outputs": {
}
}

Просмотреть файл

@ -0,0 +1,104 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"deploymentContext": { "type": "object" },
"virtualMachinesSettings": { "type": "object" },
"vmStartIndex": { "type": "int" },
"vmCount": { "type": "int" },
"loadBalancerBackendAddressPools": { "type": "array" },
"loadBalancerNatRules": { "type": "array" },
"vmIndex": { "type": "int" },
"vnetName": { "type": "string" }
},
"variables": {
"templateUniqueString": "[uniqueString(concat(string(parameters('deploymentContext')), string(parameters('virtualMachinesSettings')), parameters('vmStartIndex'), parameters('vmCount'), string(parameters('loadBalancerBackendAddressPools')), string(parameters('loadBalancerNatRules')), parameters('vmIndex'), parameters('vnetName')))]",
"referenceTemplate": "[uri(deployment().properties.templateLink.uri, '../../common/referenceOneParameter.json')]",
"nicCount": "[length(parameters('virtualMachinesSettings').nics)]",
"updateNicsTemplate": {
"true": "[uri(deployment().properties.templateLink.uri, 'lb-update-public-nic-backendPools.json')]",
"false": "[uri(deployment().properties.templateLink.uri, 'lb-update-internal-nic-backendPools.json')]"
}
},
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-vm', parameters('vmIndex'), 'Nic', copyindex(1), 'Ref-', variables('templateUniqueString'))]",
"copy": {
"name": "VmNics-reference-iterator",
"count": "[variables('nicCount')]"
},
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[variables('referenceTemplate')]"
},
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-vm', parameters('vmIndex'), 'Nic', copyindex(1), 'Ref')]"
}
},
"subscription": {
"value": "[subscription().subscriptionId]"
},
"resourceGroup": {
"value": "[resourceGroup().name]"
},
"resourceType": {
"value": "Microsoft.Network/networkInterfaces"
},
"resourceName1": {
"value": "[concat(parameters('virtualMachinesSettings').namePrefix, '-vm', parameters('vmIndex'), '-nic', copyindex(1))]"
}
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-vm', parameters('vmIndex'), 'Nic0-', variables('templateUniqueString'))]",
"properties": {
"mode": "Incremental",
"parameters": { },
"template": {
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"variables": { },
"resources": [ ],
"outputs": { }
}
}
},
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"name": "[concat(parameters('deploymentContext').parentTemplateUniqueString, '-vm', parameters('vmIndex'), 'Nic', copyindex(1), '-', variables('templateUniqueString'))]",
"copy": {
"name": "NicCount",
"count": "[variables('nicCount')]"
},
"dependsOn": [
"[concat(parameters('deploymentContext').parentTemplateUniqueString, '-vm', parameters('vmIndex'), 'Nic', copyindex(), '-', variables('templateUniqueString'))]"
],
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "[variables('updateNicsTemplate')[parameters('virtualMachinesSettings').nics[copyindex()].isPublic]]" },
"parameters": {
"deploymentContext": {
"value": {
"parentTemplateUniqueString": "[concat(variables('templateUniqueString'), '-vm', parameters('vmIndex'), 'Nic', copyindex(1))]"
}
},
"nicReference": { "value": "[reference(concat(parameters('deploymentContext').parentTemplateUniqueString, '-vm', parameters('vmIndex'), 'Nic', copyindex(1), 'Ref-', variables('templateUniqueString'))).outputs.reference.value]" },
"loadBalancerBackendAddressPools": { "value": "[parameters('loadBalancerBackendAddressPools')[copyindex()]]" },
"loadBalancerNatRules": { "value": "[parameters('loadBalancerNatRules')[add(mul(sub(parameters('vmIndex'), parameters('vmStartIndex')), variables('nicCount')), copyindex())]]" }
}
}
}
],
"outputs": {
}
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше