SALES: 1-800-867-1380

New-AzureSqlDatabase

New-AzureSqlDatabase

Creates a new Azure SQL Database in the specified SQL Database Server.

Syntax

Parameter Set: ByConnectionContext
New-AzureSqlDatabase [-ConnectionContext] <IServerDataServiceContext> [-DatabaseName] <String> [-Collation <String> ] [-Edition <DatabaseEdition> ] [-Force] [-MaxSizeBytes <Int64> ] [-MaxSizeGB <Int32> ] [-ServiceObjective <ServiceObjective> ] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: ByServerName
New-AzureSqlDatabase [-ServerName] <String> [-DatabaseName] <String> [-Collation <String> ] [-Edition <DatabaseEdition> ] [-Force] [-MaxSizeBytes <Int64> ] [-MaxSizeGB <Int32> ] [-ServiceObjective <ServiceObjective> ] [-Confirm] [-WhatIf] [ <CommonParameters>]




Detailed Description

The New-AzureSqlDatabase cmdlet creates a new SQL Database in the specified SQL Database Server. You can specify the server with a SQL Database Server connection context that you create using the New-AzureSqlDatabaseServerContext cmdlet. Or, if you specify the SQL Database Server name, the cmdlet uses the current Azure subscription information to authenticate the request to access the server.

When you create a new database by specifying a SQL Database Server, the New-AzureSqlDatabase cmdlet creates a temporary connection context using the specified SQL Database Server name and the current Azure subscription information to perform the operation.

Parameters

-Collation<String>

Collation for the newly created SQL Database.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ConnectionContext<IServerDataServiceContext>

The connection context to a SQL Database Server where you want to create new SQL Database.


Aliases

Context

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByValue)

Accept Wildcard Characters?

false

-DatabaseName<String>

The name of the new database.


Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Edition<DatabaseEdition>

The edition for the SQL Database. Acceptable values are Web, Business, Basic, Standard, and Premium. The default value is Web.

Note: The Premium value of this parameter is a feature which is currently available in preview. To learn more about the preview, please see http://go.microsoft.com/fwlink/p/?LinkId=308949.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Force

Allows the action to complete without prompting the user for confirmation.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MaxSizeBytes<Int64>

The maximum size for the database in bytes. You can specify either this parameter or MaxSizeGB. See the MaxSizeGB parameter for acceptable values based on edition.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-MaxSizeGB<Int32>

The maximum size for the database in gigabytes. You can specify either this parameter or MaxSizeBytes. The acceptable values differ based on edition.

Web Edition values: 1 or 5

Business Edition values: 10, 20, 30, 40, 50, 100, or 150


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ServerName<String>

The SQL Database Server name where you want to create new SQL Database.


Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-ServiceObjective<ServiceObjective>

If specified, an object representing the new service objective for this database. This value represents the level of resources assigned to this database.

Note: This parameter is a feature of the preview of Azure SQL Database Premium Edition. Only participants in the preview are able to use this parameter. To learn more about the preview, please see http://go.microsoft.com/fwlink/p/?LinkId=308949.


Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Confirm

Prompts you for confirmation before running the cmdlet.


Required?

false

Position?

named

Default Value

false

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-WhatIf

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, -OutBuffer, and -OutVariable. For more information, see  about_CommonParameters (http://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.WindowsAzure.Commands.SqlDatabase.Services.Server.Database

Notes

  • To delete a database that was created by New-AzureSqlDatabase, use the Remove-AzureSqlDatabase cmdlet.

Examples

-------------------------- EXAMPLE 1 --------------------------

This example creates a new SQL Database with the name, "Database1", for the specified SQL Database Server connection context “$ctx”.


C:\PS>$database1 = New-AzureSqlDatabase -ConnectionContext $ctx -DatabaseName "Database1" -Edition "Business" -MaxSizeGB 50 -Collation "SQL_Latin1_General_CP1_CI_AS"

-------------------------- EXAMPLE 2 --------------------------

This example creates a new database with the name, "Database1", in the specified SQL Database Server "lpqd0zbr8y". The cmdlet uses the current Azure subscription information to authenticate the request to access the server.


C:\PS>$database1 = New-AzureSqlDatabase -ServerName "lpqd0zbr8y" -DatabaseName "Database1" -Edition "Business" -MaxSizeGB 50 -Collation "SQL_Latin1_General_CP1_CI_AS"

Related topics

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft