forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4-MembersToIncludeInDatabaseRole.ps1
36 lines (31 loc) · 1.03 KB
/
4-MembersToIncludeInDatabaseRole.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
<#
.DESCRIPTION
This example shows how to do the following:
1. Ensure that the database role named ReportViewer is present in the
AdventureWorks database on instance sqltest.company.local\DSC.
2. Ensure that users CONTOSO\Barbara and CONTOSO\Fred will always be
members of the role.
#>
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlDatabaseRole 'ReportViewer_IncludeRoleMembers'
{
ServerName = 'sqltest.company.local'
InstanceName = 'DSC'
DatabaseName = 'AdventureWorks'
Name = 'ReportViewer'
MembersToInclude = @('CONTOSO\Barbara', 'CONTOSO\Fred')
Ensure = 'Present'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}