filmov
tv
Mastering Azure Sql Deployment With Arm Templates - Az-400 Lab Part 2
Показать описание
We will be deploying sql db
- to do this we need two resources such as sql server and sql db
- to check the resource type of any azure resource we can check this by going into properties of this resources.
- link for sql server
- Link for sql db
Steps
- Create a new json file
- arm and a tab will give schema
- define resources
- there will be two sources sql server and db
- Go to link and copy
-
"type": "Microsoft.Sql/servers",
"apiVersion": "2023-05-01-preview",
"name": "string",
"location": "string",
- place it in vscode
- give name call it any unique name
- for location
- "location": "[resourceGroup().location]”
- Add properties go to the documentation
-
"properties": {
"administratorLogin": "string",
"administratorLoginPassword": "string"
}
- Now in parameter section define
- "SQLLogin": {
"type":"string",
"metadata":{
"description":"The administrator user name"
}
- one more parameter for Password
"SQLPassword": {
"type":"secureString",
"metadata":{
"description":"The administrator password"
}
- Replace these parameter in the properties section.
"properties":{
"administratorLogin": "[parameters('SQLLogin')]",
"administratorLoginPassword": "[parameters('SQLPassword')]"
- Next resource is SQL db
- Go to document and copy
-
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2022-02-01-preview",
"name": "[format('{0}/{1}','sqlserver400505','kashdb')]",
"location": "[resourceGroup().location]",
"sku":{
"name":"Basic",
"tier":"Basic"
},
"properties":{},
"dependsOn":[
"[resourceId('Microsoft.Sql/servers','sqlserver400505')]"
]
Github link for SQL db/sever ARM script
{
"contentVersion": "1.0.0.0",
"parameters": {
"SQLLogin": {
"type":"string",
"metadata":{
"description":"The administrator user name"
}
},
"SQLPassword": {
"type":"secureString",
"metadata":{
"description":"The administrator password"
}
}
},
"functions": [],
"variables": {},
"resources": [
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2022-02-01-preview",
"name": "kashsqlserver",
"location": "[resourceGroup().location]",
"properties":{
"administratorLogin": "[parameters('SQLLogin')]",
"administratorLoginPassword": "[parameters('SQLPassword')]"
}
},
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2022-02-01-preview",
"name": "[format('{0}/{1}','kashsqlserver','kashdb')]",
"location": "[resourceGroup().location]",
"sku":{
"name":"Basic",
"tier":"Basic"
},
"properties":{},
"dependsOn":[
"[resourceId('Microsoft.Sql/servers','kashsqlserver')]"
]
}
],
"outputs": {}
}
- to do this we need two resources such as sql server and sql db
- to check the resource type of any azure resource we can check this by going into properties of this resources.
- link for sql server
- Link for sql db
Steps
- Create a new json file
- arm and a tab will give schema
- define resources
- there will be two sources sql server and db
- Go to link and copy
-
"type": "Microsoft.Sql/servers",
"apiVersion": "2023-05-01-preview",
"name": "string",
"location": "string",
- place it in vscode
- give name call it any unique name
- for location
- "location": "[resourceGroup().location]”
- Add properties go to the documentation
-
"properties": {
"administratorLogin": "string",
"administratorLoginPassword": "string"
}
- Now in parameter section define
- "SQLLogin": {
"type":"string",
"metadata":{
"description":"The administrator user name"
}
- one more parameter for Password
"SQLPassword": {
"type":"secureString",
"metadata":{
"description":"The administrator password"
}
- Replace these parameter in the properties section.
"properties":{
"administratorLogin": "[parameters('SQLLogin')]",
"administratorLoginPassword": "[parameters('SQLPassword')]"
- Next resource is SQL db
- Go to document and copy
-
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2022-02-01-preview",
"name": "[format('{0}/{1}','sqlserver400505','kashdb')]",
"location": "[resourceGroup().location]",
"sku":{
"name":"Basic",
"tier":"Basic"
},
"properties":{},
"dependsOn":[
"[resourceId('Microsoft.Sql/servers','sqlserver400505')]"
]
Github link for SQL db/sever ARM script
{
"contentVersion": "1.0.0.0",
"parameters": {
"SQLLogin": {
"type":"string",
"metadata":{
"description":"The administrator user name"
}
},
"SQLPassword": {
"type":"secureString",
"metadata":{
"description":"The administrator password"
}
}
},
"functions": [],
"variables": {},
"resources": [
{
"type": "Microsoft.Sql/servers",
"apiVersion": "2022-02-01-preview",
"name": "kashsqlserver",
"location": "[resourceGroup().location]",
"properties":{
"administratorLogin": "[parameters('SQLLogin')]",
"administratorLoginPassword": "[parameters('SQLPassword')]"
}
},
{
"type": "Microsoft.Sql/servers/databases",
"apiVersion": "2022-02-01-preview",
"name": "[format('{0}/{1}','kashsqlserver','kashdb')]",
"location": "[resourceGroup().location]",
"sku":{
"name":"Basic",
"tier":"Basic"
},
"properties":{},
"dependsOn":[
"[resourceId('Microsoft.Sql/servers','kashsqlserver')]"
]
}
],
"outputs": {}
}