move to azure

Download Move to azure

If you can't read please download the document

Post on 14-Jan-2015




1 download

Embed Size (px)





2. About Me Paul Irwin Lead Software Engineer at feature[23] Past experience as lead engineer on Fanatics ecommerce platform Microsoft Certified Solutions Developer: Web Applications Co-founder of Code on the Beach and Code on the Sea @paulirwin 3. Code on the Beach The Beachside Software Engineering Conference @CodeOnTheBeach August 8 10, 2014 Registration open now at $250 Charles Petzold, Greg Young, and John Papa World class resort hotel Beach games and events Excellent networking 4. Code on the Sea The Software Engineering Cruise @CodeOnTheSea February 28 March 5, 2015 Registration starting at $650 5 Day Cruise to Bahamas from Jacksonville Carnival Fascination Family friendly Our greatest hospitality conference 5. Why move to Microsoft Azure? WHATS IN IT FOR ME? 6. Why move to Microsoft Azure? Per-minute billing: pay only for what you use Instant provisioning Insanely scalable Save on Windows Server, SQL Server, etc. licenses Less infrastructure maintenance costs No need to deal with hardware failures Geographically-distributed High Availability / Disaster Recovery Tons of built-in APIs and services 7. Windows Azure Facilities 8. Inside a Facility 9. Inside a Container 10. Moving to Microsoft Azure Covered today: ASP.NET Apps (WebForms, MVC, Web API, etc.) Not covered today: PHP, Python, Node.js, Ruby, Java, etc. Simple apps can usually be moved as-is Complex apps need architecture thought Platform-as-a-Service vs Infrastructure-as-a-Service 11. PaaS vs IaaS Platform-as-a-Service (PaaS) Pros Easy to scale Can be cheaper than IaaS Feature-rich cloud APIs No software licenses needed Cons Can necessitate re-architecting Less control Infrastructure-as-a-Service (IaaS) Pros Full control Run any software unmodified BYO or Per-minute Licenses Cons Usually more expensive Must scale the old way or create custom scripts You still need licenses 12. Scenario Employment ASP.NET MVC Web Application in Web Farm SQL Server database ASP.NET State Server for Session State Facebook and Google OAuth sign-in Lots of CSS, JS, and image content Windows Scheduled Tasks to inform applicants of new opportunities MSMQ queue where job applications are received for processing Job application processor Windows Service DR datacenter across country 13. Step 1: Move the SQL Database 14. Step 1: Move the SQL Database SQL Server in an Azure Virtual Machine (IaaS solution) Pros Ultimate power and flexibility Full feature set SSIS, SSAS, SSRS, SQL Agent RDP into the VM for management No new training required Easy to set up AlwaysOn/mirroring HA Option to pay per-minute with SQL Server license included Cons EXTREMELY expensive if license included and running 24/7 Not as performant as high-end on-prem hardware Manage updates/service packs manually 15. Step 1: Move the SQL Database Azure SQL Database (PaaS solution) Pros Very affordable (starting at $5/mo) Scales easily Built-in High Availability Auto-management of updates/service packs No need for Windows Server / SQL Server licenses Cons Limited feature set Limited control over instances 16. Azure SQL Database Missing Features Integration Services Analysis Services Reporting Services SQL Agent SQL CLR Msdb, model databases Traditional Backup/Restore/Attach Distributed transactions Unlimited DB size Windows Authentication Extended Events FILESTREAM File Groups (i.e. ON PRIMARY) File management Full-text search Replication / Mirroring Service Broker XML Indexing USE [database] / Cross-DB queries Hekaton In-Memory OLTP (SQL Svr 2014) 17. Azure SQL Database Features Just about everything else Tables, indexes, FKs, views, stored procedures, functions, triggers, CTEs, custom types, TVPs, temp tables, logins/users, etc. Built-in High Availability Your database synced to multiple nodes with auto failover for FREE! Click-to-scale Latest T-SQL Features i.e. OFFSET/FETCH in SQL Server 2012 REST API for managing databases CHEAP Connect to it from elsewhere Via SSMS, SSIS, SSAS, SSRS, SQL Agent, bcp, etc. 18. SQL Server VM IaaS Pricing Size CPUs Memory BYO License Web Edition Standard Edition Enterprise Edition Small 1 1.75GB $66.96 $100.44 $476.16 $1,629.36 Medium 2 3.5GB $133.92 $167.40 $543.12 $1,696.32 Large 4 7GB $267.84 $301.32 $677.04 $1,830.24 X-Large 8 14GB $535.68 $602.64 $1,354.08 $3,660.48 A5 (HM) 2 14GB $297.60 $331.08 $706.80 $1,860.00 A6 (HM) 4 28GB $595.20 $628.68 $1,004.40 $2,157.60 A7 (HM) 8 56GB $1,190.40 $1,257.36 $2,008.80 $4,315.20 19. Azure SQL Database PaaS Pricing Database Size Monthly Price 20 MB FREE 100 MB $5.00 1 GB $9.99 5 GB $25.98 10 GB $45.96 50 GB $125.88 100 GB $175.83 150 GB $225.78 > 150 GB * Premium Instance Pricing * 20. The Amazing NEW Button 21. Creating a New Azure SQL DB 22. Subscriptions and Directories Highest level: Directories Equivalent to Active Directory directories One is created for you automatically Can contain multiple Subscriptions Should be organization-level Next level: Subscriptions Now must belong to a Directory Contain multiple Services Tied to a credit card Should be used for keeping billing separate Lowest level: Services Must belong to a Subscription Changing the Subscription later is not fun 23. SQL Azure Firewall Rules 24. Move Your Data/Schema to SQL Azure 1. Entity Framework Migrations 2. Generate Scripts from SSMS 3. BCP.exe 4. BACPAC to Blob Storage 5. RedGate SQL Compare and SQL Data Compare 25. Entity Framework Migrations Schema and seeded data only Update-Database -ConnectionStringName ProdForMigrations Database.SetInitializer(new MigrateDatabaseToLatestVersion()) 26. Generate Scripts for SQL Azure 27. BCP.exe to SQL Azure bcp AdventureWorks2012.Sales.Customer in C:UsersuserDocumentsMoveDataToSQLAzure.txt -c -U username@servername -S -P password 28. BACPAC to Blob Storage In SSMS: Tasks / Export Data-tier Application / Save to Windows Azure Save to Blob Storage Will throw errors on any Azure- incompatible objects Load BACPAC from Blob Storage into NEW database 29. RedGate Tools SQL Compare to compare schema SQL Data Compare to compare table records Beware of long-connection timeouts! $495 from 30. Step 2: Move the ASP.NET App 31. Options for Web Hosting in Azure Azure Web Sites PaaS Cheaper to get started Supports ASP.NET, Node.js, PHP, etc. Simpler to deploy Less powerful Azure Cloud Services PaaS Cheaper to scale Only ASP.NET Staging/Production VIP Swap Deployments Very powerful RDP into instance(s) Auto-updated IIS in a Windows Server VM IaaS Expensive Full IIS/Windows Features Need to manage Windows Updates, etc. 32. Azure Cloud Service Web Roles ASP.NET WebForms, MVC, Web API, WCF, etc. Provisions a Windows Server VM and deploys your app to IIS Control over version of Windows Server (IIS) Windows Server 2008 R2, 2012, or 2012 R2 No need to pay for Windows Server license Staging/Production deployments with VIP Swap Temporary or persisted local storage Load balancing built-in Click-to-scale or Auto-scale HTTP, HTTPS, or TCP internal/external endpoints 33. Azure Cloud Service Pricing Size Name Virtual Cores Memory Price Per Hour Price Per Month Extra-Small Shared 768 MB $0.02 ~ $15 Small 1 1.75 GB $0.08 ~ $60 Medium 2 3.5 GB $0.16 ~ $120 Large 4 7 GB $0.32 ~ $239 Extra-Large 8 14 GB $0.64 ~ $477 High-Memory A5 2 14 GB $0.35 ~ $261 High-Memory A6 4 28 GB $0.71 ~ $529 High-Memory A7 8 56 GB $1.41 ~ $1,050 34. Cloud Service Deployment 1. Create an Azure Cloud Service project in your VS sln 2. Add your ASP.NET web site to the Cloud Service project as a Web Role 3. Package your Cloud Service 4. Upload package to Azure, provisions new Staging environment 5. Test staging site at unique URL 6. VIP Swap staging into production (and vice versa) 7. Test production 8. Stop staging environment (save on billing costs) 35. Creating a Cloud Service 36. Our Existing Application 37. Creating a Cloud Service Project 38. Add Existing Project as Web Role 39. Choose Web Project as Web Role 40. Set Scale 41. Package Cloud Service for Deployment 42. Deployment Options 43. Upload to Azure Portal 44. Uploading a Package 45. Provisioning Staging Environment 46. Up and Running 47. Finding Staging Site URL 48. Testing Staging 49. VIP Swap into Production 50. Test Production 51. DNS Setup Cloud Services CNAME only i.e.: is CNAMEd to Redirect from to Web Sites CNAME or A Must verify domain name with awverify CNAME Can be finicky! 52. Delete Staging Environment 53. Monitoring your Cloud Service 54. Scaling your Cloud Service 55. Step 3: Handling Session State 56. Azure Session State Options Table Storage Cheap Slower Scalable HA built-in Persisted SQL Database Cheap-ish Fast-ish Not as scalable HA built-in Persisted Cache Role Costly Fast Scalable HA available Feature rich Not persisted In-Role Cache No cost Fast Scalable HA with scale Feature rich Not persisted 57. Enable In-Role Caching 58. Enable Cache Providers 59. Set Cache Client Settings 60. Step 4: Enabling ACS for OAuth 61. Azure Access Control Service Provides managed identity federation Supports Active Directory and OAuth FREE! Like really, truly FREE! OAuth Providers: Microsoft Account Google Yahoo! Facebook Uses Windows Identity Foundation More info: 62.


View more >