adds arm template for storage accounts and batch account
This commit is contained in:
Родитель
f42a2997fc
Коммит
66533ad88e
|
@ -23,8 +23,6 @@ mono_crash.*
|
|||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Deploys a template to Azure
|
||||
|
||||
.DESCRIPTION
|
||||
Deploys an Azure Resource Manager template
|
||||
|
||||
.PARAMETER subscriptionId
|
||||
The subscription id where the template will be deployed.
|
||||
|
||||
.PARAMETER resourceGroupName
|
||||
The resource group where the template will be deployed. Can be the name of an existing or a new resource group.
|
||||
|
||||
.PARAMETER resourceGroupLocation
|
||||
Optional, a resource group location. If specified, will try to create a new resource group in this location. If not specified, assumes resource group is existing.
|
||||
|
||||
.PARAMETER deploymentName
|
||||
The deployment name.
|
||||
|
||||
.PARAMETER templateFilePath
|
||||
Optional, path to the template file. Defaults to template.json.
|
||||
|
||||
.PARAMETER parametersFilePath
|
||||
Optional, path to the parameters file. Defaults to parameters.json. If file is not found, will prompt for parameter values based on template.
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$subscriptionId,
|
||||
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$resourceGroupName,
|
||||
|
||||
[string]
|
||||
$resourceGroupLocation,
|
||||
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string]
|
||||
$deploymentName,
|
||||
|
||||
[string]
|
||||
$templateFilePath = "template.json",
|
||||
|
||||
[string]
|
||||
$parametersFilePath = "parameters.json"
|
||||
)
|
||||
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Registers RPs
|
||||
#>
|
||||
Function RegisterRP {
|
||||
Param(
|
||||
[string]$ResourceProviderNamespace
|
||||
)
|
||||
|
||||
Write-Host "Registering resource provider '$ResourceProviderNamespace'";
|
||||
Register-AzureRmResourceProvider -ProviderNamespace $ResourceProviderNamespace;
|
||||
}
|
||||
|
||||
#******************************************************************************
|
||||
# Script body
|
||||
# Execution begins here
|
||||
#******************************************************************************
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# sign in
|
||||
Write-Host "Logging in...";
|
||||
Login-AzureRmAccount;
|
||||
|
||||
# select subscription
|
||||
Write-Host "Selecting subscription '$subscriptionId'";
|
||||
Select-AzureRmSubscription -SubscriptionID $subscriptionId;
|
||||
|
||||
# Register RPs
|
||||
$resourceProviders = @("microsoft.storage");
|
||||
if($resourceProviders.length) {
|
||||
Write-Host "Registering resource providers"
|
||||
foreach($resourceProvider in $resourceProviders) {
|
||||
RegisterRP($resourceProvider);
|
||||
}
|
||||
}
|
||||
|
||||
#Create or check for existing resource group
|
||||
$resourceGroup = Get-AzureRmResourceGroup -Name $resourceGroupName -ErrorAction SilentlyContinue
|
||||
if(!$resourceGroup)
|
||||
{
|
||||
Write-Host "Resource group '$resourceGroupName' does not exist. To create a new resource group, please enter a location.";
|
||||
if(!$resourceGroupLocation) {
|
||||
$resourceGroupLocation = Read-Host "resourceGroupLocation";
|
||||
}
|
||||
Write-Host "Creating resource group '$resourceGroupName' in location '$resourceGroupLocation'";
|
||||
New-AzureRmResourceGroup -Name $resourceGroupName -Location $resourceGroupLocation
|
||||
}
|
||||
else{
|
||||
Write-Host "Using existing resource group '$resourceGroupName'";
|
||||
}
|
||||
|
||||
# Start the deployment
|
||||
Write-Host "Starting deployment...";
|
||||
if(Test-Path $parametersFilePath) {
|
||||
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath -TemplateParameterFile $parametersFilePath;
|
||||
} else {
|
||||
New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupName -TemplateFile $templateFilePath;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"shards": {
|
||||
"value": 20
|
||||
},
|
||||
"shardprefix": {
|
||||
"value": "adxbench"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"location": {
|
||||
"type": "string",
|
||||
"defaultValue": "westeurope"
|
||||
},
|
||||
"storageAccountType": {
|
||||
"type": "string",
|
||||
"defaultValue": "Standard_LRS"
|
||||
},
|
||||
"storageKind": {
|
||||
"type": "string",
|
||||
"defaultValue": "BlobStorage"
|
||||
},
|
||||
"accessTier": {
|
||||
"type": "string",
|
||||
"defaultValue": "Hot"
|
||||
},
|
||||
"supportsHttpsTrafficOnly": {
|
||||
"type": "bool",
|
||||
"defaultValue": true
|
||||
},
|
||||
"shards": {
|
||||
"type": "int",
|
||||
"defaultValue": 1
|
||||
},
|
||||
"shardprefix": {
|
||||
"type": "string",
|
||||
"defaultValue": "adxbenchmark"
|
||||
},
|
||||
"batchAccountName": {
|
||||
"type": "string",
|
||||
"defaultValue": "adxbenchmarkbatch"
|
||||
},
|
||||
"batchAccountStorageAccountSuffix": {
|
||||
"type": "string",
|
||||
"defaultValue": "sa"
|
||||
}
|
||||
},
|
||||
"variables": {
|
||||
"batchstorageAccountname": "[concat(parameters('batchAccountName'), parameters('batchAccountStorageAccountSuffix'))]"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"name": "[concat(parameters('shardprefix'),copyIndex(1))]",
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"apiVersion": "2019-04-01",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"accessTier": "[parameters('accessTier')]",
|
||||
"supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
|
||||
],
|
||||
"sku": {
|
||||
"name": "[parameters('storageAccountType')]"
|
||||
},
|
||||
"kind": "[parameters('storageKind')]",
|
||||
"copy": {
|
||||
"name": "storageForShards",
|
||||
"count": "[parameters('shards')]"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "[variables('batchstorageAccountname')]",
|
||||
"type": "Microsoft.Storage/storageAccounts",
|
||||
"apiVersion": "2019-04-01",
|
||||
"location": "[parameters('location')]",
|
||||
"properties": {
|
||||
"accessTier": "[parameters('accessTier')]",
|
||||
"supportsHttpsTrafficOnly": "[parameters('supportsHttpsTrafficOnly')]"
|
||||
},
|
||||
"dependsOn": [
|
||||
|
||||
],
|
||||
"sku": {
|
||||
"name": "[parameters('storageAccountType')]"
|
||||
},
|
||||
"kind": "[parameters('storageKind')]"
|
||||
},
|
||||
{
|
||||
"type": "Microsoft.Batch/batchAccounts",
|
||||
"apiVersion": "2020-09-01",
|
||||
"name": "[parameters('batchaccountName')]",
|
||||
"location": "[parameters('location')]",
|
||||
"identity": {
|
||||
"type": "None"
|
||||
},
|
||||
"dependsOn": [
|
||||
"[resourceId('Microsoft.Storage/storageAccounts', variables('batchstorageAccountname'))]"
|
||||
],
|
||||
"properties": {
|
||||
"autoStorage": {
|
||||
"storageAccountId": "[resourceId('Microsoft.Storage/storageAccounts', variables('batchstorageAccountname'))]"
|
||||
},
|
||||
"poolAllocationMode": "BatchService",
|
||||
"publicNetworkAccess": "Enabled",
|
||||
"encryption": {
|
||||
"keySource": "Microsoft.Batch"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outputs": {
|
||||
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче