Taking forward from my previous article MICROSOFT AZURE CREATING AND DEPLOYING PAAS SQL SERVER, DATABASE AS A SERVICE, In this post I will performing same task using Microsoft Azure PowerShell to deploy SQL Server. Very first I will be creating Logical SQL server, As this server is completely taken care by Azure team as shown earlier I don't have any physical access.
New-AzureRmSqlServer -ResourceGroupName 'POC-VPN' -Location 'East US 2' -ServerName 'pocsqlserver01' -ServerVersion '12.0' -SqlAdministratorCredentials (Get-Credential)
Once executed this one-liner powershell command New Cloud SQL server is deployed and ready. It prompt for new SQL server username and password (equivalent to SA user). Make sure server name is on all small letters and no special characters allowed, numbers are accepted.
If command executed successfully it shows the new SQL server information on the screen. Next command will create new database under just created SQL server.
New-AzureRmSqlDatabase -ResourceGroupName 'POC-VPN' -DatabaseName 'pocsqlinstance01' -ServerName 'pocsqlserver01' -Edition Standard -RequestServiceObjectName S0
I have used all the existing information for Resource Group and Server Name, Make sure Database name is in small latters and no special characters allowed, numbers are accepted. Edition is the tier version as chart shown in the previous article, and Requested Service Objective name is Database Size.
New-AzureRmSqlServerFirewallRule -ServerName 'pocsqlserver01' -ResourceGroupName 'POC-VPN' -FirewallRuleName 'MyLocalServer' -StartIpAddress '126.96.36.199' -EndIpAddress '188.8.131.52'
This command will create new Azure SQL firewall rule, I am adding my desktop's internet public IP where my SQL client is installed. Same test I did in previous post.