Skip to content

Latest commit

 

History

History
46 lines (36 loc) · 2.15 KB

azure-sql-action.md

File metadata and controls

46 lines (36 loc) · 2.15 KB

Azure SQL action

Action repo

https://github.com/Azure/sql-action

Uses

  • For deploying a database schema through a dacpac file
  • For running SQL queries through SQL file

Limitation

  • Supported only in Windows runner today

Dependencies

  • Dependent on Azure login action if the runner does not have access to SQL Server.

Executables used

Action inputs

Code flow

  • Get Inputs
  • Validate Inputs
  • Validate Runner Access Check if action runner has access to SQL server. If not, add a temporary firewall rule to allow IP address of runner. This rule will be removed later on.
  • Execute Action
    • Publish a Dacpac file using SqlPackage.exe
    • Run a SQL file using SqlCmd.exe

Files

  • main.ts : Entry point for the action. Get Inputs, Check if firewall rule needs to be added and execute action. Remove the firewall rule once action execution is complete
  • AzureSqlAction.ts : Contains logic for publishing DACPAC file and running SQL file
  • AzureSqlActionHelper.ts : Utility for finding location of SqlPackage.exe and SqlCmd.exe from registry
  • FirewallManager.ts : Contains logic for adding/removing firewall rules.
  • AzureSqlResourceManager.ts : Rest client for calling Azure SQL server REST Apis for fetching SQL server details and adding/remove firewall rules
  • SqlConnectionStringBuilder.ts : Contains logic to parse the connection string to extract server name, database etc