Skip to content

Instantly share code, notes, and snippets.

@ericmaino
Last active May 20, 2017 15:54
Show Gist options
  • Save ericmaino/a1d234b0f864b0d967bca7fc126b0eb0 to your computer and use it in GitHub Desktop.
Save ericmaino/a1d234b0f864b0d967bca7fc126b0eb0 to your computer and use it in GitHub Desktop.
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"databaseName": {
"type": "string",
"maxLength": 10,
"metadata": {
"description": "A short identifier to distinguish machines in this membership"
}
},
"dbPassword" : {
"type" : "securestring"
}
},
"variables": {
"resourceLocation": "[resourceGroup().location]",
"databaseServer" : "[concat('db-', parameters('databaseName'))]",
"database" : "[parameters('databaseName')]"
},
"resources": [
{
"type": "Microsoft.Sql/servers",
"kind": "v12.0",
"name": "[variables('databaseServer')]",
"apiVersion": "2014-04-01-preview",
"location": "[variables('resourceLocation')]",
"properties": {
"administratorLogin": "dbadmin",
"administratorLoginPassword": "[parameters('dbPassword')]",
"version": "12.0"
},
"dependsOn": []
},
{
"type": "Microsoft.Sql/servers/firewallRules",
"kind": "v12.0",
"name": "[concat(variables('databaseServer'), '/AllowAllWindowsAzureIps')]",
"apiVersion": "2014-04-01-preview",
"location": "[variables('resourceLocation')]",
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "0.0.0.0"
},
"dependsOn": [
"[variables('databaseServer')]"
]
},
{
"type": "Microsoft.Sql/servers/databases",
"kind": "v12.0,user",
"name": "[concat(variables('databaseServer'), '/', variables('database'))]",
"apiVersion": "2014-04-01-preview",
"location": "[variables('resourceLocation')]",
"properties": {
"edition": "Standard"
},
"dependsOn": [
"[variables('databaseServer')]"
]
}
],
"outputs": {
"Result" : {
"type": "object",
"value": {
"databaseUrl" : "[reference(resourceId('Microsoft.Sql/servers', variables('databaseServer'))).fullyQualifiedDomainName]",
"dbLogin" : "[reference(resourceId('Microsoft.Sql/servers', variables('databaseServer'))).administratorLogin]"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment