microsoft / Microsoft365DSC

Manages, configures, extracts and monitors Microsoft 365 tenant configurations
https://aka.ms/M365DSC
MIT License
1.59k stars 500 forks source link

[SCSensitivityLabel] A parameter cannot be found that matches parameter name 'ApplicationId'. #3050

Closed lpercetti closed 1 year ago

lpercetti commented 1 year ago

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

I am trying to deploy a SensitivityLabel using an Application Registration (SPN). However, the DSC does not proceed and I receive the following error: A parameter cannot be found that matches parameter name 'ApplicationId'.

The documentation is showing this parameter as implemented. https://microsoft365dsc.com/resources/security-compliance/SCSensitivityLabel/

Verbose logs showing the problem

VERBOSE: [MS365DSC]: [[SCSensitivityLabel]LABEL-INTERNAL] Creating Label {internal} A parameter cannot be found that matches parameter name 'ApplicationId'.

Suggested solution to the issue

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

SCSensitivityLabel 'LABEL-INTERNAL'
        {
            TenantId                                = $TenantId;
            ApplicationId                           = $ApplicationId;
            CertificateThumbprint                   = $CertificateThumbprint;

            Ensure                                  = "Present";
            Name                                    = "internal";

            Comment                                 = "";
            Disabled                                = $False;
            DisplayName                             = "Internal";
            Priority                                = 3;
            Tooltip                                 = "This label will encrypt the document, set access privilege to Co-Owner level (Full Control), and restrict access to those with a valid internal email address.";
            AdvancedSettings     = @(
                MSFT_SCLabelSetting
                {
                    Key   = 'contenttype'
                    Value = 'File  Email'
                }
                MSFT_SCLabelSetting
                {
                    Key   = 'tooltip'
                    Value = 'This label will encrypt the document set access privilege to Co-Owner level (Full Control) and restrict access to those with a valid internal email address.'
                }
                MSFT_SCLabelSetting
                {
                    Key   = 'isparent'
                    Value = 'False'
                }
            );
        }

The operating system the target node is running

OsName : Microsoft Windows Server 2022 Datacenter Azure Edition OsOperatingSystemSKU : 407 OsArchitecture : 64-bit WindowsVersion : 2009 WindowsBuildLabEx : 20348.1.amd64fre.fe_release.210507-1500 OsLanguage : en-US OsMuiLanguages : {en-US}

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

ModuleType Version Name ExportedCommands


Manifest 1.23.315.1 Microsoft365DSC {Add-M365DSCEvent, Add-M365DSCTelemetryEvent, Assert-M365D...

Installing DSCParser version {1.3.0.6} Installing ExchangeOnlineManagement version {3.1.0} Installing Microsoft.Graph.Applications version {1.23.0} Installing Microsoft.Graph.Authentication version {1.23.0} Installing Microsoft.Graph.DeviceManagement version {1.23.0} Installing Microsoft.Graph.DeviceManagement.Administration version {1.23.0} Installing Microsoft.Graph.DeviceManagement.Enrolment version {1.23.0} Installing Microsoft.Graph.Devices.CorporateManagement version {1.23.0} Installing Microsoft.Graph.Groups version {1.23.0} Installing Microsoft.Graph.Identity.DirectoryManagement version {1.23.0} Installing Microsoft.Graph.Identity.Governance version {1.23.0} Installing Microsoft.Graph.Identity.SignIns version {1.23.0} Installing Microsoft.Graph.Planner version {1.23.0} Installing Microsoft.Graph.Teams version {1.23.0} Installing Microsoft.Graph.Users version {1.23.0} Installing Microsoft.Graph.Users.Actions version {1.23.0} Installing Microsoft.PowerApps.Administration.PowerShell version {2.0.156} Installing MicrosoftTeams version {5.0.0} Installing MSCloudLoginAssistant version {1.0.105} Installing PnP.PowerShell version {1.12.0} Installing ReverseDSC version {2.0.0.14}

andikrueger commented 1 year ago

Thank you for reporting this issue. This issue is caused here:

https://github.com/microsoft/Microsoft365DSC/blob/Dev/Modules/Microsoft365DSC/DSCResources/MSFT_SCSensitivityLabel/MSFT_SCSensitivityLabel.psm1#L840-L843

Not all authentication parameters are properly removed from the creation params of the cmdLet. This needs to be fixed.

ykuijs commented 1 year ago

Don't forget to update these lines as well: https://github.com/microsoft/Microsoft365DSC/blob/397bf79ca4f7c107e4ba89463de376554431c547/Modules/Microsoft365DSC/DSCResources/MSFT_SCSensitivityLabel/MSFT_SCSensitivityLabel.psm1#L881-L884 :wink:

lpercetti commented 1 year ago

Near lines 1172-1176 too?

andikrueger commented 1 year ago

Hope I did so...Yes, I did.

andikrueger commented 1 year ago

Missed the Test-Method. Will create a new PR for that.