Introduction to Developing With SQL Azure Jeff Mlakar Database Architect Ernst & Young
Feb 26, 2016
Introduction to Developing With SQL AzureJeff MlakarDatabase ArchitectErnst & Young
About meComputer Science and Mechanical Engineering degrees from the Engineering College at the University of Michigan(pause for “Boo”s from Ohio audience)Started in SQL Server 2000,C++,Started in .NET 1.1,BizTalk 2002Currently work as a Database Architect at accounting firm of Ernst & Young.
(Title has been referred to as Database Architect, SQL Lead Designer/Data Modeler, Senior Application Engineer, … so you tell me)Work on applications to Steward/Manage/ReportOn data across the global firm.
Blog: www.jeffmlakar.com , twitter: @JeffMlakar
PURPOSE
To introduce you to working with Cloud databases in SQL Azure by working to accomplish a specific goal.
THE GOAL
Create a Tool in Management Studio that can upload/retrieve common TSQL scripts to/from an online repository.
AgendaAbout your speakerWhat is the Cloud?Windows Azure Platform OverviewSQL Azure overviewDEMO: Creating an Azure databaseDEMO: Creating your own SSMS AddInDEMO: Developing in the CloudDEMO: Connecting to and using your Cloud DBShow end productSQL Azure PricingSQL Azure News
What is Cloud Computing?
A Service approach to computing that’s about scaling, abstraction by the vendor, and consumption-based pricing.
Think “Electricity”Powering your building is like running your website / database
Why use the Cloud? 2 reasons:
1)Scale to and pay for what you use.
2)Only worry about the stuff you know well.
9TIME
IT C
APA
CIT
Y
Actual Load
Allocated IT-capacities
Too Much Power
Not Enough Power
Load Forecast
Actual Load
Capacity on Demand
TIME
IT C
APA
CIT
YLoad
Forecast
Cloud Services
Software-as-a-ServiceConsume
GMail
“SaaS”Platform-as-a-Service
Build
Microsoft
“PaaS”Infrastructure-as-a-Service
Host
Amazon
“IaaS”
Cloud ServicesIn-House Software
Storage
Servers
Networking
O/S
Middleware
Virtualization
Data
Applications
Runtime
You
man
age
Infrastructure(as a Service)
Storage
Servers
Networking
O/S
Middleware
Virtualization
Data
Applications
Runtime
Managed by vendor
You
man
age
Platform(as a Service)
Managed by vendor
You
man
age
Storage
Servers
Networking
O/S
Middleware
Virtualization
Applications
Runtime
Data
Software(as a Service)
Managed by vendor
Storage
Servers
Networking
O/S
Middleware
Virtualization
Applications
Runtime
Data
Windows Azure PlatformPaaS
Windows Azure PlatformScalable compute and storageAutomated service managementFamiliar tools, technologies, languages Relational storage for the cloudConsistent development modelAutomated database managementConnect existing apps to the cloudConnect through network boundariesEasily control authorization to apps
Storage Options in Windows Azure Platform:1) Windows Azure Storage Instance: non-relational
storage by means of services that use 1) BLOBS2) Tables3) Queues
(cheap, but have to programmatically handle Referential Integrity, Transactions, Performance, etc…)
2) SQL Azure(more expensive that #1, but gives us relational storage with powerful and robust database engine we all know and love)
SQL AzureDatabase as a Service
HistoryFirst introduced in Community Technology Preview (CTP) as SQL Server Data Services (SSDS)SSDS was non-relational (similar to current Windows Azure Storage instances) and was an altogether new approach to persisting data.Customers complained. They wanted:
Relational engineEasy way to Migrate existing appsTo use the skill set they already have.
Exit SSDS. Enter SQL Azure. (Yay! A Database!)
SQL Azure DatabaseThe first and only true database as a service
Scale On Demand
Innovate FasterManaged Serviceo Database utility; pay as
you growo Business-ready SLAso Enable multi-tenant
solutionso World-wide presence
o Easy provisioning and deployment
o Auto high-availability and fault tolerance
o No need for server or VM administration
o Build cloud-based database solutions on consistent relational model
o Leverage existing skills through existing ecosystem of developer and management tools
SQL Azure Physical ArchitectureApps ToolsODBC ADO.NET
TDSSQL Azure Services
Connection Routing Billing Provisioning
Server
SQL ServerSQL Azure
Fabric
InfrastructureDatabase 1 Database 2 Database 3
Server
SQL ServerSQL Azure
FabricServer
SQL ServerSQL Azure
Fabric
Database Replicas (Hooray for HA!)Replica
1
Replica 2
Replica 3
DB
Single Database Multiple ReplicasSingle Primary
Replica 4
!
Logical vs. Physical AdministrationService handles physical management
Automatically provides HA “out of box”Transparent failover in case of failureLoad balancing of data to ensure SLA
SQL Azure focus on logical administrationSchema creation and managementQuery optimizationSecurity management (Logins, Users, Roles)
Azure Code/Data Architecture Options:
Near Far
Azure Code/Data Architecture Options: (cont.)From
Windows AzureFrom Outside
Microsoft Datacenter From Windows Azure & Outside
Microsoft Datacenter
Application / Browser
Windows Azure
SQL Azure
Code Near
App Code / Tools
SQL Azure
MicrosoftDatacenter
Code Far Hybrid
Microsoft Datacente
r
SQL Azure
SQL Server
Microsoft Datacenter Windows
Azure
SQL Azure Data Sync
App Code / Tools
DEMO TIME!
Create a SQL Azure Server and Database
demo
Steps to Create a SQL Azure Database1) Get a free trial through:
http://www.microsoft.com/windowsazure/free-trial/
Includes one 1 GB DB free for 90 days. Charges begin after that.
2) Go your portal at http://windows.azure.com 3) Select Database -> Your Subscription -> Create
Server.4) Create firewall rules.
DONE!
Steps to Create a SQL Azure Database1) Select Create Database
Create an SSMS AddInStep-by-Step
demo
Steps to Create an SSMS AddIn1) Open Visual Studio.2) File->New Project->Other Project types-
>Extensibility-> Visual Studio AddIn3) Go through Wizard and select “Yes” for creating a
Command Bar UI4) Change Debugging from VS to SSMS by going to
the Project Properties, under “Debug”. 1) Remove Working Directory and Command Line 2) Change Start External Program to
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe
Steps to Create an SSMS AddIn (cont.)5) While you’re in Properties, go to Build and Select
“Register for COM interop”6) Delete “.Addin” files7) Add a Setup Project. File->Add->New Project-
>Other Project Types->Setup Proj8) Right-click Setup Proj and Add Project Output.
Select the primary output of your AddIn project9) Select primary output, go to Properties->Register.
Change from vsdrpDoNotRegister to vsdrpCOM
Steps to Create an SSMS AddIn (cont.)10) Add Registry Keys to Setup Proj by right-clicking
and going to View-Registry. Add:[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\100\Tools\Shell\AddIns\AddInName.Connect]"LoadBehavior"=dword:00000001
11)
Add dlls (What make it possible)
Steps to Create an SSMS AddIn (cont.)11) Add DLLs:- SqlWorkbench.Interfaces.dll
- Microsoft.SqlServer.SqlTools.VSIntegration.dll
From: C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE
12) Open Connect.cs and add “using Microsoft.SqlServer.Management.UI.VSIntegration”
13) Comment out DTE2 _applicationObject and declaration; that interface is not supported in SSMS AddIn
14) Replace _applicationObject with ServiceCache.ExtensibilityModel
Steps to Create an SSMS AddIn (cont.)15) Locate OnConnection and make connectMode
StartupBefore:
After:
Steps to Create an SSMS AddIn (cont.)16) In Setup Proj, right click Detected Dependencies
and hit Refresh17) In the resulting list, right-click ieframe.dll and
Click “Exclude”. It’s not supported.
Now we’re ready to sayHello World
Steps to Create an SSMS AddIn (cont.)
Steps to Create an SSMS AddIn (cont.)18) Build your AddIn project and Setup Project.19) Run the msi you built and Start Management
Studio
(After you’re installed once, you can just hit F5 to run changes)
Make a more complex App
Add a User ControlCreate a Windows User Control “MainWindow” and launch it like so:
If you need to create an update:1. In Setup Project Properties,
1. make sure “RemovePreviousVersions” is set to true2. Increment Version 3. Select “Yes” when prompted to update ProductCode
2. Correct update installer to function correctly for COM reg1. Download “Orca.exe”, a database table editor for
creating and editing Windows Installer packages.2. Open the resulting msi in Orca and open table
“InstallExecutionSequence” 3. Find Entry “RemoveExistingProducts” and give it a value
that falls between InstallValidate and InstallInitialize (ie 1450 if InstallValidate is 1400 and InstallInitialize is 1500)
Developing in the Clouddemo
Database Manager
Connecting to and using your Cloud DB
demo
Use fully-qualified server name and SQL Server Authentication to connect in Connection String
Bail! Drop DB and Server. No more charges!
demo
New(er) StuffSQL Server Reporting ServicesData-tier Application (DAC) framework v2.0 (CTP)Sparse ColumnsInbound data is FREE as of June! Federations
Not supportedChange Data CaptureData AuditingData CompressionExtended EventsExternal Key Management / Extensible Key ManagementFILESTREAM DataIntegrated Full-Text SearchLarge User-Defined Aggregates (UDAs)Large User-Defined Types (UDTs)Performance Data Collection (Data Collector)Policy-Based ManagementResource Governor
Not supported (cont.)SQL Server ReplicationTransparent Data EncryptionCommon Language Runtime (CLR) and CLR User-Defined TypesDatabase MirroringService BrokerTable PartitioningTyped XML and XML indexing is not supported. The XML data type is supported by SQL Azure.Extended Stored ProceduresExtended Properties
See General Guidelines & Limitations:http://msdn.microsoft.com/en-us/library/ff394115.aspx
Useful ToolsSQL Azure Data Sync
Based on Microsoft Sync FrameworkEasy way if you want to sync data across data centers or from Cloud to On-Prem
SQL Azure Migration WizardAnalyze a DB or a script for Azure compliancehttp://sqlazuremw.codeplex.com/
So what does this COST?Edition Web Business BandwidthMax 1 GB $9.99/month n/a FREE in / $.15 out /
GB /month
Asia:FREE in / $.20 out / GB/month
Max 5 GB $49.95/month n/a sameMax 10 GB n/a $99.99/month sameMax 20 GB n/a $199.98/month sameMax 30 GB n/a $299.97/month sameMax 40 GB n/a $399.96/month sameMax 50 GB n/a $499.95/month same
Summary
SQL Azure provides a highly availablecloud database service.
Infrastructure in managed for youScale On DemandUse your existing skill set to innovate faster
ResourcesBooks:
Azure in ActionPro SQL Azure
Downloads: Search: “Windows Azure Platform Training Kit”
Links:www.microsoft.com/windowsazure/www.microsoft.com/windowsazure/pricing/
Events:Azure Bootcamp: http://www.azurebootcamp.com/ Charlotte is today and tomorrow
Resources (cont.)My SSMS AddIn for Storing Scripts to Cloud:
http://scriptstore.cloudapp.net Download, install, will appear in Tools->ScriptStore for SSMS 2008/2008R2
My Blog: www.jeffmlakar.com Follow me on twitter: @JeffMlakar
Thanks to Microsoft and Brian Prince for many graphics in this presentation
Questions?