SqlDatabases creates and manages SQL Server databases.
Use this resource when you need to create databases on a SQL Server instance. It handles database creation with configurable collation and recovery model. Use this for provisioning application databases as part of your infrastructure deployment.
For more information about SQL Server databases, please read the following articles Create a Database and Delete a Database.
This resource sets the recovery model for a database. The recovery model controls how transactions are logged, whether the transaction log requires (and allows) backing up, and what kinds of restore operations are available. Three recovery models exist: full, simple, and bulk-logged. Read more about recovery model in the article View or Change the Recovery Model of a Database.
Source |
|
DSC Resource |
|
Documentation |
-
Target machine must be running Windows Server 2012 or later.
-
Target machine must be running SQL Server Database Engine 2012 or later.
-
Valid values per SQL Server version for the parameter
CompatibilityLevelcan be found in the article ALTER DATABASE (Transact-SQL) Compatibility Level.
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
DefaultInstanceName |
String |
Default SQL InstanceName |
Default: |
|
Mandatory |
Hashtable[] |
List of SQL databases. |
| Parameter | Attribute | DataType | Description | Allowed Values |
|---|---|---|---|---|
Name |
Key |
String |
The name of the SQL Server database. |
|
InstanceName |
Key |
String |
The name of the SQL Server instance to be configured. |
|
Ensure |
String |
Determines whether the database should be added ( |
|
|
ServerName |
String |
The host name of the SQL Server to be configured. Default value is the current computer name. |
||
Collation |
String |
The name of the collation to use for the new database. Default value is the collation used by the server. |
||
CompatibilityLevel |
String |
Specifies the version of the SQL Database Compatibility Level to use for the specified database. |
|
|
RecoveryModel |
String |
The recovery model for the specified database. |
|
SqlDatabases:
Values:
- Name: MyDatabase1
InstanceName: MSSQLSERVER
ServerName: SQL1
- Name: MyDatabase2
InstanceName: MSSQLSERVER
ServerName: SQL1
Collation: SQL_Latin1_General_CP1_CI_AS
RecoveryModel: Full