New-Database
SYNOPSIS
Create a new SQL database.
SYNTAX
New-Database [-HEATtask] <String> [-dbname] <String> [-OrgEenheid] <String> [-SQLServer] <String>
[-ADAuth] <String> [-SQLAuth] <String> [[-PwdstateListID] <String>] [[-MDAGuid] <String>] [<CommonParameters>]
DESCRIPTION
This function creates a new SQL database with the following features: - Contained database. - Custom roles in the database. - SQL users (Admin and User) with randomly generated passwords, stored in Passwordstate. - Host alias created in Infoblox. - Optionally added to an Always-On Group. - Extended properties added to the database.
EXAMPLES
EXAMPLE 1
New-Database -HEATtask "12345" -dbname "TestDB" -OrgEenheid "Finance" -SQLServer "SQLInstance1" -ADAuth "Y" -SQLAuth "Y" -MDAGuid "9e4d7db3-2b35-4ce2-0ad1-08ddb5521914"
Creates a new SQL database named "TestDB" on "SQLInstance1" with AD and SQL authentication enabled.
EXAMPLE 2
New-Database -HEATtask "67890" -dbname "ProdDB" -OrgEenheid "IT" -SQLServer "SQLInstance2" -ADAuth "N" -SQLAuth "Y" -PwdstateListID 123 -MDAGuid "9e4d7db3-2b35-4ce2-0ad1-08ddb5521914"
Creates a new SQL database named "ProdDB" on "SQLInstance2" with SQL authentication enabled and credentials stored in Passwordstate list ID 123.
EXAMPLE 3
New-Database -HEATtask "54321" -dbname "HRDB" -OrgEenheid "HR" -SQLServer "SQLInstance3" -ADAuth "Y" -SQLAuth "N" -MDAGuid "9e4d7db3-2b35-4ce2-0ad1-08ddb5521914"
Creates a new SQL database named "HRDB" on "SQLInstance3" with AD authentication enabled and SQL authentication disabled.
PARAMETERS
-HEATtask
The HEAT task ID associated with the database creation.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-dbname
The name of the database to be created.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-OrgEenheid
The organizational unit associated with the database.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SQLServer
The name of the SQL Server instance where the database will be created.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ADAuth
Indicates whether Active Directory authentication should be enabled. Valid values are: - Y: Enable AD authentication. - N: Disable AD authentication.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-SQLAuth
Indicates whether SQL authentication should be enabled. Valid values are: - Y: Enable SQL authentication. - N: Disable SQL authentication.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-PwdstateListID
The Passwordstate list ID where the generated credentials will be stored. Defaults to 733.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: 733
Accept pipeline input: False
Accept wildcard characters: False
-MDAGuid
The Masterdataappliaties Guid.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
NOTES
YYYY-MM-DD - Naam - Wat gewijzigd 2018-02-08 - MM - Initieel script - Aanpassing zodat dit met SQLServer-cmdlets werkt 2020-04-17 - JT - Owner wordt op sa ingesteld 2020-08-18 - JT - ADR op SQL2019 DB's ingeschakeld 2023-05-05 - MM - Toevoegen aanmaken L_SQL en LL_NET_FW groepen + toevoegen van ExtendedProperties 2025-01-28 - MM - Herwerken van de code zodat er gebruik gemaakt wordt van dbatools cmdlets 2025-08-12 - KJ - Masterdataapplicaties GUID parameter & extended property