forked from dsccommunity/SqlServerDsc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
1-AddDatabaseRole.ps1
40 lines (36 loc) · 1.18 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
<#
.EXAMPLE
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'
Database = 'AdventureWorks'
Name = 'ReportEditor'
Ensure = 'Present'
PsDscRunAsCredential = $SqlAdministratorCredential
}
SqlDatabaseRole ReportViewer_AddRole
{
ServerName = 'sqltest.company.local'
InstanceName = 'DSC'
Database = 'AdventureWorks'
Name = 'ReportViewer'
Ensure = 'Present'
PsDscRunAsCredential = $SqlAdministratorCredential
}
}
}