< Back

New-AzureRmSqlDatabase

Tue Jan 29, 2019 10:09 pm

NAME New-AzureRmSqlDatabase



SYNOPSIS

Creates a database or an elastic database.





SYNTAX

New-AzureRmSqlDatabase [-ResourceGroupName] <String> [-ServerName] <String> [-AsJob] [-CatalogCollation <String>] [-CollationName <String>]

-DatabaseName <String> [-DefaultProfile <IAzureContextContainer>] [-Edition {None | Premium | Basic | Standard | DataWarehouse | Stretch | Free |

PremiumRS}] [-ElasticPoolName <String>] [-MaxSizeBytes <Int64>] [-ReadScale {Disabled | Enabled}] [-RequestedServiceObjectiveName <String>]

[-SampleName {AdventureWorksLT}] [-Tags <Hashtable>] [-ZoneRedundant] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The New-AzureRmSqlDatabase cmdlet creates an Azure SQL database.



You can also create an elastic database by setting the ElasticPoolName parameter to an existing elastic pool.





PARAMETERS

-AsJob [<SwitchParameter>]

Run cmdlet in the background



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-CatalogCollation <String>

Specifies the name of the SQL database catalog collation.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-CollationName <String>

Specifies the name of the SQL database collation.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DatabaseName <String>

Specifies the name of the database.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Edition <DatabaseEdition>

Specifies the edition to assign to the database. The acceptable values for this parameter are:



- Default



- None



- Premium



- Basic



- Standard



- DataWarehouse



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ElasticPoolName <String>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-MaxSizeBytes <Int64>

Specifies the maximum size of the database in bytes.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ReadScale <DatabaseReadScale>

The read scale option to assign to the Azure SQL Database.(Enabled/Disabled)



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-RequestedServiceObjectiveName <String>

Specifies the name of the service objective to assign to the database.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ResourceGroupName <String>

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



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-SampleName <String>

The name of the sample schema to apply when creating this database.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ServerName <String>

Specifies the name of the server that hosts the database.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Tags <Hashtable>

Specifies a dictionary of Key-value pairs in the form of a hash table that this cmdlet associates with the new database. For example:



@{key0="value0";key1=$null;key2="value2"}



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-ZoneRedundant [<SwitchParameter>]

The zone redundancy to associate with the Azure Sql Database



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None

This cmdlet does not accept any input.





OUTPUTS

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







NOTES









Example 1: Create a database on a specified server



PS C:\\>New-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01"

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 : f1173c43-91bd-4aaa-973c-54e79e15235b

CurrentServiceObjectiveName : S0

RequestedServiceObjectiveId : f1173c43-91bd-4aaa-973c-54e79e15235b

RequestedServiceObjectiveName :

ElasticPoolName :

EarliestRestoreDate :

Tags :



This command creates a database named Database01 on server Server01.





Example 2: Create an elastic database on a specified server



PS C:\\>New-AzureRmSqlDatabase -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -DatabaseName "Database01" -ElasticPoolName

"ElasticPool01"

ResourceGroupName : ResourceGroup01

ServerName : Server01

DatabaseName : Database02

Location : Central US

DatabaseId : 7bd9d561-42a7-484e-bf05-62ddef8015ab

Edition : Standard

CollationName : SQL_Latin1_General_CP1_CI_AS

CatalogCollation :

MaxSizeBytes : 268435456000

Status : Online

CreationDate : 8/26/2015 10:04:29 PM

CurrentServiceObjectiveId : d1737d22-a8ea-4de7-9bd0-33395d2a7419

CurrentServiceObjectiveName : ElasticPool

RequestedServiceObjectiveId : d1737d22-a8ea-4de7-9bd0-33395d2a7419

RequestedServiceObjectiveName :

ElasticPoolName : ElasticPool01

EarliestRestoreDate :

Tags :



This command creates a database named Database01 in the elastic pool named ElasticPool01 on server Server01.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... qldatabase

Get-AzureRmSqlDatabaseBackupLongTermRetentionPolicy

New-AzureRmSqlElasticPool

New-AzureRmSqlServer

Remove-AzureRmSqlDatabase

Resume-AzureRmSqlDatabase

Set-AzureRmSqlDatabaseBackupLongTermRetentionPolicy

Suspend-AzureRmSqlDatabase

SQL Database Documentation https://docs.microsoft.com/azure/sql-database/