PowerShell cmdlets and REST APIs for SQL Data Warehouse

Many SQL Data Warehouse administration tasks can be managed using either Azure PowerShell cmdlets or REST APIs. Below are some examples of how to use PowerShell commands to automate common tasks in your SQL Data Warehouse. For some good REST examples, see the article Manage scalability with REST.

Note

This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For Az module installation instructions, see Install Azure PowerShell.

Get started with Azure PowerShell cmdlets

  1. Open Windows PowerShell.

  2. At the PowerShell prompt, run these commands to sign in to the Azure Resource Manager and select your subscription.

    Connect-AzAccount
    Get-AzSubscription
    Select-AzSubscription -SubscriptionName "MySubscription"
    

Pause SQL Data Warehouse Example

Pause a database named "Database02" hosted on a server named "Server01." The server is in an Azure resource group named "ResourceGroup1."

Suspend-AzSqlDatabase –ResourceGroupName "ResourceGroup1" –ServerName "Server01" –DatabaseName "Database02"

A variation, this example pipes the retrieved object to Suspend-AzSqlDatabase. As a result, the database is paused. The final command shows the results.

$database = Get-AzSqlDatabase –ResourceGroupName "ResourceGroup1" –ServerName "Server01" –DatabaseName "Database02"
$resultDatabase = $database | Suspend-AzSqlDatabase
$resultDatabase

Start SQL Data Warehouse Example

Resume operation of a database named "Database02" hosted on a server named "Server01." The server is contained in a resource group named "ResourceGroup1."

Resume-AzSqlDatabase –ResourceGroupName "ResourceGroup1" –ServerName "Server01" -DatabaseName "Database02"

A variation, this example retrieves a database named "Database02" from a server named "Server01" that is contained in a resource group named "ResourceGroup1." It pipes the retrieved object to Resume-AzSqlDatabase.

$database = Get-AzSqlDatabase –ResourceGroupName "ResourceGroup1" –ServerName "Server01" –DatabaseName "Database02"
$resultDatabase = $database | Resume-AzSqlDatabase

Note

Note that if your server is foo.database.windows.net, use "foo" as the -ServerName in the PowerShell cmdlets.

Other supported PowerShell cmdlets

These PowerShell cmdlets are supported with Azure SQL Data Warehouse.

Next steps

For more PowerShell examples, see:

For other tasks which can be automated with PowerShell, see Azure SQL Database Cmdlets. Note that not all Azure SQL Database cmdlets are supported for Azure SQL Data Warehouse. For a list of tasks which can be automated with REST, see Operations for Azure SQL Database.