Skip to content

xWebConfigPropertyCollection: Multiple Properties #534

@pyrostew

Description

@pyrostew

Details of the scenario you tried and the problem that is occurring

I am trying to add some entries to the "system.ftpserver/security/authorization" collection, both in the root of an FTPSite and in 2 virtual directories within that site. Essentially I am trying to match the output of the script below.

import-module webadministration

new-webftpsite -Name "FTPSite" -Port "21" -physicalpath "D:\resources" -Force

set-itemproperty "IIS:\Sites\FTPSite" -name ftpServer.security.authentication.basicauthentication.enabled -Value $true
set-itemproperty "IIS:\Sites\FTPSite" -name ftpServer.security.ssl.controlchannelpolicy -value 0
set-itemproperty "IIS:\Sites\FTPSite" -name ftpServer.security.ssl.datachannelpolicy -value 0
add-webconfiguration "system.ftpserver/security/authorization" -value @{accessType="Allow";users="User1,User2,User3";permissions=3} -PSPath IIS:\Sites\FTPSite

New-WebVirtualDirectory -Site "FTPSite" -Name "Config" -PhysicalPath "D:\Config"
Remove-WebConfigurationProperty "system.ftpserver/security/authorization" -PSPath IIS:\Sites\FTPSite\Config -Name "."
add-webconfiguration "system.ftpserver/security/authorization" -value @{accessType="Allow";users="User2";permissions=3} -PSPath IIS:\Sites\FTPSite\Config

New-WebVirtualDirectory -Site "FTPSite" -Name "AppData" -PhysicalPath "D:\AppData"
Remove-WebConfigurationProperty "system.ftpserver/security/authorization" -PSPath IIS:\Sites\FTPSite\AppData -Name "."
add-webconfiguration "system.ftpserver/security/authorization" -value @{accessType="Allow";users="User3";permissions=3} -PSPath IIS:\Sites\FTPSite\AppData

The problem is that I can't find a way to use the xWebConfigPropertyCollection resource to set an entity in this collection. There are 3 properties that need to be set at the same time, and the resource doesn't seem to have the functionality to achieve this.

I am aware that there is a PR (#425) open with a new feature for adding FTPSites which will cover most of what I need to do, however I don't think it will help with modifying the collections on the Virtual Folders.

If I have completely missed something and this is really simple, please point me in the right direction, otherwise I think there may need to be an enhancement to the resource.

Verbose logs showing the problem

I have tried all the permutations I can think of, which has produced many different errors, far too many to display here.

Suggested solution to the issue

N/A

The DSC configuration that is used to reproduce the issue (as detailed as possible)

This is as far as I have managed to get, I have tried laying this out similar to the examples for this resource without success. I have also tried the format suggested in Issue #379, again without success.

        xWebConfigPropertyCollection FTPRootAuthorizationAccessType
        {
            WebsitePath = "IIS:\Sites\FTPSite"
            Filter = "system.ftpserver/security/authorization"
            CollectionName = "."
            ItemName = "add"
            ItemKeyName = "Key"
            ItemKeyValue = "1"
            ItemPropertyName = "AccessType"
            ItemPropertyValue = "Allow"
        }

        xWebConfigPropertyCollection FTPRootAuthorizationUsers
        {
            WebsitePath = "IIS:\Sites\FTPSite"
            Filter = "system.ftpserver/security/authorization"
            CollectionName = "."
            ItemName = "add"
            ItemKeyName = "Key"
            ItemKeyValue = "1"
            ItemPropertyName = "Users"
            ItemPropertyValue = "User1,User2,User3"
        }

        xWebConfigPropertyCollection FTPRootAuthorizationPermissions
        {
            WebsitePath = "IIS:\Sites\FTPSite"
            Filter = "system.ftpserver/security/authorization"
            CollectionName = "."
            ItemName = "add"
            ItemKeyName = "Key"
            ItemKeyValue = "1"
            ItemPropertyName = "Permissions"
            ItemPropertyValue = "3"
        }

        xWebConfigPropertyCollection FTPConfigAuthorization
        {
            WebsitePath = "IIS:\Sites\FTPSite\Config"
            Filter = "system.ftpserver/security/authorization"
            CollectionName = "."
            ItemName = "add"
            ItemKeyName = "*"
            ItemKeyValue = "Allow"
            ItemPropertyName = "AccessType"
            ItemPropertyValue = "Allow"
        }

        xWebConfigPropertyCollection FTPHiddenAuthorization
        {
            WebsitePath = "IIS:\Sites\FTPSite\AppData"
            Filter = "system.ftpserver/security/authorization"
            CollectionName = "."
            ItemName = "add"
            ItemKeyName = "*"
            ItemKeyValue = "Allow"
            ItemPropertyName = "AccessType"
            ItemPropertyValue = "Allow"
        }

The operating system the target node is running

This is running on a VM that gets wiped before each run of the configuration.

OsName               : Microsoft Windows 10 Enterprise LTSC
OsOperatingSystemSKU : 125
OsArchitecture       : 64-bit
WindowsVersion       : 1809
WindowsBuildLabEx    : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage           : en-US

Version and build of PowerShell the target node is running

PSVersion                      5.1.17763.1
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.1
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version of the DSC module that was used ('dev' if using current dev branch)

2.8.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe issue is a bug.help wantedThe issue is up for grabs for anyone in the community.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions