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

In order to use Azure PowerShell with SQL Data Warehouse, you need Azure PowerShell version 1.0.3 or greater. You can check your version by running Get-Module -ListAvailable -Name Azure. The latest version can be installed from Microsoft Web Platform Installer. For more information on installing the latest version, see How to install and configure 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.

    Login-AzureRmAccount
    Get-AzureRmSubscription
    Select-AzureRmSubscription -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-AzureRmSqlDatabase –ResourceGroupName "ResourceGroup1" –ServerName "Server01" –DatabaseName "Database02"

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

$database = Get-AzureRmSqlDatabase –ResourceGroupName "ResourceGroup1" –ServerName "Server01" –DatabaseName "Database02"
$resultDatabase = $database | Suspend-AzureRmSqlDatabase
$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-AzureRmSqlDatabase –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-AzureRmSqlDatabase.

$database = Get-AzureRmSqlDatabase –ResourceGroupName "ResourceGroup1" –ServerName "Server01" –DatabaseName "Database02"
$resultDatabase = $database | Resume-AzureRmSqlDatabase
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 Databases.