Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

New-AzSqlDatabaseCopy

Module:
Az.Sql Module

Creates a copy of a SQL Database that uses the snapshot at the current time.

Syntax

DtuBasedDatabase (Default)

New-AzSqlDatabaseCopy
 [-DatabaseName] <String>
 [-ServerName] <String>
 [-ResourceGroupName] <String>
 -CopyDatabaseName <String>
 [-ServiceObjectiveName <String>]
 [-ElasticPoolName <String>]
 [-Tags <Hashtable>]
 [-CopyResourceGroupName <String>]
 [-CopyServerName <String>]
 [-AsJob]
 [-LicenseType <String>]
 [-BackupStorageRedundancy <String>]
 [-ZoneRedundant]
 [-AssignIdentity]
 [-EncryptionProtector <String>]
 [-UserAssignedIdentityId <String[]>]
 [-KeyList <String[]>]
 [-FederatedClientId <Guid>]
 [-EncryptionProtectorAutoRotation]
 [-DefaultProfile <IAzureContextContainer>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

VcoreBasedDatabase

New-AzSqlDatabaseCopy
 [-DatabaseName] <String>
 [-ServerName] <String>
 [-ResourceGroupName] <String>
 -CopyDatabaseName <String>
 -ComputeGeneration <String>
 -VCore <Int32>
 [-Tags <Hashtable>]
 [-CopyResourceGroupName <String>]
 [-CopyServerName <String>]
 [-AsJob]
 [-LicenseType <String>]
 [-BackupStorageRedundancy <String>]
 [-ZoneRedundant]
 [-AssignIdentity]
 [-EncryptionProtector <String>]
 [-UserAssignedIdentityId <String[]>]
 [-KeyList <String[]>]
 [-FederatedClientId <Guid>]
 [-EncryptionProtectorAutoRotation]
 [-DefaultProfile <IAzureContextContainer>]
 [-WhatIf]
 [-Confirm]
 [<CommonParameters>]

Description

The New-AzSqlDatabaseCopy cmdlet creates a copy of an Azure SQL Database that uses the snapshot of the data at the current time. Use this cmdlet instead of the Start-AzSqlDatabaseCopy cmdlet to create a one-time database copy. This cmdlet returns the Database object of the copy. Note: Use the New-AzSqlDatabaseSecondary cmdlet to configure geo-replication for a database. This cmdlet is also supported by the SQL Server Stretch Database service on Azure.

Examples

Example 1

Creates a copy of a SQL Database that uses the snapshot at the current time. (autogenerated)

New-AzSqlDatabaseCopy -CopyDatabaseName <String> -CopyResourceGroupName <String> -CopyServerName <String> -DatabaseName db1 -ResourceGroupName MyResourceGroup -ServerName s1

Example 2

Creates a copy of a SQL Database that uses the snapshot at the current time. (autogenerated)

New-AzSqlDatabaseCopy -CopyDatabaseName <String> -CopyResourceGroupName <String> -CopyServerName <String> -DatabaseName db1 -ResourceGroupName MyResourceGroup -ServerName s1 -ServiceObjectiveName 'S1'

Parameters

-AsJob

Run cmdlet in the background

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-AssignIdentity

Generate and assign a Microsoft Entra identity for this database for use with key management services like Azure KeyVault.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-BackupStorageRedundancy

The Backup storage redundancy used to store backups for the SQL Database. Options are: Local, Zone and Geo.

Parameter properties

Type:String
Default value:None
Accepted values:Local, Zone, Geo, GeoZone
Supports wildcards:False
DontShow:False

Parameter sets

-ComputeGeneration

The compute generation to assign to the new copy.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Family

Parameter sets

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

-CopyDatabaseName

Specifies the name of the SQL Database copy.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-CopyResourceGroupName

Specifies the name of the Azure Resource Group in which to assign the copy.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-CopyServerName

Specifies the name of the SQL Server which hosts the copy.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DatabaseName

Specifies the name of the SQL Database to copy.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

-ElasticPoolName

Specifies the name of the elastic pool in which to assign the copy.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-EncryptionProtector

The encryption protector key for SQL Database copy.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-EncryptionProtectorAutoRotation

The AKV Key Auto Rotation status

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-FederatedClientId

The federated client id for the SQL Database. It is used for cross tenant CMK scenario.

Parameter properties

Type:

Nullable<T>[Guid]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-KeyList

The list of AKV keys for the SQL Database copy.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-LicenseType

The license type for the Azure Sql database.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ResourceGroupName

Specifies the name of the Resource Group that contains the database to copy.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ServerName

Specifies the name of the SQL Server that contains the database to copy.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-ServiceObjectiveName

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

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Tags

Specifies the Key-value pairs in the form of a hash table to associate with the Azure SQL Database copy. For example: @{key0="value0";key1=$null;key2="value2"}

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Tag

Parameter sets

-UserAssignedIdentityId

The list of user assigned identity for the SQL Database copy.

Parameter properties

Type:

String[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-VCore

The Vcore numbers of the Azure Sql Database copy.

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Capacity

Parameter sets

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

-ZoneRedundant

The zone redundancy to associate with the Azure Sql Database. This property is only settable for Hyperscale edition databases.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

Outputs

AzureSqlDatabaseCopyModel

Related Links


Feedback

Was this page helpful?