Restores or attaches to SQL Server the specified Dynamics 365 database from a Microsoft SQL Server MDF (raw database file) or a SQL Server backup file.
The Add-CrmDatabase cmdlet restores or attaches to SQL Server the specified Dynamics 365 organization database from a backup of an organization database or from a detached organization database.
Restores the specified SQL backup contoso_MSCRM.BAK file of a Dynamics 365 organization database to the SQL Server named sqlserver.
Parameters
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type:
SwitchParameter
Default value:
None
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
-Credential
Variable that contains the user credentials used for signing in to Dynamics 365 on-premises organization. To establish this variable, run the PowerShell command $Cred = Get-Credential.
Parameter properties
Type:
PSCredential
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
-DatabaseBackupFileName
Specifies the name of the SQL Server backup file. This should be a full backup file of the source Dynamics 365 organization database. This file must be accessible from the computer that's running SQL Server.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
RestoreDB
Position:
2
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DatabaseLdfFileName
The name of the SQL Server database LDF file. This file must be accessible from the computer that's running SQL Server.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
AttachDB
Position:
3
Mandatory:
False
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DatabaseMdfFileName
Specifies the name of the SQL Server Database MDF file. This file must be accessible from the computer that's running SQL Server.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
AttachDB
Position:
2
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DatabaseName
Specifies the name of the organization database to import.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
1
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Diag
Turns on stack traces for error reports returned from Dynamics 365 service calls. Enabling this emits a detailed error message, including a stack trace, when an error is encountered by the Dynamics 365 PowerShell command.
Parameter properties
Type:
SwitchParameter
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-DwsServerUrl
The URL of the Deployment Web Service. This should be in the format: https://<serverurl>, for example, https://contoso.
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:
True
Value from remaining arguments:
False
-SqlServerName
Specifies a string that contains the name of the Microsoft SQL Server or SQL Server instance on which to restore or attach the organization database.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
0
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
False
Value from remaining arguments:
False
-Timeout
For internal use only.
Parameter properties
Type:
Int32
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
Named
Mandatory:
False
Value from pipeline:
True
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.