Created
November 13, 2015 15:05
-
-
Save MilenPavlov/418b61acccab8c641450 to your computer and use it in GitHub Desktop.
ARM Template for TaskLogger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
| "contentVersion": "1.0.0.0", | |
| "parameters": { | |
| "siteName": { "type": "string" }, | |
| "siteLocation": { | |
| "type": "string", | |
| "defaultValue": "West Europe" | |
| }, | |
| "sqlServerName": { | |
| "type": "string", | |
| "minLength": 1, | |
| "defaultValue": "[concat(parameters('siteName'), '-srvr')]" | |
| }, | |
| "sqlServerAdminLogin": { | |
| "type": "string", | |
| "minLength": 1, | |
| "defaultValue": "serveradmin" | |
| }, | |
| "sqlServerAdminLoginPassword": { | |
| "type": "securestring", | |
| "defaultValue": "Password123!" | |
| }, | |
| "sqlDatabaseName": { | |
| "type": "string", | |
| "minLength": 1, | |
| "defaultValue": "[replace(parameters('siteName'), '-', '.')]" | |
| }, | |
| "sqlDatabaseCollation": { | |
| "type": "string", | |
| "minLength": 1, | |
| "defaultValue": "SQL_Latin1_General_CP1_CI_AS" | |
| }, | |
| "sqlDatabaseEdition": { | |
| "type": "string", | |
| "defaultValue": "Basic", | |
| "allowedValues": [ | |
| "Basic", | |
| "Business", | |
| "Premium", | |
| "Standard", | |
| "Web" | |
| ] | |
| }, | |
| "basicAppServicePlanName": { | |
| "type": "string", | |
| "minLength": 1 | |
| }, | |
| "basicAppServicePlanSKU": { | |
| "type": "string", | |
| "allowedValues": [ | |
| "Free", | |
| "Shared", | |
| "Basic", | |
| "Standard" | |
| ], | |
| "defaultValue": "Basic" | |
| }, | |
| "basicAppServicePlanWorkerSize": { | |
| "type": "string", | |
| "allowedValues": [ | |
| "0", | |
| "1", | |
| "2" | |
| ], | |
| "defaultValue": "0" | |
| } | |
| }, | |
| "variables": { | |
| }, | |
| "resources": [ | |
| { | |
| "name": "[parameters('sqlServerName')]", | |
| "type": "Microsoft.Sql/servers", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2014-04-01-preview", | |
| "dependsOn": [ ], | |
| "tags": { | |
| "displayName": "sqlServerName" | |
| }, | |
| "properties": { | |
| "administratorLogin": "[parameters('sqlServerAdminLogin')]", | |
| "administratorLoginPassword": "[parameters('sqlServerAdminLoginPassword')]" | |
| }, | |
| "resources": [ | |
| { | |
| "name": "AllowAllWindowsAzureIps", | |
| "type": "firewallrules", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2014-04-01-preview", | |
| "dependsOn": [ | |
| "[concat('Microsoft.Sql/servers/', parameters('sqlServerName'))]" | |
| ], | |
| "properties": { | |
| "startIpAddress": "0.0.0.0", | |
| "endIpAddress": "255.255.255.255" | |
| } | |
| }, | |
| { | |
| "name": "[parameters('sqlDatabaseName')]", | |
| "type": "databases", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2014-04-01-preview", | |
| "kind": "v12.0", | |
| "dependsOn": [ | |
| "[parameters('sqlServerName')]" | |
| ], | |
| "tags": { | |
| "displayName": "sqlDatabase" | |
| }, | |
| "properties": { | |
| "collation": "[parameters('sqlDatabaseCollation')]", | |
| "edition": "[parameters('sqlDatabaseEdition')]", | |
| "maxSizeBytes": "2147483648" | |
| } | |
| } | |
| ] | |
| }, | |
| { | |
| "name": "[parameters('basicAppServicePlanName')]", | |
| "type": "Microsoft.Web/serverfarms", | |
| "location": "[resourceGroup().location]", | |
| "apiVersion": "2014-06-01", | |
| "dependsOn": [ ], | |
| "tags": { | |
| "displayName": "basicAppServicePlan" | |
| }, | |
| "properties": { | |
| "name": "[parameters('basicAppServicePlanName')]", | |
| "workerSize": "[parameters('basicAppServicePlanWorkerSize')]", | |
| "numberOfWorkers": 1 | |
| }, | |
| "sku": { | |
| "name": "B1", | |
| "tier": "Basic", | |
| "size": "S1", | |
| "family": "S", | |
| "capacity": 1 | |
| } | |
| }, | |
| { | |
| "apiVersion": "2014-06-01", | |
| "dependsOn": [ | |
| "[concat('Microsoft.Web/serverfarms/', parameters('basicAppServicePlanName'))]" | |
| ], | |
| "location": "[resourceGroup().location]", | |
| "name": "[parameters('siteName')]", | |
| "properties": { | |
| "name": "[parameters('siteName')]", | |
| "serverFarm": "[parameters('basicAppServicePlanName')]" | |
| }, | |
| "resources": [ | |
| { | |
| "apiVersion": "2014-06-01", | |
| "dependsOn": [ "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]" ], | |
| "name": "web", | |
| "properties": { | |
| "RepoUrl": "https://github.com/MilenPavlov/TaskLogger.git", | |
| "branch": "master" | |
| }, | |
| "type": "sourcecontrols" | |
| }, | |
| { | |
| "apiVersion": "2015-08-01", | |
| "dependsOn": [ | |
| "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]" | |
| ], | |
| "kind": null, | |
| "location": "West Europe", | |
| "name": "connectionstrings", | |
| "type": "config", | |
| "properties": { | |
| "TaskLogger": { | |
| "value": "[concat('Data Source=tcp:', reference(concat('Microsoft.Sql/servers/', parameters('sqlServerName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', parameters('sqlDatabaseName'), ';User Id=', parameters('sqlServerAdminLogin'), '@', parameters('sqlServerName'), ';Password=', parameters('sqlServerAdminLoginPassword'), ';')]", | |
| "type": "SQLAzure" | |
| } | |
| } | |
| } | |
| ], | |
| "tags": { | |
| "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/', parameters('basicAppServicePlanName'))]": "Resource", | |
| "displayName": "webApp" | |
| }, | |
| "type": "Microsoft.Web/sites" | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param([string]$resourceGroupName=$(throw ="Please specify resource group name"), | |
| [string]$siteName=$(throw ="Please specify site name")) | |
| #create resource group | |
| if((New-AzureRmResourceGroup -Name $resourceGroupName -Location "West Europe").ProvisioningState -eq "Succeeded") | |
| { | |
| #create deployment with predefined template and parameters | |
| New-AzureRmResourceGroupDeployment -Name SampleDep -ResourceGroupName $resourceGroupName -siteName $siteName -basicAppServicePlanName $siteName -TemplateFile C:\Users\milenpavlov\Desktop\basicwbd.json -Force | |
| } | |
| else | |
| { | |
| throw "Error creating resource group" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment