More PowerShell for the Azure World

The collection of Azure SQL Database cmdlets can be found at – https://msdn.microsoft.com/en-us/library/mt574084.aspx. There are alot, however I tend to use the following quite frequently and I am sure they will be useful to others too.

Scaling

You can scale your database up or down with the Set-AzureRmSqlDatabase command – so let’s upgrade to Premium.

Set-AzureRmSqlDatabase -ResourceGroupName "MY_ENV"  -ServerName " azuresqlserver01"  -DatabaseName "SQLDB12" -Edition premium -RequestedServiceObjectiveName "P1"

baba1

 

Database list

Get-AzureRmSqlDatabase -ResourceGroupName "MY_ENV"  -ServerName " azuresqlserver01"

Information returned includes – server name, database name, collation, status, creation date and much more (see screen shot)

baba2

Get geo-replication information

Get-AzureRmSqlDatabaseReplicationLink -ResourceGroupName "MY_ENV" -ServerName " azuresqlserver01" -DatabaseName "SQLDB2" -PartnerResourceGroupName " MY_ENV"

baba3

Delete Database

Remove-AzureRmSqlDatabase -ResourceGroupName "MY_ENV" -ServerName " azuresqlserver01 " -DatabaseName "SQLDB12"

baba4

Then you can re-issue Get-AzureRmSqlDatabase -ResourceGroupName “MY_ENV” -ServerName ” azuresqlserver01″ Then you will notice that it has gone from the list.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s