Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCAutoSensitivityLabelRule error when trying to to use HeaderMatchesPatterns #3315

Closed
arielmoisis opened this issue May 16, 2023 · 0 comments · Fixed by #3317
Closed

SCAutoSensitivityLabelRule error when trying to to use HeaderMatchesPatterns #3315

arielmoisis opened this issue May 16, 2023 · 0 comments · Fixed by #3317
Assignees
Labels

Comments

@arielmoisis
Copy link

Hi when attempting to set a SCAutoSensitivityLabelRule I am getting an error

Cannot process argument transformation on parameter 'HeaderMatchesPatterns'. Cannot convert the "System.Collections.ArrayList" value of type "System.Collections.ArrayList" to type "Microsoft.Office.CompliancePolicy.Tasks.PswsHashtable".

+ CategoryInfo          : InvalidData: (:) [], CimException

+ FullyQualifiedErrorId : ParameterArgumentTransformationError,New-AutoSensitivityLabelRule

+ PSComputerName        : [localhost](http://localhost/)

My configure file is:
param (
[parameter()]
[System.Management.Automation.PSCredential]
$GlobalAdminAccount
)

Configuration M365TestConfig
{
param (
[parameter()]
[System.Management.Automation.PSCredential]
$GlobalAdminAccount
)

if ($null -eq $GlobalAdminAccount) {
<# Credentials #>
$Credscredential = Get-Credential -Message "Credentials"

}
else {
    $CredsCredential = $GlobalAdminAccount
}

$OrganizationName = $CredsCredential.UserName.Split('@')[1]
Import-DscResource -ModuleName 'Microsoft365DSC'

Node localhost
{
    SCSensitivityLabel LabelName {
        AdvancedSettings                   = @(
            MSFT_SCLabelSetting {
                Key   = 'isparent'
                Value = 'False'
            }
        )
        ApplyContentMarkingFooterAlignment = "Center"
        ApplyContentMarkingFooterEnabled   = $True
        ApplyContentMarkingFooterFontColor = "#FF0000"
        ApplyContentMarkingFooterFontSize  = 12
        ApplyContentMarkingFooterMargin    = 5
        ApplyContentMarkingFooterText      = "Footertext"
        ApplyContentMarkingHeaderAlignment = "Center"
        ApplyContentMarkingHeaderEnabled   = $True
        ApplyContentMarkingHeaderFontColor = "#FF0000"
        ApplyContentMarkingHeaderFontSize  = 12
        ApplyContentMarkingHeaderMargin    = 5
        ApplyContentMarkingHeaderText      = "Headertext"
        ContentType                        = @("File, Email", "Teamwork")
        Comment                            = "desxriptions."
        Credential                         = $Credscredential
        DisplayName                        = "Labelname"
        Ensure                             = "Present"
        LocaleSettings                     = @(
            MSFT_SCLabelLocaleSettings {
                LocaleKey     = 'displayName'
                LabelSettings = @(
                    MSFT_SCLabelSetting {
                        Key   = 'default'
                        Value = 'LabelName'
                    }
                )
            }
            MSFT_SCLabelLocaleSettings {
                LocaleKey     = 'tooltip'
                LabelSettings = @(
                    MSFT_SCLabelSetting {
                        Key   = 'default'
                        Value = 'Description'
                    }
                )
            }
        )
        Name                               = "L"
        Priority                           = 0
        Tooltip                            = "Description"
    }
    SCAutoSensitivityLabelPolicy 'LabelnameRule' {
        ApplySensitivityLabel           = 'L'
        Comment                         = ''
        Credential                      = $Credscredential
        Ensure                          = 'Present'
        ExchangeLocation                = @("All")
        ExchangeSender                  = @()
        ExchangeSenderException         = @()
        ExchangeSenderMemberOf          = @()
        ExchangeSenderMemberOfException = @()
        # Mode                            = 'Enable'
        Name                            = 'Labelname'
        OneDriveLocation                = @()
        OneDriveLocationException       = @()
        Priority                        = 0
        SharePointLocation              = @()
        SharePointLocationException     = @()
   } 
    SCAutoSensitivityLabelRule 'AutoSensitivityLabelRule-LabelName - Header-Exchange' {
        Credential                          = $Credscredential
        Disabled                            = $False
        DocumentIsPasswordProtected         = $False
        DocumentIsUnsupported               = $False
        Ensure                              = 'Present'
        ExceptIfDocumentIsPasswordProtected = $False
        ExceptIfDocumentIsUnsupported       = $False
        ExceptIfProcessingLimitExceeded     = $False
        HeaderMatchesPatterns               = '@{x-header = "Labelname"}'
        Name                                = 'Labelname - Header'
        Policy                              = 'Labelname'
        ProcessingLimitExceeded             = $False
        ReportSeverityLevel                 = 'Low'
        Workload                            = 'Exchange'
    }
}

}

M365TestConfig -ConfigurationData .\ConfigurationData.psd1 -GlobalAdminAccount $GlobalAdminAccount

@NikCharlebois NikCharlebois self-assigned this May 17, 2023
NikCharlebois added a commit to NikCharlebois/Microsoft365DSC that referenced this issue May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants