Skip to content

Latest commit

 

History

History
 
 

demo3_availability

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Demo steps for Availability for Azure SQL Database

Here are steps to demonstrate bult-in retry logic for the SQL provider against an Azure SQL Database

Prereqs

  • VS 2022 Community Edition
  • Nuget packages for Microsoft.Data.SqlClient and System.Configuration.Configuration Manager
  • Use VS to Add a new item for an Application Configuration file
  • Deploy two Azure SQL Databases (General Purpose service tier) and Server. You need two databases to show failover since you can only manually failover every 15 mins.
  • Put both your database connection strings in the app config file.
  • You will use the SQL admin login and password to authenticate
  • Install Azure Powershell modules: https://docs.microsoft.com/en-us/powershell/azure
  • Edit failovergp1.ps1 and failover gp2.ps1 to point to your server, resource group, and each database.

Demo steps

  1. Show the code on how retry logic works with the provider
  2. Comment out the code to assign the retry provider to the connection
  3. Assign your connection to the first Azure SQL Database in your code
  4. Execute the program
  5. Run failovergp1.ps1 to initiate a GP service tier failover
  6. Notice how errors (shown in red) appear until the failover is complete and app starts reconnecting
  7. Change your connection to use the 2nd GP database
  8. Uncomment the retry logic code and reubild the app
  9. Execute the program
  10. Run failovergp2.ps1 to initiate a GP service tier failover
  11. Note the yellow and grey text which are evidence of retry behind the scenes.