Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

[IntuneDeviceCompliancePolicyiOs] A parameter cannot be found that matches parameter name 'GlobalAdminAccount'.

Open mimachniak opened this issue 5 years ago • 3 comments

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

When I try to create new resource IntuneDeviceCompliancePolicyiOs with option AddDeviceCompliancePolicyiOs I'm getting error that A parameter cannot be found that matches parameter name 'GlobalAdminAccount'., but when I change DSC and switch AddDeviceCompliancePolicyiOs to GUID of existing resource all works without any issue, so problem is witch creating resources

Verbose logs showing the problem


VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConfigurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
VERBOSE: An LCM method call arrived from computer ALKO-PC with user sid S-1-5-21-421854995-3701845711-634201574-1001.
VERBOSE: [ALKO-PC]: LCM:  [ Start  Set      ]
VERBOSE: [ALKO-PC]: LCM:  [ Start  Resource ]  [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs]
VERBOSE: [ALKO-PC]: LCM:  [ Start  Test     ]  [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs]
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] Testing configuration of Intune Device Compliance iOS Policy {Test iOS Device Compliance Policy}
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] Checking for the Intune Device Compliance iOS Policy {Test iOS Device Compliance Policy}
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] No iOS Device Compliance Policy with displayName {Test iOS Device Compliance Policy} was found
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] Current Values: Description=Test iOS Device Compliance Policy Description; DeviceThreatProtectionEnabled=True; DeviceThreatProtectionRequiredSecurityLevel=medium; DisplayName=Test iOS Device Compliance Policy; Ensure=Absent; GlobalAdminAccount=System.Management.Automation.PS
Credential; ManagedEmailProfileRequired=True; OsMaximumVersion=12; OsMinimumVersion=10; PasscodeBlockSimple=True; PasscodeExpirationDays=365; PasscodeMinimumCharacterSetCount=2; PasscodeMinimumLength=6; PasscodeMinutesOfInactivityBeforeLock=5; PasscodePreviousPasscodeBlockCount=3; PasscodeRequired=True; PasscodeRequiredType=numeric; SecurityBlockJailbrokenDevices=True; Verbose=True
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] Target Values: Description=Test iOS Device Compliance Policy Description; DeviceThreatProtectionEnabled=True; DeviceThreatProtectionRequiredSecurityLevel=medium; DisplayName=Test iOS Device Compliance Policy; Ensure=Present; GlobalAdminAccount=System.Management.Automation.PS
Credential; ManagedEmailProfileRequired=True; OsMaximumVersion=12; OsMinimumVersion=10; PasscodeBlockSimple=True; PasscodeExpirationDays=365; PasscodeMinimumCharacterSetCount=2; PasscodeMinimumLength=6; PasscodeMinutesOfInactivityBeforeLock=5; PasscodePreviousPasscodeBlockCount=3; PasscodeRequired=True; PasscodeRequiredType=numeric; SecurityBlockJailbrokenDevices=True; Verbose=True
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] Test-TargetResource returned False
VERBOSE: [ALKO-PC]: LCM:  [ End    Test     ]  [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs]  in 3.6560 seconds.
VERBOSE: [ALKO-PC]: LCM:  [ Start  Set      ]  [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs]
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] Intune Device Compliance iOS Policy {Test iOS Device Compliance Policy}
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] Checking for the Intune Device Compliance iOS Policy {Test iOS Device Compliance Policy}
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] No iOS Device Compliance Policy with displayName {Test iOS Device Compliance Policy} was found
VERBOSE: [ALKO-PC]:                            [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs] Creating new Intune Device Compliance iOS Policy {Test iOS Device Compliance Policy}
A parameter cannot be found that matches parameter name 'GlobalAdminAccount'.
    + CategoryInfo          : InvalidArgument: (:) [], CimException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Intune.PowerShellGraphSDK.PowerShellCmdlets.New_DeviceManagement_DeviceCompliancePolicies
    + PSComputerName        : localhost
 
VERBOSE: [ALKO-PC]: LCM:  [ End    Set      ]  [[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs]  in 2.6800 seconds.
The PowerShell DSC resource '[IntuneDeviceCompliancePolicyiOs]AddDeviceCompliancePolicyiOs' with SourceInfo 'C:\Temp\M365DSC\New\testDSC.ps1::19::9::IntuneDeviceCompliancePolicyiOs' threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for
 more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : localhost
 
VERBOSE: [ALKO-PC]: LCM:  [ End    Set      ]
The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : localhost
 
VERBOSE: Operation 'Invoke CimMethod' complete.
VERBOSE: Time taken for configuration job to complete is 6.519 seconds

Suggested solution to the issue

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


 param(
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $credsGlobalAdmin
    )


Configuration Example
{
    param(
        [Parameter(Mandatory = $true)]
        [PSCredential]
        $credsGlobalAdmin
    )
    Import-DscResource -ModuleName Microsoft365DSC

    node localhost
    {
        IntuneDeviceCompliancePolicyiOs AddDeviceCompliancePolicyiOs

        {
            DisplayName                                 = 'Test iOS Device Compliance Policy';
            Description                                 = 'Test iOS Device Compliance Policy Description';
            PasscodeBlockSimple                         = $True;
            PasscodeExpirationDays                      = 365;
            PasscodeMinimumLength                       = 6;
            PasscodeMinutesOfInactivityBeforeLock       = 5;
            PasscodePreviousPasscodeBlockCount          = 3;
            PasscodeMinimumCharacterSetCount            = 2;
            PasscodeRequiredType                        = 'numeric';
            PasscodeRequired                            = $True;
            OsMinimumVersion                            = 10;
            OsMaximumVersion                            = 12;
            SecurityBlockJailbrokenDevices              = $True;
            DeviceThreatProtectionEnabled               = $True;
            DeviceThreatProtectionRequiredSecurityLevel = 'medium';
            ManagedEmailProfileRequired                 = $True;
            Ensure                                      = 'Present';
            GlobalAdminAccount                          = $credsGlobalAdmin;
        }
    }
}

$Parm = @{
    AllNodes = @(    
        @{  
            NodeName = "localhost"
            PsDscAllowPlainTextPassword = $true
            PSDscAllowDomainUser = $true
            ServerNumber = "0"
        }
    ) 
}

Example -ConfigurationData $Parm -credsGlobalAdmin $credsGlobalAdmin

The operating system the target node is running

OsName : Microsoft Windows 10 Pro OsOperatingSystemSKU : 48 OsArchitecture : 64-bit WindowsVersion : 2009 WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406 OsLanguage : en-US OsMuiLanguages : {en-US, pl-PL}

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

ModuleType Version    Name                                ExportedCommands                                                                                                                                                                                                                                                                                                                       
---------- -------    ----                                ----------------                                                                                                                                                                                                                                                                                                                       
Manifest   1.21.414.2 Microsoft365DSC                     {Assert-M365DSCBlueprint, Assert-M365DSCTemplate, Compare-M365DSCConfigurations, Export-M365DSCConfiguration...} 

mimachniak avatar Apr 17 '21 19:04 mimachniak

I've found the issue and I will fix it in the coming days

RuudGijsbers avatar Apr 20 '21 19:04 RuudGijsbers

@RuudGijsbers was this ever fixed? Thanks

NikCharlebois avatar Jul 19 '21 12:07 NikCharlebois

@NikCharlebois, this has been fixed in a previous release

RuudGijsbers avatar Aug 03 '21 10:08 RuudGijsbers