From f72ee3129171e966bcfe98bdce717bcdbb75d149 Mon Sep 17 00:00:00 2001 From: William-francillette Date: Thu, 9 Nov 2023 21:22:44 +0000 Subject: [PATCH 1/3] fix typo: 3442 --- CHANGELOG.md | 4 ++++ ...neDeviceEnrollmentStatusPageWindows10.psm1 | 24 +++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a74890159..b43777b491 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ # UNRELEASED +* IntuneDeviceEnrollmentStatusPageWindows10 + * Fix typo in the catch of Update-DeviceEnrollmentConfigurationPriority + Fixes [#3442](https://github.com/microsoft/Microsoft365DSC/issues/3442) + * M365DSCDRGUTIL * Fix an issue where temporary parameters were not renamed during recursive call causing a Model Validation error during creation or update of a Graph resource Fixes [#3582](https://github.com/microsoft/Microsoft365DSC/issues/3582) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 index dfaf5a6fc4..8d9b692483 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] + [Parameter(Mandatory = $true)] [System.String] $Id, @@ -219,7 +219,7 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] + [Parameter(Mandatory = $true)] [System.String] $Id, @@ -443,7 +443,7 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] + [Parameter(Mandatory = $true)] [System.String] $Id, @@ -764,17 +764,21 @@ function Update-DeviceEnrollmentConfigurationPriority try { $Uri = "https://graph.microsoft.com/beta/deviceManagement/deviceEnrollmentConfigurations/$DeviceEnrollmentConfigurationId/setpriority" - $body = @{'priority' = $Priority } | ConvertTo-Json -Depth 20 + $body = @{'priority' = $Priority } | ConvertTo-Json -Depth 100 #write-verbose -Message $body - Invoke-MgGraphRequest -Method POST -Uri $Uri -Body $body -ErrorAction Stop 4> Out-Null + Invoke-MgGraphRequest ` + -Method POST ` + -Body $body ` + -Uri $Uri ` + -ErrorAction Stop 4> Out-Null } catch { - New-M365DSCLogEntry -Message 'Error updating data:' - -Exception $_ - -Source $($MyInvocation.MyCommand.Source) - -TenantId $TenantId - -Credential $Credential + New-M365DSCLogEntry -Message 'Error updating data:' ` + -Exception $_ ` + -Source $($MyInvocation.MyCommand.Source) ` + -TenantId $TenantId ` + -Credential $Credential return $null } From 48296e0770057fffcfe31cceda47eae5cfdb0dad Mon Sep 17 00:00:00 2001 From: William-francillette Date: Fri, 10 Nov 2023 09:17:16 +0000 Subject: [PATCH 2/3] removed Id as required --- .../MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 | 6 +++--- ...SFT_IntuneDeviceEnrollmentStatusPageWindows10.schema.mof | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 index 8d9b692483..6424fee780 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 @@ -9,7 +9,7 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter(Mandatory = $true)] + [Parameter()] [System.String] $Id, @@ -219,7 +219,7 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter(Mandatory = $true)] + [Parameter()] [System.String] $Id, @@ -443,7 +443,7 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter(Mandatory = $true)] + [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.schema.mof index 1e45c0ca83..b4b6ccf761 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.schema.mof @@ -13,7 +13,7 @@ class MSFT_DeviceManagementConfigurationPolicyAssignments class MSFT_IntuneDeviceEnrollmentStatusPageWindows10 : OMI_BaseResource { [Key, Description("The display name of the device enrollment configuration")] String DisplayName; - [Required, Description("The unique identifier for an entity. Read-only.")] String Id; + [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("The description of the device enrollment configuration")] String Description; [Write, Description("Allow or block device reset on installation failure")] Boolean AllowDeviceResetOnInstallFailure; [Write, Description("Allow the user to continue using the device on installation failure")] Boolean AllowDeviceUseOnInstallFailure; From 2b8d76c007072da1cb852d5858a683f4b065e6fe Mon Sep 17 00:00:00 2001 From: William-francillette Date: Fri, 10 Nov 2023 09:36:12 +0000 Subject: [PATCH 3/3] prevent processing policies with duplicated names --- .../MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 index 6424fee780..6dd891fbc7 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceEnrollmentStatusPageWindows10/MSFT_IntuneDeviceEnrollmentStatusPageWindows10.psm1 @@ -148,6 +148,12 @@ function Get-TargetResource Write-Verbose -Message "Could not find an Intune Device Enrollment Configuration for Windows10 with DisplayName {$DisplayName}" return $nullResult } + + if($getValue -is [Array]) + { + Throw "The DisplayName {$DisplayName} returned multiple policies, make sure DisplayName is unique." + } + $Id = $getValue.Id Write-Verbose -Message "An Intune Device Enrollment Configuration for Windows10 with Id {$Id} and DisplayName {$DisplayName} was found."