Skip to content

Latest commit

 

History

History
45 lines (31 loc) · 1.57 KB

File metadata and controls

45 lines (31 loc) · 1.57 KB

Azure.Sql.Tools.Tasks

Description

Azure SQL Tools Tasks is just a fun experiment based on Azure SQL Tools. The original project shows how to use native SQL files and SSO. Azure SQL Tools Tasks builds on that for running queries across multiple databases on the same server. The module will create 1 thread per elastic pool to avoid over utilization of resources. Another feature is the progress tracking bars even though they are running in different threads.

Requirements

  • Install the newest PowerShell - Link
  • Install Azure PowerShell Module - Link
  • Connect Azure PowerShell - Link
  • Add SqlServer Module
# First time install
Install-Module SqlServer -Scope CurrentUser -Force

# Updating Module
Update-Module SqlServer -Scope CurrentUser -Force

Getting Started with Azure.Sql.Tools.Tasks

Importing the Module

Import-Module ".\path\to\Azure.Sql.Tools.Tasks.psd1"
Get-Module
  • Your output should have the following
    • Az.Accounts 2.4.0 or greater
    • Az.Resources 4.2.0 or greater
    • Azure.Sql.Tools.Tasks 0.0.1 or greater
    • SqlServer 21.1.18235 or greater

Using the command

$databases = Get-AzSqlDatabase -ResourceGroupName "MyResourceGroup" -ServerName "MyServerName"

$results = $databases | Invoke-AzureSqlCmd -QueryName GetDatabaseName.sql

TaskProgress