Earlier today I presented at the Get to know SQL Server 2016 / Business Intelligence / Azure event at 1cc. My talk was “Azure SQL Database: Not just a cloud version of SQL Server” to an inquisitive Cambridge audience.
My deck is here: Azure SQL Database – not just a cloud version of SQL Server – NESQL -June-24-2016 – Bill Wilder – posted
The PowerShell script I demo’d is included in the gist referenced below.
$subName = 'my azure subscription name here' | |
$rgName = 'nesql-june24-demo2' | |
$region = "East US" | |
$serverName = 'billwilder911' | |
$myIp = "107.92.120.203" #### CHANGES A LOT! | |
Add-AzureRmAccount # then log in interactively, including with 2FA | |
Select-AzureRmSubscription –SubscriptionName $subName | |
# How many regions am I allowed to deploy SQL to? | |
$sqlRegionCount = (Get-AzureRmResourceProvider –ListAvailable | Where-Object {$_.ProviderNamespace -eq 'Microsoft.Sql'}).Locations.Length | |
Write-Host "$sqlRegionCount regions available for creating Azure SQL Databases:" | |
(Get-AzureRmResourceProvider –ListAvailable | Where-Object {$_.ProviderNamespace -eq 'Microsoft.Sql'}).Locations | |
# create a RESOURCE GROUP for this demo | |
New-AzureRmResourceGroup –Name $rgName –Location $region | |
(Get-AzureRmResourceGroup –Name $rgName).Location | |
# create a DATABASE SERVER | |
New-AzureRmSqlServer –ResourceGroupName $rgName –ServerName $serverName –Location $region –ServerVersion "12.0" | |
#create a DATABASE FIREWALL RULE | |
New-AzureRmSqlServerFirewallRule ` | |
–ResourceGroupName $rgName ` | |
–ServerName $serverName –FirewallRuleName "one ip to rule them all" ` | |
–StartIpAddress $myIp –EndIpAddress $myIp | |
# -AllowAllAzureIPs | |
# create a DATABASE ************************************ | |
Get-AzureRmSqlCapability –LocationName $region | |
$dbName = 'BillDb' | |
$dbEdition = "Basic" | |
$dbLevel = "S0" # https://azure.microsoft.com/en-us/documentation/articles/sql-database-service-tiers/ | |
$dbLevel = "Basic" # https://azure.microsoft.com/en-us/documentation/articles/sql-database-service-tiers/ | |
$db = New-AzureRmSqlDatabase –ResourceGroupName $rgname ` | |
–ServerName $serverName ` | |
–DatabaseName $dbname ` | |
–Edition $dbEdition ` | |
–RequestedServiceObjectiveName $dbLevel | |
$db | |
Write-Host "Firewall?" | |
Write-Host "${dbName}.database.secure.windows.net" | |
# comment out to NOT delete right away | |
Write-Host "Remove-AzureRmResourceGroup -Name $rgname -Force" | |
$subName = 'Bill Wilder – Finomial MSDN(Converted to EA)' | |
$rgName = 'nesql-june24-demo2' | |
$region = "East US" | |
$serverName = 'billserver981' | |
$myIp = "107.92.120.203" #### CHANGES A LOT! | |
Add-AzureRmAccount # then log in interactively, including with 2FA | |
Select-AzureRmSubscription –SubscriptionName $subName | |
# How many regions am I allowed to deploy SQL to? | |
$sqlRegionCount = (Get-AzureRmResourceProvider –ListAvailable | Where-Object {$_.ProviderNamespace -eq 'Microsoft.Sql'}).Locations.Length | |
Write-Host "$sqlRegionCount regions available for creating Azure SQL Databases:" | |
(Get-AzureRmResourceProvider –ListAvailable | Where-Object {$_.ProviderNamespace -eq 'Microsoft.Sql'}).Locations | |
# create a RESOURCE GROUP for this demo | |
New-AzureRmResourceGroup –Name $rgName –Location $region | |
(Get-AzureRmResourceGroup –Name $rgName).Location | |
# create a DATABASE SERVER | |
New-AzureRmSqlServer –ResourceGroupName $rgName –ServerName $serverName –Location $region –ServerVersion "12.0" | |
#create a DATABASE FIREWALL RULE | |
New-AzureRmSqlServerFirewallRule ` | |
–ResourceGroupName $rgName ` | |
–ServerName $serverName –FirewallRuleName "one ip to rule them all" ` | |
–StartIpAddress $myIp –EndIpAddress $myIp | |
# -AllowAllAzureIPs | |
# create a DATABASE ************************************ | |
Get-AzureRmSqlCapability –LocationName $region | |
$dbName = 'BillDb' | |
$dbEdition = "Basic" | |
$dbLevel = "S0" # https://azure.microsoft.com/en-us/documentation/articles/sql-database-service-tiers/ | |
$dbLevel = "Basic" # https://azure.microsoft.com/en-us/documentation/articles/sql-database-service-tiers/ | |
$db = New-AzureRmSqlDatabase –ResourceGroupName $rgname ` | |
–ServerName $serverName ` | |
–DatabaseName $dbname ` | |
–Edition $dbEdition ` | |
–RequestedServiceObjectiveName $dbLevel | |
$db | |
Write-Host "${dbName}.database.secure.windows.net" | |
Write-Host "Run this later to delete this resource group containing database server and database" | |
Write-Host "Remove-AzureRmResourceGroup -Name $rgname -Force" | |
#Remove-AzureRmResourceGroup -Name $rgname -Force | |
Pingback: Azure SQL Database – Not just a cloud version - How to Code .NET