Set-​Azure​Rm​Sql​Database

Sets properties for a database, or moves an existing database into an elastic pool.

Syntax

Set-AzureRmSqlDatabase
   [-ResourceGroupName] <String>
   [-ServerName] <String>
   [-DatabaseName] <String>
   [-MaxSizeBytes <Int64>]
   [-Edition <DatabaseEdition>]
   [-RequestedServiceObjectiveName <String>]
   [-ElasticPoolName <String>]
   [-Tags <Hashtable>]
   [-InformationAction <ActionPreference>]
   [-InformationVariable <String>]
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]

Description

The Set-AzureRmSqlDatabase cmdlet sets properties for an Azure SQL database. In addition, you can specify the ElasticPoolName parameter to move a database into an elastic pool. If a database is already in an elastic pool, you can use the RequestedServiceObjectiveName parameter to assign a performance level.

Examples

Example 1: Update a database to a Standard S2 database

PS C:\>Set-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -DatabaseName "Database01" -ServerName "Server01" -Edition "Standard" -RequestedServiceObjectiveName "S2"
ResourceGroupName             : ResourceGroup01
ServerName                    : Server01
DatabaseName                  : Database01
Location                      : Central US
DatabaseId                    : a1e6bd1a-735a-4d48-8b98-afead5ef1218
Edition                       : Standard
CollationName                 : SQL_Latin1_General_CP1_CI_AS
CatalogCollation              : 
MaxSizeBytes                  : 268435456000
Status                        : Online
CreationDate                  : 7/3/2015 7:33:37 AM
CurrentServiceObjectiveId     : 455330e1-00cd-488b-b5fa-177c226f28b7
CurrentServiceObjectiveName   : S2
RequestedServiceObjectiveId   : 455330e1-00cd-488b-b5fa-177c226f28b7
RequestedServiceObjectiveName : 
ElasticPoolName               : 
EarliestRestoreDate           : 
Tags                          :

This command updates a database named Database01 to a Standard S2 database on a server named Server01.

Example 2: Add a database to an elastic pool

PS C:\>Set-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -DatabaseName "Database01" -ServerName "Server01" -ElasticPoolName "ElasticPool01"
ResourceGroupName             : ResourceGroup01
ServerName                    : Server01
DatabaseName                  : Database01
Location                      : Central US
DatabaseId                    : a1e6bd1a-735a-4d48-8b98-afead5ef1218
Edition                       : Standard
CollationName                 : SQL_Latin1_General_CP1_CI_AS
CatalogCollation              : 
MaxSizeBytes                  : 268435456000
Status                        : Online
CreationDate                  : 7/3/2015 7:33:37 AM
CurrentServiceObjectiveId     : d1737d22-a8ea-4de7-9bd0-33395d2a7419
CurrentServiceObjectiveName   : ElasticPool
RequestedServiceObjectiveId   : d1737d22-a8ea-4de7-9bd0-33395d2a7419
RequestedServiceObjectiveName : 
ElasticPoolName               : elasticpool01
EarliestRestoreDate           : 
Tags                          :

This command adds a database named Database01 to the elastic pool named ElasticPool01 hosted on the server named Server01.

Required Parameters

-DatabaseName

Specifies the name of the database.

Type:String
Position:2
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

Specifies the name of resource group to which the server is assigned.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ServerName

Specifies the name of the server that hosts the database.

Type:String
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Edition

Specifies the edition for the database. The acceptable values for this parameter are:- None

  • Premium
  • Basic
  • Standard
  • DataWarehouse
  • Free
Type:DatabaseEdition
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ElasticPoolName

Specifies name of the elastic pool in which to move the database.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationAction

Specifies how this cmdlet responds to an information event.The acceptable values for this parameter are:- Continue

  • Ignore
  • Inquire
  • SilentlyContinue
  • Stop
  • Suspend
Type:ActionPreference
Aliases:infa
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InformationVariable

Specifies an information variable.

Type:String
Aliases:iv
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MaxSizeBytes

Specifies the new maximum size for the database in bytes. You can specify either this parameter or MaxSizeGB. See the MaxSizeGB parameter for acceptable values per edition.

Type:Int64
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RequestedServiceObjectiveName

Specifies the name of the service objective to assign to the database. For information about service objectives, see Azure SQL Database Service Tiers and Performance Levelshttps://msdn.microsoft.com/en-us/library/azure/dn741336.aspx (https://msdn.microsoft.com/en-us/library/azure/dn741336.aspx) in the Microsoft Developer Network Library.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Tags

Specifies a dictionary of tags that this cmdlet associates with the new server.

Type:Hashtable
Aliases:Tag
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.Azure.Commands.Sql.Database.Model.AzureSqlDatabaseModel