Use Azure Powershell to execute a .sql file Use Azure Powershell to execute a .sql file powershell powershell

Use Azure Powershell to execute a .sql file


20 more mins of searching and I found it.

$connectionString = "Data Source=MyDataSource;Initial Catalog=MyDB;User ID=user1;Password=pass1;Connection Timeout=90"$connection = New-Object -TypeName System.Data.SqlClient.SqlConnection($connectionString)$query = [IO.File]::ReadAllText("C:\...\TestSQL.sql")$command = New-Object -TypeName System.Data.SqlClient.SqlCommand($query, $connection)$connection.Open()$command.ExecuteNonQuery()$connection.Close()