Azure Classroom Series – 13/Sept/2020

Using Azure CLI & Powershell to Provision Databases

  • Ensure your cli & Powershell are connected to Azure Account
  • CLI Commands
# Create a resource Group

az group create --location 'centralus' --name 'sqlfromcli'

# Create a sql server
az sql server create --name 'qthmscli' --resource-group 'sqlfromcli' --location 'centralus' --admin-user 'qtdevops' --admin-password 'motherindia@123' --enable-public-network true

# Create a database
az sql db create --name 'qthms' --server 'qthmscli' --resource-group 'sqlfromcli' --capacity 2 --compute-model 'Provisioned' --tier 'GeneralPurpose' --family 'Gen5' --max-size 1GB --sample-name AdventureWorksLT

  • Powershell
# Create a resource Group
$resg = New-AzResourceGroup -Location 'centralus' -Name 'sqlfromps'

$server_name = "qthmsps"
$database_name = 'qthms'
# Create a sql server
$sql_server = New-AzSqlServer -ServerName $server_name -SqlAdministratorCredentials (Get-Credential) -Location $resg.Location -ResourceGroupName $resg.ResourceGroupName

# Create a database
$sql_database = New-AzSqlDatabase -DatabaseName $database_name -ServerName $sql_server.ServerName -ComputeModel 'Provisioned' -VCore '2' -MaxSizeBytes '2147483648' -SampleName 'AdventureWorksLT' -Edition 'GeneralPurpose'  -ResourceGroupName $resg.ResourceGroupName -ComputeGeneration 'Gen5' 

Copying the Data from One Storage Account to Other

  • Use Storage Explorer
  • Build CLI
  • Use a tool called as az copy Refer Here
az copy '<source>' '<destination>'

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin