forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1-UseParameterPermissionToInclude.ps1
37 lines (35 loc) · 1.14 KB
/
1-UseParameterPermissionToInclude.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<#
.DESCRIPTION
This example shows how to ensure that the user account CONTOSO\SQLAdmin
is granted "Connect" and "Update" permissions for the databases DB01.
Any existing permissions in the states Grant, Deny, and GrantWithGrant will
not be changed (unless the contradict with the desired state).
#>
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlDatabasePermission 'Set_Database_Permissions_SQLAdmin_DB01'
{
ServerName = 'sql01.company.local'
InstanceName = 'DSC'
DatabaseName = 'DB01'
Name = 'CONTOSO\SQLAdmin'
Credential = $SqlAdministratorCredential
PermissionToInclude = @(
DatabasePermission
{
State = 'Grant'
Permission = @('Connect', 'Update')
}
)
}
}
}