katarinasvedman-ms / agent-test

Testing the AI dev team repo
0 stars 0 forks source link

Developer.Implement chain for #150 #168

Open agent-app-kapeltol[bot] opened 3 months ago

agent-app-kapeltol[bot] commented 3 months ago

Write the Azure CLI script to create an Azure SQL Database and deploy the database schema to it.

agent-app-kapeltol[bot] commented 3 months ago

Here's an example of a bash script that you could use to create an Azure SQL Database and deploy a database schema to it. You need to replace the placeholders <...> with your actual values.

#!/bin/bash

# Set variables
resourceGroup="<resource-group>"
location="<location>"
serverName="<server-name>"
adminUser="<admin-user>"
password="<password>"
databaseName="<database-name>"
schemaFilePath="<schema-file-path>"

# Create a resource group
az group create --name $resourceGroup --location $location

# Create a SQL Server
az sql server create --name $serverName --resource-group $resourceGroup --location $location --admin-user $adminUser --admin-password $password

# Create a database in the server
az sql db create --name $databaseName --resource-group $resourceGroup --server $serverName --service-objective S0

# Create a firewall rule to allow access from Azure services
az sql server firewall-rule create --resource-group $resourceGroup --server $serverName -n AllowAzure --start-ip-address 0.0.0.0 --end-ip-address 0.0.0.0

# Deploy the schema using sqlcmd utility
sqlcmd -S tcp:$serverName.database.windows.net,1433 -d $databaseName -U $adminUser -P $password -i $schemaFilePath

Here are a few things to note: