Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
setup.exe ([issue #1171](https://github.com/dsccommunity/SqlServerDsc/issues/1171)).
- SqlRSSetup
- The DSC resource has been refactored into a class-based resource.
- `Set-SqlDscServerPermission`
- Added support for assigning permissions to a server role.

### Fixed

Expand Down
11 changes: 6 additions & 5 deletions source/Public/Set-SqlDscServerPermission.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<#
.SYNOPSIS
Set permission for a login.
Set permission for a server principal.

.DESCRIPTION
This command sets the permissions for a existing login on a SQL Server
This command sets the permissions for a existing principal on a SQL Server
Database Engine instance.

.PARAMETER ServerObject
Expand Down Expand Up @@ -94,14 +94,15 @@ function Set-SqlDscServerPermission
$ConfirmPreference = 'None'
}

$testSqlDscIsLoginParameters = @{
$testSqlDscIsPrincipalParameters = @{
ServerObject = $ServerObject
Name = $Name
}

$isLogin = Test-SqlDscIsLogin @testSqlDscIsLoginParameters
$isLogin = Test-SqlDscIsLogin @testSqlDscIsPrincipalParameters
$isRole = Test-SqlDscIsRole @testSqlDscIsPrincipalParameters

if ($isLogin)
if ($isLogin -or $isRole)
{
# Get the permissions names that are set to $true in the ServerPermissionSet.
$permissionName = $Permission |
Expand Down
2 changes: 1 addition & 1 deletion source/en-US/SqlServerDsc.strings.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ConvertFrom-StringData @'
IsDatabasePrincipal_DatabaseMissing = The database '{0}' cannot be found.

## Get-SqlDscServerPermission, Set-SqlDscServerPermission
ServerPermission_MissingPrincipal = The principal '{0}' is not a login on the instance '{1}'.
ServerPermission_MissingPrincipal = The principal '{0}' is not a login nor role on the instance '{1}'.

## Set-SqlDscServerPermission
ServerPermission_IgnoreWithGrantForStateDeny = The parameter WithGrant cannot be used together with the state Deny, the parameter WithGrant is ignored.
Expand Down
Loading
Loading