forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1-AddDatabaseRole.ps1
43 lines (37 loc) · 1.21 KB
/
1-AddDatabaseRole.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
38
39
40
41
42
43
<#
.DESCRIPTION
This example shows how to ensure that the database roles named ReportEditor
and ReportViewer are present in the AdventureWorks database on instance
sqltest.company.local\DSC.
#>
Configuration Example
{
param
(
[Parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$SqlAdministratorCredential
)
Import-DscResource -ModuleName 'SqlServerDsc'
node localhost
{
SqlDatabaseRole 'ReportEditor_AddRole'
{
ServerName = 'sqltest.company.local'
InstanceName = 'DSC'
DatabaseName = 'AdventureWorks'
Name = 'ReportEditor'
Ensure = 'Present'
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlDatabaseRole 'ReportViewer_AddRole'
{
ServerName = 'sqltest.company.local'
InstanceName = 'DSC'
DatabaseName = 'AdventureWorks'
Name = 'ReportViewer'
Ensure = 'Present'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}