PowerShell: 101-sql-database


Azure SQL Database

Description

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.

Note:

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

Syntax

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

Example

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

Output

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

Code

    View the code in GitHub  
Last modified: 5 September 2020

Share it on     |   |   |   | 
comments powered by Disqus