Skip to content

Commit 885bc1e

Browse files
Copilotjohlju
andcommitted
Add documentation for single permission per DSC_DatabaseObjectPermission instance
Co-authored-by: johlju <[email protected]>
1 parent 9aa636c commit 885bc1e

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
176176

177177
### Fixed
178178

179+
- `SqlDatabaseObjectPermission`
180+
- Added documentation clarifying that each `DSC_DatabaseObjectPermission`
181+
instance can only contain a single permission name. Specifying multiple
182+
permissions as a comma-separated string causes an error
183+
([issue #2020](https://github.com/dsccommunity/SqlServerDsc/issues/2020)).
179184
- `Get-SqlDscRSSetupConfiguration`
180185
- Fixed issue where the function doesn't provide an output for SSRS 2016 instances
181186
because registry paths were using `InstanceName` instead of `InstanceId`.

source/DSCResources/DSC_SqlDatabaseObjectPermission/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,48 @@ property names of the [ObjectPermissionSet](https://docs.microsoft.com/en-us/dot
2020

2121
## Known issues
2222

23+
### Only one permission per `DSC_DatabaseObjectPermission` instance
24+
25+
Each `DSC_DatabaseObjectPermission` instance can only contain a single permission
26+
name. When multiple permissions need to be configured for the same state (e.g.,
27+
`Grant`), each permission must be specified in a separate `DSC_DatabaseObjectPermission`
28+
block. Specifying multiple permissions as a comma-separated string (e.g.,
29+
`'DELETE,INSERT,SELECT'`) will cause an error similar to:
30+
31+
```text
32+
Cannot bind argument to parameter 'ReferenceObject' because it is null.
33+
```
34+
35+
**Incorrect usage:**
36+
37+
<!-- markdownlint-disable MD013 - Line length -->
38+
```powershell
39+
Permission = @(
40+
DSC_DatabaseObjectPermission {
41+
State = 'Grant'
42+
Permission = 'DELETE,INSERT,SELECT' # This will fail - multiple permissions in single string
43+
}
44+
)
45+
```
46+
<!-- markdownlint-enable MD013 - Line length -->
47+
48+
**Correct usage:**
49+
50+
```powershell
51+
Permission = @(
52+
DSC_DatabaseObjectPermission {
53+
State = 'Grant'
54+
Permission = 'DELETE'
55+
}
56+
DSC_DatabaseObjectPermission {
57+
State = 'Grant'
58+
Permission = 'INSERT'
59+
}
60+
DSC_DatabaseObjectPermission {
61+
State = 'Grant'
62+
Permission = 'SELECT'
63+
}
64+
)
65+
```
66+
2367
All issues are not listed here, see [here for all open issues](https://github.com/dsccommunity/SqlServerDsc/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+SqlDatabaseObjectPermission).

0 commit comments

Comments
 (0)