-
Notifications
You must be signed in to change notification settings - Fork 149
WebConfigPropertyCollection
Parameter | Attribute | DataType | Description | Allowed Values |
---|---|---|---|---|
WebsitePath | Key | String | Path to website location (IIS or WebAdministration format). | |
Filter | Key | String | Filter used to locate property collection to update. | |
CollectionName | Key | String | Name of the property collection to update. | |
ItemName | Key | String | Name of the property collection item to update. | |
ItemKeyName | Key | String | Name of the key of the property collection item to update. | |
ItemKeyValue | Key | String | Value of the key of the property collection item to update. | |
ItemPropertyName | Key | String | Name of the property of the property collection item to update. | |
ItemPropertyValue | Write | String | Value of the property of the property collection item to update. | |
Ensure | Write | String | Indicates if the property and value of the property collection item should be present or absent. Defaults to Present. |
Present , Absent
|
The WebConfigPropertyCollection
DSC resource is used to ensure the value of an
identified property collection item's property in the web.config file.
Builds upon the deprecated WebConfigKeyValue resource to support all web.config elements that contain collections of child items.
- Target machine must be running Windows Server 2012 R2 or later.
All issues are not listed here, see here for all open issues.
Disables the HTTP TRACE method at the server level.
This example shows how to use the WebConfigPropertyCollection DSC resource for adding a configuration element. It will add an "add" element to the system.webServer/security/requestFiltering/verbs collection to disable the HTTP TRACE verb.
Configuration Sample_WebConfigPropertyCollection_Add
{
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) - Disable HTTP TRACE method"
{
WebsitePath = 'MACHINE/WEBROOT/APPHOST'
Filter = 'system.webServer/security/requestFiltering'
CollectionName = 'verbs'
ItemName = 'add'
ItemKeyName = 'verb'
ItemKeyValue = 'TRACE'
ItemPropertyName = 'allowed'
ItemPropertyValue = 'false'
Ensure = 'Present'
}
}
}
Removes disabling the HTTP TRACE method at the server level.
This example shows how to use the WebConfigPropertyCollection DSC resource for removing a configuration element. It will remove the "add" element from the system.webServer/security/requestFiltering/verbs collection (if present) for disabling the HTTP TRACE verb.
Configuration Sample_WebConfigPropertyCollection_Remove
{
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 disabling HTTP TRACE method"
{
WebsitePath = 'MACHINE/WEBROOT/APPHOST'
Filter = 'system.webServer/security/requestFiltering'
CollectionName = 'verbs'
ItemName = 'add'
ItemKeyName = 'verb'
ItemKeyValue = 'TRACE'
ItemPropertyName = 'allowed'
Ensure = 'Absent'
}
}
}
Make appsettings.json inaccessible to clients.
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'
}
}
}
Removes making appsettings.json inaccessible to clients.
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'
}
}
}
- Home
- IisFeatureDelegation
- IisLogging
- IisMimeTypeMapping
- IisModule
- SslSettings
- WebApplication
- WebApplicationHandler
- WebAppPool
- WebAppPoolDefaults
- WebConfigProperty
- WebConfigPropertyCollection
- WebSite
- WebSiteDefaults
- WebVirtualDirectory
- xIisFeatureDelegation
- xIisHandler
- xIisLogging
- xIisMimeTypeMapping
- xIisModule
- xSslSettings
- xWebApplication
- xWebAppPool
- xWebAppPoolDefaults
- xWebConfigKeyValue
- xWebConfigProperty
- xWebConfigPropertyCollection
- xWebSite
- xWebSiteDefaults
- xWebVirtualDirectory