forked from KEMT/zpwiki
48 lines
1.2 KiB
Bash
48 lines
1.2 KiB
Bash
# Vytvorenie sql databazy
|
|
|
|
|
|
# Set the resource group name and location for your server
|
|
resourceGroupName=myResourceGroup
|
|
location=eastus
|
|
|
|
# Set an admin login and password for your database
|
|
adminlogin=azureuser
|
|
password=Azure1234567!
|
|
|
|
# Set a server name that is unique to Azure DNS (<server_name>.database.windows.net)
|
|
serverName=server-$RANDOM
|
|
|
|
# Set the ip address range that can access your database
|
|
startip=0.0.0.0
|
|
endip=0.0.0.0
|
|
|
|
# Create a resource Group
|
|
az group create --name $resourceGroupName --location $location
|
|
|
|
# Create a server
|
|
az sql server create \
|
|
--name $serverName \
|
|
--resource-group $resourceGroupName \
|
|
--location $location \
|
|
--admin-user $adminlogin \
|
|
--admin-password $password
|
|
|
|
# Configure a firewall rule for server
|
|
az sql server firewall-rule create \
|
|
--resource-group $resourceGroupName \
|
|
--server $serverName \
|
|
-n AllowYourIp \
|
|
--start-ip-address $startip \
|
|
--end-ip-address $endip
|
|
|
|
# Create a single database with Azure CLI
|
|
az sql db create \
|
|
--resource-group $resourceGroupName \
|
|
--server $serverName \
|
|
--name mySampleDatabase \
|
|
--sample-name AdventureWorksLT \
|
|
--edition GeneralPurpose \
|
|
--compute-model Serverless \
|
|
--family Gen5 \
|
|
--capacity 2
|