Skip to content

Commit bd03600

Browse files
committed
sql template updated
1 parent ec7a251 commit bd03600

3 files changed

Lines changed: 23 additions & 14 deletions

File tree

deploy/az/sql/readme.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ The ARM template `sqldeploy.json` and its parameter file (`sqldeploy.parameters.
88

99
## Editing sqldeploy.parameters.json file
1010

11-
You have to edit the `sqldeploy.parameters.json` file to set your values. There are two parameters:
11+
You **must** edit the `sqldeploy.parameters.json` file to set login and password of the admin user.
1212

13-
1. `sql_server` is a object parameter that contains the sql server name, the admin login and password, and the database names.
14-
2. `suffix` is a suffix that will be added to thee sql_server name to ensure uniqueness.
13+
1. `sql_server` is a object parameter that contains the sql server name and the database names. You can leave default values if you want.
14+
2. `admin` is a string with the admin logon. You MUST provide a valid value
15+
3. `adminpwd` is a string with the admin password. You MUST provide a valid value
16+
17+
ARM script ensures uniqueness of the SQL server created by appending one unique string in its name (defined in the `sql_server.name` parameter).
1518

1619
## Deploy the template
1720

1821
Once parameter file is edited you can deploy it using [create-resources script](../readme.md).
19-
2022
i. e. if you are in windows, to deploy sql databases in a new resourcegroup located in westus, go to `deploy\az` folder and type:
2123

2224
```
@@ -31,3 +33,4 @@ create-resources.cmd sql\sqldeploy newResourceGroup -c westus
3133

3234

3335

36+

deploy/az/sql/sqldeploy.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
"sql_server": {
66
"type": "object"
77
},
8-
"suffix": {
8+
"admin": {
9+
"type": "string"
10+
},
11+
"adminpwd": {
912
"type": "string"
1013
}
1114
},
1215
"variables": {
13-
"sql_server_name": "[concat(parameters('sql_server').name, '-', parameters('suffix'))]"
16+
"sql_server_name": "[concat(parameters('sql_server').name, '-', uniqueString(resourceGroup().id))]",
17+
"admin": "[parameters('admin')]",
18+
"adminpwd": "[parameters('adminpwd')]"
1419
},
1520
"resources": [
1621
{
@@ -19,8 +24,8 @@
1924
"apiVersion": "2014-04-01-preview",
2025
"location": "[resourceGroup().location]",
2126
"properties": {
22-
"administratorLogin": "[parameters('sql_server').admin]",
23-
"administratorLoginPassword": "[parameters('sql_server').adminpwd]",
27+
"administratorLogin": "[variables('admin')]",
28+
"administratorLoginPassword": "[variables('adminpwd')]",
2429
"version": "12.0"
2530
},
2631
"resources": [

deploy/az/sql/sqldeploy.parameters.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@
44
"parameters": {
55
"sql_server": {
66
"value": {
7-
"name": "eshop-sqlsrv",
8-
"admin": "eshop",
9-
"adminpwd": "Pass@word",
7+
"name": "eshopsql",
108
"dbs": {
119
"ordering": "orderingdb",
1210
"identity": "identitydb",
1311
"catalog": "catalogdb"
1412
}
1513
}
1614
},
17-
"suffix": {
18-
"value": "edu"
15+
"admin": {
16+
"value": null
17+
},
18+
"adminpwd": {
19+
"value": null
1920
}
2021
}
21-
}
22+
}

0 commit comments

Comments
 (0)