-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcreate_single_db_configure_firewall_rule.azcli
More file actions
37 lines (25 loc) · 1.15 KB
/
Copy pathcreate_single_db_configure_firewall_rule.azcli
File metadata and controls
37 lines (25 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
az login
az account show
az account list --all --output table
az account set --subscription "MSDN Platforms"
#Some variables
location="West Europe"
randomIdentifier=random1231975
resource="resource-$randomIdentifier"
server="server-$randomIdentifier"
database="database-$randomIdentifier"
login="dbadmin"
password="samplePassword123!"
startIP=178.198.109.6
endIP=178.198.109.6
#Create a resource group
az group create --name $resource --location "$location"
#Creating $server in $location
az sql server create --name $server --resource-group $resource --location "$location" --admin-user $login --admin-password $password
#Configuring firewall
az sql server firewall-rule create --resource-group $resource --server $server -n AllowYourIp --start-ip-address $startIP --end-ip-address $endIP
#Creating $database on $server
az sql db create --resource-group $resource --server $server --name $database --sample-name AdventureWorksLT --edition GeneralPurpose --family Gen5 --capacity 2 --zone-redundant false
# zone redundancy is only supported on premium and business critical service tiers
#Clean Up
az group delete --name $resource