PowerShell: 101-sql-database

Azure SQL Database


This is a conversion of ARM template 101-sql-database  from the repository azure\azure-quickstart-templates  to PowerShell Script.

This script allows you to create Azure SQL Database, and it will deploy the following resources…

… and in-addition to it, just in-case if the deployment is not successful, then it will rollback the entire deployment.


If the specified resource group is already exist then the script will not continue with the deployment.


Deploy-AzResource.ps1 [-ResourceGroupName] <string> [-Location] <string> [[-ServerName] <string>] [[-SqlDBName] <string>] [-AdminCredential] <pscredential> [<CommonParameters>]


I 💙 PS> $Credential = Get-Credentials

PowerShell credential request
Enter your credentials.
User: sqladmin
Password for user sqladmin: *************

I 💙 PS> $param = @{
>> ResourceGroupName = 'azsqldb-rg'
>> Location = 'westus'
>> AdminCredential = $Credential
>> }

I 💙 PS> .\Deploy-AzResources.ps1 @param


Deployment is successful!
Connect SQL Server using sqlo5ckjzma.database.windows.net,1433


    View the code in GitHub  
Last modified: 5 September 2020

Share it on     |   |   |   | 
comments powered by Disqus