Skip to content

New-SQLSecGroup

SYNOPSIS

Create a new SQL Security Group and assign it to a database.

SYNTAX

New-SQLSecGroup [-Ticket] <String> [-dbname] <String> [-Type] <String> [<CommonParameters>]

DESCRIPTION

This function creates a new SQL Security Group in Active Directory and assigns it to a specified SQL Server database. It checks if the database exists, creates the security group in AD if it does not already exist, and assigns the appropriate permissions based on the specified type.

EXAMPLES

EXAMPLE 1

New-SQLSecGroup -Ticket "12345" -dbname "TestDB" -Type "R"

Creates a new SQL Security Group with read-only permissions for the "TestDB" database.

EXAMPLE 2

New-SQLSecGroup -Ticket "67890" -dbname "ProdDB" -Type "A"

Creates a new SQL Security Group with admin permissions for the "ProdDB" database.

EXAMPLE 3

New-SQLSecGroup -Ticket "54321" -dbname "FinanceDB" -Type "W"

Creates a new SQL Security Group with read/write/execute permissions for the "FinanceDB" database.

PARAMETERS

-Ticket

The ticket ID associated with the creation of the SQL Security Group.

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 where the SQL Security Group will be assigned.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Type

The type of SQL Security Group to create. Valid values are: - A: Admin (db_owner) permissions. - D: Database owner permissions. - R: Read-only permissions. - W: Read/Write/Execute permissions.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
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