New-AzSqlDatabaseCopy
Creates a copy of a SQL Database that uses the snapshot at the current time.
Syntax
DtuBasedDatabase (Default)
New-AzSqlDatabaseCopy
[-DatabaseName]
[-ServerName]
[-ResourceGroupName]
-CopyDatabaseName
[-ServiceObjectiveName ]
[-ElasticPoolName ]
[-Tags ]
[-CopyResourceGroupName ]
[-CopyServerName ]
[-AsJob]
[-LicenseType ]
[-BackupStorageRedundancy ]
[-ZoneRedundant]
[-AssignIdentity]
[-EncryptionProtector ]
[-UserAssignedIdentityId ]
[-KeyList ]
[-FederatedClientId ]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile ]
[-WhatIf]
[-Confirm]
[]
VcoreBasedDatabase
New-AzSqlDatabaseCopy
[-DatabaseName]
[-ServerName]
[-ResourceGroupName]
-CopyDatabaseName
-ComputeGeneration
-VCore
[-Tags ]
[-CopyResourceGroupName ]
[-CopyServerName ]
[-AsJob]
[-LicenseType ]
[-BackupStorageRedundancy ]
[-ZoneRedundant]
[-AssignIdentity]
[-EncryptionProtector ]
[-UserAssignedIdentityId ]
[-KeyList ]
[-FederatedClientId ]
[-EncryptionProtectorAutoRotation]
[-DefaultProfile ]
[-WhatIf]
[-Confirm]
[]
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 -CopyResourceGroupName -CopyServerName -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 -CopyResourceGroupName -CopyServerName -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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
VcoreBasedDatabase
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-CopyDatabaseName
Specifies the name of the SQL Database copy.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DatabaseName
Specifies the name of the SQL Database to copy.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: 2
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
DtuBasedDatabase
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-EncryptionProtector
The encryption protector key for SQL Database copy.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-EncryptionProtectorAutoRotation
The AKV Key Auto Rotation status
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-FederatedClientId
The federated client id for the SQL Database. It is used for cross tenant CMK scenario.
Parameter properties
Type: Nullable [ Guid ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-LicenseType
The license type for the Azure Sql database.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: 0
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-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
(All)
Position: 1
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: True
Value from remaining arguments: False
-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
DtuBasedDatabase
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
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"}
Type: Hashtable
Default value: None
Supports wildcards: False
DontShow: False
Aliases: Tag
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
VcoreBasedDatabase
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-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
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
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 .
Outputs