-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebConfigPropertyCollection: Allow deleting single item property coll…
…ections, update examples, remove duplicate resource documentation (#644)
- Loading branch information
Showing
9 changed files
with
240 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...esources/WebConfigPropertyCollection/Sample_WebConfigPropertyCollection_SingleItemAdd.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<# | ||
.SYNOPSIS | ||
Make appsettings.json inaccessible to clients. | ||
.DESCRIPTION | ||
This example shows how to use the WebConfigPropertyCollection DSC resource for adding a single item configuration element. | ||
It will add an "add" element to the system.webServer/security/requestFiltering/hiddenSegments collection to block appsettings.json. | ||
#> | ||
Configuration Sample_WebConfigPropertyCollection_SingleItemAdd | ||
{ | ||
param | ||
( | ||
# Target nodes to apply the configuration. | ||
[Parameter()] | ||
[String[]] | ||
$NodeName = 'localhost' | ||
) | ||
|
||
# Import the modules that define custom resources | ||
Import-DscResource -ModuleName WebAdministrationDsc | ||
|
||
Node $NodeName | ||
{ | ||
WebConfigPropertyCollection "$($NodeName) - Block appsettings.json" | ||
{ | ||
WebsitePath = 'MACHINE/WEBROOT/APPHOST' | ||
Filter = 'system.webServer/security/requestFiltering' | ||
CollectionName = 'hiddenSegments' | ||
ItemName = 'add' | ||
ItemKeyName = '*' | ||
ItemKeyValue = 'appsettings.json' | ||
ItemPropertyName = 'segment' | ||
ItemPropertyValue = 'appsettings.json' | ||
Ensure = 'Present' | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...urces/WebConfigPropertyCollection/Sample_WebConfigPropertyCollection_SingleItemRemove.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<# | ||
.SYNOPSIS | ||
Removes making appsettings.json inaccessible to clients. | ||
.DESCRIPTION | ||
This example shows how to use the WebConfigPropertyCollection DSC resource for removing a single item configuration element. | ||
It will remove the "add" element from the system.webServer/security/requestFiltering/hiddenSegments collection (if present) for blocking appsettings.json. | ||
#> | ||
Configuration Sample_WebConfigPropertyCollection_SingleItemRemove | ||
{ | ||
param | ||
( | ||
# Target nodes to apply the configuration. | ||
[Parameter()] | ||
[String[]] | ||
$NodeName = 'localhost' | ||
) | ||
|
||
# Import the modules that define custom resources | ||
Import-DscResource -ModuleName WebAdministrationDsc | ||
|
||
Node $NodeName | ||
{ | ||
WebConfigPropertyCollection "$($NodeName) - Remove blocking appsettings.json" | ||
{ | ||
WebsitePath = 'MACHINE/WEBROOT/APPHOST' | ||
Filter = 'system.webServer/security/requestFiltering' | ||
CollectionName = 'hiddenSegments' | ||
ItemName = 'add' | ||
ItemKeyName = '*' | ||
ItemKeyValue = 'appsettings.json' | ||
ItemPropertyName = 'segment' | ||
Ensure = 'Absent' | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters