diff --git a/CHANGELOG.md b/CHANGELOG.md index a164dc3ca7..7d997832e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,7 @@ * Fixed typo in `ManagedIdentity` property across all resources. * Reduced repeated logins during export of SPO and Teams resources. * Removed unnecessary type casting across all resources. + * [BREAKING CHANGE] Removed `SupportsScopeTags` property from all resources because it's read-only. * M365DSCDRGUtil * Fixed an issue where a null drift would throw an exception. * Fixed an issue where group filtering would not find the specified groups. diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10.psm1 index 98651e842a..7140e2cbea 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10.psm1 @@ -23,10 +23,6 @@ function Get-TargetResource [System.String[]] $RoleScopeTagIds, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -184,7 +180,6 @@ function Get-TargetResource Description = $getValue.Description DisplayName = $getValue.DisplayName RoleScopeTagIds = $getValue.RoleScopeTagIds - SupportsScopeTags = $getValue.SupportsScopeTags Id = $getValue.Id Ensure = 'Present' Credential = $Credential @@ -243,10 +238,6 @@ function Set-TargetResource [System.String[]] $RoleScopeTagIds, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -421,10 +412,6 @@ function Test-TargetResource [System.String[]] $RoleScopeTagIds, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10.schema.mof index ad7c6b5b70..937ef824cd 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10/MSFT_IntuneDeviceConfigurationCustomPolicyWindows10.schema.mof @@ -30,7 +30,6 @@ class MSFT_IntuneDeviceConfigurationCustomPolicyWindows10 : OMI_BaseResource [Write, Description("OMA settings. This collection can contain a maximum of 1000 elements."), EmbeddedInstance("MSFT_MicrosoftGraphomaSetting")] String OmaSettings[]; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; [Write, Description("Present ensures the policy exists, absent ensures it is removed."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.psm1 index 8920234493..17597468e5 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.psm1 @@ -86,10 +86,6 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -308,7 +304,6 @@ function Get-TargetResource VpnPeerCaching = $enumVpnPeerCaching Description = $getValue.Description DisplayName = $getValue.DisplayName - SupportsScopeTags = $getValue.SupportsScopeTags Id = $getValue.Id RoleScopeTagIds = $getValue.RoleScopeTagIds Ensure = 'Present' @@ -429,10 +424,6 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -650,10 +641,6 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.schema.mof index 3543613607..4cd37f9c27 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.schema.mof @@ -66,7 +66,6 @@ class MSFT_IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10 : OMI_Ba [Write, Description("Specifies whether the device is allowed to participate in Peer Caching while connected via VPN to the domain network."), ValueMap{"notConfigured","enabled","disabled"}, Values{"notConfigured","enabled","disabled"}] String VpnPeerCaching; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Key, Description("Admin provided name of the device configuration.")] String DisplayName; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10.psm1 index a46b8a4f2d..5d7eb9ac8e 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10.psm1 @@ -31,10 +31,6 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -155,7 +151,6 @@ function Get-TargetResource OrganizationalUnit = $getValue.AdditionalProperties.organizationalUnit Description = $getValue.Description DisplayName = $getValue.DisplayName - SupportsScopeTags = $getValue.SupportsScopeTags Id = $getValue.Id RoleScopeTagIds = $getValue.RoleScopeTagIds Ensure = 'Present' @@ -222,10 +217,6 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -388,10 +379,6 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10.schema.mof index 7fd80b9934..c1bb33b9d3 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10/MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10.schema.mof @@ -19,7 +19,6 @@ class MSFT_IntuneDeviceConfigurationDomainJoinPolicyWindows10 : OMI_BaseResource [Write, Description("Organizational unit (OU) where the computer account will be created. If this parameter is NULL, the well known computer object container will be used as published in the domain.")] String OrganizationalUnit; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Key, Description("Admin provided name of the device configuration.")] String DisplayName; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.psm1 index 7756d0b39e..adb896a2ed 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.psm1 @@ -980,10 +980,6 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -2639,7 +2635,6 @@ function Get-TargetResource XboxServicesLiveNetworkingServiceStartupMode = $enumXboxServicesLiveNetworkingServiceStartupMode Description = $getValue.Description DisplayName = $getValue.DisplayName - SupportsScopeTags = $getValue.SupportsScopeTags Id = $getValue.Id RoleScopeTagIds = $getValue.RoleScopeTagIds Ensure = 'Present' @@ -3656,10 +3651,6 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -4796,10 +4787,6 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.schema.mof index ea99935523..9f46d73692 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.schema.mof @@ -350,7 +350,6 @@ class MSFT_IntuneDeviceConfigurationEndpointProtectionPolicyWindows10 : OMI_Base [Write, Description("This setting determines whether Networking service's start type is Automatic(2), Manual(3), Disabled(4). Default: Manual. Possible values are: manual, automatic, disabled."), ValueMap{"manual","automatic","disabled"}, Values{"manual","automatic","disabled"}] String XboxServicesLiveNetworkingServiceStartupMode; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Key, Description("Admin provided name of the device configuration.")] String DisplayName; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.psm1 index a72befcb28..bf620c79d8 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.psm1 @@ -120,10 +120,6 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -384,7 +380,6 @@ function Get-TargetResource WirelessWideAreaNetwork = $enumWirelessWideAreaNetwork Description = $getValue.Description DisplayName = $getValue.DisplayName - SupportsScopeTags = $getValue.SupportsScopeTags RoleScopeTagIds = $getValue.RoleScopeTagIds Id = $getValue.Id Ensure = 'Present' @@ -541,10 +536,6 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -796,10 +787,6 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.schema.mof index c5195e5e7d..4334c89503 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.schema.mof @@ -36,7 +36,6 @@ class MSFT_IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10 : OMI_BaseR [Write, Description("Defines whether a user is allowed to enable Wireless Wide Area Network. Possible values are: notConfigured, enabled, disabled."), ValueMap{"notConfigured","enabled","disabled"}, Values{"notConfigured","enabled","disabled"}] String WirelessWideAreaNetwork; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Key, Description("Admin provided name of the device configuration.")] String DisplayName; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.psm1 index 949cfb5d13..87275b23c7 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.psm1 @@ -29,10 +29,6 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -159,7 +155,6 @@ function Get-TargetResource ConfigDeviceHealthMonitoringScope = $enumConfigDeviceHealthMonitoringScope Description = $getValue.Description DisplayName = $getValue.DisplayName - SupportsScopeTags = $getValue.SupportsScopeTags Id = $getValue.Id RoleScopeTagIds = $getValue.RoleScopeTagIds Ensure = 'Present' @@ -225,10 +220,6 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -391,10 +382,6 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.schema.mof index c8a81a3310..51c0b6d9eb 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.schema.mof @@ -18,7 +18,6 @@ class MSFT_IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10 [Write, Description("Specifies set of events collected from the device where health monitoring is enabled. Possible values are: undefined, healthMonitoring, bootPerformance, windowsUpdates, privilegeManagement."), ValueMap{"undefined","healthMonitoring","bootPerformance","windowsUpdates","privilegeManagement"}, Values{"undefined","healthMonitoring","bootPerformance","windowsUpdates","privilegeManagement"}] String ConfigDeviceHealthMonitoringScope[]; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Key, Description("Admin provided name of the device configuration.")] String DisplayName; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.psm1 index e6047f1b79..57258ddb24 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.psm1 @@ -74,10 +74,6 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -221,7 +217,6 @@ function Get-TargetResource WindowsHelloForBusinessBlocked = $getValue.AdditionalProperties.windowsHelloForBusinessBlocked Description = $getValue.Description DisplayName = $getValue.DisplayName - SupportsScopeTags = $getValue.SupportsScopeTags Id = $getValue.Id RoleScopeTagIds = $getValue.RoleScopeTagIds Ensure = 'Present' @@ -332,10 +327,6 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -543,10 +534,6 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.schema.mof index b84fbe9e0c..ccdbef065e 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.schema.mof @@ -29,7 +29,6 @@ class MSFT_IntuneDeviceConfigurationIdentityProtectionPolicyWindows10 : OMI_Base [Write, Description("Boolean value that blocks Windows Hello for Business as a method for signing into Windows.")] Boolean WindowsHelloForBusinessBlocked; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Key, Description("Admin provided name of the device configuration.")] String DisplayName; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.psm1 index f65891abc0..a7dc8af568 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.psm1 @@ -19,10 +19,6 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -177,7 +173,6 @@ function Get-TargetResource WindowsNetworkIsolationPolicy = $complexWindowsNetworkIsolationPolicy Description = $getValue.Description DisplayName = $getValue.DisplayName - SupportsScopeTags = $getValue.SupportsScopeTags Id = $getValue.Id RoleScopeTagIds = $getValue.RoleScopeTagIds Ensure = 'Present' @@ -233,10 +228,6 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -386,10 +377,6 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.schema.mof index 620a243709..c47391f3a7 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.schema.mof @@ -42,7 +42,6 @@ class MSFT_IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10 : OMI_BaseRes [Write, Description("Windows Network Isolation Policy"), EmbeddedInstance("MSFT_MicrosoftGraphwindowsNetworkIsolationPolicy")] String WindowsNetworkIsolationPolicy; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Key, Description("Admin provided name of the device configuration.")] String DisplayName; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyMacOS/MSFT_IntuneDeviceConfigurationPolicyMacOS.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyMacOS/MSFT_IntuneDeviceConfigurationPolicyMacOS.psm1 index 7f406a57fd..9b40d3c7c8 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyMacOS/MSFT_IntuneDeviceConfigurationPolicyMacOS.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyMacOS/MSFT_IntuneDeviceConfigurationPolicyMacOS.psm1 @@ -803,7 +803,7 @@ function Set-TargetResource foreach ($key in ($CreateParameters.Clone()).Keys) { - if ($CreateParameters[$key].getType().Fullname -like '*CimInstance*') + if ($CreateParameters[$key].GetType().Fullname -like '*CimInstance*') { $CreateParameters[$key] = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject $CreateParameters[$key] } @@ -850,7 +850,7 @@ function Set-TargetResource foreach ($key in ($UpdateParameters.Clone()).Keys) { - if ($UpdateParameters[$key].getType().Fullname -like '*CimInstance*') + if ($UpdateParameters[$key].GetType().Fullname -like '*CimInstance*') { $UpdateParameters[$key] = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject $UpdateParameters[$key] } @@ -860,7 +860,7 @@ function Set-TargetResource { $UpdateParameters.add('AdditionalProperties', $AdditionalProperties) }#> - $UpdateParameters.add('@odata.type', '#microsoft.graph.macOSGeneralDeviceConfiguration') + $UpdateParameters.Add('@odata.type', '#microsoft.graph.macOSGeneralDeviceConfiguration') #$UpdateParameters.remove('emailInDomainSuffixes') #$UpdateParameters.remove('updateDelayPolicy') @@ -1234,7 +1234,7 @@ function Test-TargetResource foreach ($key in $ValuesToCheck.Keys) { if (($null -ne $CurrentValues[$key]) ` - -and ($CurrentValues[$key].getType().Name -eq 'DateTime')) + -and ($CurrentValues[$key].GetType().Name -eq 'DateTime')) { $CurrentValues[$key] = $CurrentValues[$key].ToString() } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationPolicyWindows10.psm1 index 438cad932f..e5b3103b37 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationPolicyWindows10.psm1 @@ -1194,10 +1194,6 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -1987,7 +1983,6 @@ function Get-TargetResource WirelessDisplayRequirePinForPairing = $getValue.AdditionalProperties.wirelessDisplayRequirePinForPairing Description = $getValue.Description DisplayName = $getValue.DisplayName - SupportsScopeTags = $getValue.SupportsScopeTags Id = $getValue.Id RoleScopeTagIds = $getValue.RoleScopeTagIds Ensure = 'Present' @@ -3217,10 +3212,6 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -4579,10 +4570,6 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationPolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationPolicyWindows10.schema.mof index f891a87a07..6b24facdbd 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationPolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationPolicyWindows10/MSFT_IntuneDeviceConfigurationPolicyWindows10.schema.mof @@ -332,7 +332,6 @@ class MSFT_IntuneDeviceConfigurationPolicyWindows10 : OMI_BaseResource [Write, Description("Indicates whether or not to require a PIN for new devices to initiate pairing.")] Boolean WirelessDisplayRequirePinForPairing; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Key, Description("Admin provided name of the device configuration.")] String DisplayName; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10.psm1 index 88da593c67..a41b95c7be 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10.psm1 @@ -97,10 +97,6 @@ function Get-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -254,7 +250,6 @@ function Get-TargetResource WelcomeScreenMeetingInformation = $enumWelcomeScreenMeetingInformation Description = $getValue.Description DisplayName = $getValue.DisplayName - SupportsScopeTags = $getValue.SupportsScopeTags RoleScopeTagIds = $getValue.RoleScopeTagIds Id = $getValue.Id Ensure = 'Present' @@ -388,10 +383,6 @@ function Set-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, @@ -620,10 +611,6 @@ function Test-TargetResource [System.String] $DisplayName, - [Parameter()] - [System.Boolean] - $SupportsScopeTags, - [Parameter()] [System.String] $Id, diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10.schema.mof b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10.schema.mof index 2d0d2b82eb..844e048b6e 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10.schema.mof +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10/MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10.schema.mof @@ -35,7 +35,6 @@ class MSFT_IntuneDeviceConfigurationWindowsTeamPolicyWindows10 : OMI_BaseResourc [Write, Description("The welcome screen meeting information shown. Possible values are: userDefined, showOrganizerAndTimeOnly, showOrganizerAndTimeAndSubject."), ValueMap{"userDefined","showOrganizerAndTimeOnly","showOrganizerAndTimeAndSubject"}, Values{"userDefined","showOrganizerAndTimeOnly","showOrganizerAndTimeAndSubject"}] String WelcomeScreenMeetingInformation; [Write, Description("Admin provided description of the Device Configuration.")] String Description; [Key, Description("Admin provided name of the device configuration.")] String DisplayName; - [Write, Description("Indicates whether or not the underlying Device Configuration supports the assignment of scope tags. Assigning to the ScopeTags property is not allowed when this value is false and entities will not be visible to scoped users. This occurs for Legacy policies created in Silverlight and can be resolved by deleting and recreating the policy in the Azure Portal. This property is read-only.")] Boolean SupportsScopeTags; [Write, Description("The unique identifier for an entity. Read-only.")] String Id; [Write, Description("List of Scope Tags for this Entity instance.")] String RoleScopeTagIds[]; [Write, Description("Represents the assignment to the Intune policy."), EmbeddedInstance("MSFT_DeviceManagementConfigurationPolicyAssignments")] String Assignments[]; diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWiredNetworkPolicyWindows10/MSFT_IntuneDeviceConfigurationWiredNetworkPolicyWindows10.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWiredNetworkPolicyWindows10/MSFT_IntuneDeviceConfigurationWiredNetworkPolicyWindows10.psm1 index 77d738c53d..b63ebdf352 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWiredNetworkPolicyWindows10/MSFT_IntuneDeviceConfigurationWiredNetworkPolicyWindows10.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneDeviceConfigurationWiredNetworkPolicyWindows10/MSFT_IntuneDeviceConfigurationWiredNetworkPolicyWindows10.psm1 @@ -675,7 +675,7 @@ function Set-TargetResource $keys = (([Hashtable]$UpdateParameters).Clone()).Keys foreach ($key in $keys) { - if ($null -ne $UpdateParameters.$key -and $UpdateParameters.$key.getType().Name -like '*cimInstance*') + if ($null -ne $UpdateParameters.$key -and $UpdateParameters.$key.GetType().Name -like '*cimInstance*') { $UpdateParameters.$key = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject $UpdateParameters.$key } diff --git a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneVPNConfigurationPolicyIOS/MSFT_IntuneVPNConfigurationPolicyIOS.psm1 b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneVPNConfigurationPolicyIOS/MSFT_IntuneVPNConfigurationPolicyIOS.psm1 index 7ed6d4fbc0..82c3e0ee97 100644 --- a/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneVPNConfigurationPolicyIOS/MSFT_IntuneVPNConfigurationPolicyIOS.psm1 +++ b/Modules/Microsoft365DSC/DSCResources/MSFT_IntuneVPNConfigurationPolicyIOS/MSFT_IntuneVPNConfigurationPolicyIOS.psm1 @@ -613,8 +613,8 @@ function Set-TargetResource { if ($key -ne '@odata.type') { - $keyName = $key.substring(0, 1).ToUpper() + $key.substring(1, $key.length - 1) - $CreateParameters.remove($keyName) + $keyName = $key.Substring(0, 1).ToUpper() + $key.Substring(1, $key.length - 1) + $CreateParameters.Remove($keyName) } } @@ -622,7 +622,7 @@ function Set-TargetResource foreach ($key in ($CreateParameters.Clone()).Keys) { - if ($CreateParameters[$key].getType().Fullname -like '*CimInstance*') + if ($CreateParameters[$key].GetType().Fullname -like '*CimInstance*') { $CreateParameters[$key] = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject $CreateParameters[$key] } @@ -631,15 +631,15 @@ function Set-TargetResource if ($AdditionalProperties.server) { $AdditionalProperties.Remove('server') #this is not in a format Update-MgBetaDeviceManagementDeviceConfiguration will accept - $AdditionalProperties.add('server',$serverHashtable) #replaced with the hashtable we created earlier + $AdditionalProperties.Add('server',$serverHashtable) #replaced with the hashtable we created earlier } if ($AdditionalProperties.proxyServer) { $AdditionalProperties.Remove('proxyServer') #this is not in a format Update-MgBetaDeviceManagementDeviceConfiguration will accept - $AdditionalProperties.add('proxyServer',$proxyHashtable) #replaced with the hashtable we created earlier + $AdditionalProperties.Add('proxyServer',$proxyHashtable) #replaced with the hashtable we created earlier } - $CreateParameters.add('AdditionalProperties', $AdditionalProperties) + $CreateParameters.Add('AdditionalProperties', $AdditionalProperties) #region resource generator code $policy = New-MgBetaDeviceManagementDeviceConfiguration @CreateParameters @@ -666,8 +666,8 @@ function Set-TargetResource { if ($key -ne '@odata.type') { - $keyName = $key.substring(0, 1).ToUpper() + $key.substring(1, $key.length - 1) - $UpdateParameters.remove($keyName) + $keyName = $key.Substring(0, 1).ToUpper() + $key.Substring(1, $key.Length - 1) + $UpdateParameters.Remove($keyName) } } @@ -675,7 +675,7 @@ function Set-TargetResource foreach ($key in ($UpdateParameters.Clone()).Keys) { - if ($UpdateParameters[$key].getType().Fullname -like '*CimInstance*') + if ($UpdateParameters[$key].GetType().Fullname -like '*CimInstance*') { $UpdateParameters[$key] = Convert-M365DSCDRGComplexTypeToHashtable -ComplexObject $UpdateParameters[$key] } @@ -687,23 +687,23 @@ function Set-TargetResource if ($AdditionalProperties.server) { $AdditionalProperties.Remove('server') #this is not in a format Update-MgBetaDeviceManagementDeviceConfiguration will accept - $AdditionalProperties.add('server',$serverHashtable) #replaced with the hashtable we created earlier + $AdditionalProperties.Add('server',$serverHashtable) #replaced with the hashtable we created earlier } if ($AdditionalProperties.proxyServer) { $AdditionalProperties.Remove('proxyServer') #this is not in a format Update-MgBetaDeviceManagementDeviceConfiguration will accept - $AdditionalProperties.add('proxyServer',$proxyHashtable) #replaced with the hashtable we created earlier + $AdditionalProperties.Add('proxyServer',$proxyHashtable) #replaced with the hashtable we created earlier } #add the additional properties to the updateparameters - $UpdateParameters.add('AdditionalProperties', $AdditionalProperties) + $UpdateParameters.Add('AdditionalProperties', $AdditionalProperties) } #region resource generator code Update-MgBetaDeviceManagementDeviceConfiguration @UpdateParameters ` -DeviceConfigurationId $currentInstance.Id $assignmentsHash = ConvertTo-IntunePolicyAssignment -IncludeDeviceFilter:$true -Assignments $Assignments - Update-DeviceConfigurationPolicyAssignment -DeviceConfigurationPolicyId $currentInstance.id ` + Update-DeviceConfigurationPolicyAssignment -DeviceConfigurationPolicyId $currentInstance.Id ` -Targets $assignmentsHash ` -Repository 'deviceManagement/deviceConfigurations' #endregion @@ -942,7 +942,7 @@ function Test-TargetResource foreach ($key in $ValuesToCheck.Keys) { if (($null -ne $CurrentValues[$key]) ` - -and ($CurrentValues[$key].getType().Name -eq 'DateTime')) + -and ($CurrentValues[$key].GetType().Name -eq 'DateTime')) { $CurrentValues[$key] = $CurrentValues[$key].ToString() } @@ -1250,9 +1250,9 @@ function Get-M365DSCAdditionalProperties if ($property -in ($additionalProperties) ) { $propertyName = $property[0].ToString().ToLower() + $property.Substring(1, $property.Length - 1) - if ($properties.$property -and $properties.$property.getType().FullName -like '*CIMInstance*') + if ($properties.$property -and $properties.$property.GetType().FullName -like '*CIMInstance*') { - if ($properties.$property.getType().FullName -like '*[[\]]') + if ($properties.$property.GetType().FullName -like '*[[\]]') { $array = @() foreach ($item in $properties.$property) diff --git a/Modules/Microsoft365DSC/Examples/Resources/AADEntitlementManagementAccessPackageCatalog/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/AADEntitlementManagementAccessPackageCatalog/1-Create.ps1 index 6fc2c28b2a..97ec7b2f24 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/AADEntitlementManagementAccessPackageCatalog/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/AADEntitlementManagementAccessPackageCatalog/1-Create.ps1 @@ -29,7 +29,7 @@ Configuration Example CatalogType = 'UserManaged' Description = 'Built-in catalog.' IsExternallyVisible = $True - Managedidentity = $False + ManagedIdentity = $False Ensure = 'Present' ApplicationId = $ApplicationId TenantId = $TenantId diff --git a/Modules/Microsoft365DSC/Examples/Resources/AADEntitlementManagementAccessPackageCatalog/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/AADEntitlementManagementAccessPackageCatalog/2-Update.ps1 index c1a0688bbc..b9b9732037 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/AADEntitlementManagementAccessPackageCatalog/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/AADEntitlementManagementAccessPackageCatalog/2-Update.ps1 @@ -29,7 +29,7 @@ Configuration Example CatalogType = 'UserManaged' Description = 'Built-in catalog.' IsExternallyVisible = $False # Updated Property - Managedidentity = $False + ManagedIdentity = $False Ensure = 'Present' ApplicationId = $ApplicationId TenantId = $TenantId diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationCustomPolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationCustomPolicyWindows10/1-Create.ps1 index d8f011747e..acdd6d94f5 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationCustomPolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationCustomPolicyWindows10/1-Create.ps1 @@ -52,7 +52,6 @@ Configuration Example DisplayName = 'custom 2' } ); - SupportsScopeTags = $True; ApplicationId = $ApplicationId; TenantId = $TenantId; CertificateThumbprint = $CertificateThumbprint; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationCustomPolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationCustomPolicyWindows10/2-Update.ps1 index 945f22f9be..eb17888ba0 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationCustomPolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationCustomPolicyWindows10/2-Update.ps1 @@ -52,7 +52,6 @@ Configuration Example DisplayName = 'custom 3' } ); - SupportsScopeTags = $True; ApplicationId = $ApplicationId; TenantId = $TenantId; CertificateThumbprint = $CertificateThumbprint; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/1-Create.ps1 index fd1fc21f94..3401837d21 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/1-Create.ps1 @@ -58,7 +58,6 @@ Configuration Example MinimumRamAllowedToPeerInGigabytes = 3; ModifyCacheLocation = "%systemdrive%"; RestrictPeerSelectionBy = "subnetMask"; - SupportsScopeTags = $True; VpnPeerCaching = "enabled"; ApplicationId = $ApplicationId; TenantId = $TenantId; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/2-Update.ps1 index 3d9c8a6d9c..5b582aef45 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10/2-Update.ps1 @@ -58,7 +58,6 @@ Configuration Example MinimumRamAllowedToPeerInGigabytes = 3; ModifyCacheLocation = "%systemdrive%"; RestrictPeerSelectionBy = "subnetMask"; - SupportsScopeTags = $True; VpnPeerCaching = "enabled"; ApplicationId = $ApplicationId; TenantId = $TenantId; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDomainJoinPolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDomainJoinPolicyWindows10/1-Create.ps1 index 30695840ec..eba630cc12 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDomainJoinPolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDomainJoinPolicyWindows10/1-Create.ps1 @@ -36,7 +36,6 @@ Configuration Example DisplayName = "Domain Join"; Ensure = "Present"; OrganizationalUnit = "OU=workstation,CN=domain,CN=com"; - SupportsScopeTags = $True; ApplicationId = $ApplicationId; TenantId = $TenantId; CertificateThumbprint = $CertificateThumbprint; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDomainJoinPolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDomainJoinPolicyWindows10/2-Update.ps1 index 13cee6a023..1fb2bd0d22 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDomainJoinPolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationDomainJoinPolicyWindows10/2-Update.ps1 @@ -32,11 +32,10 @@ Configuration Example } ); ComputerNameStaticPrefix = "WK-"; - ComputerNameSuffixRandomCharCount = 12; + ComputerNameSuffixRandomCharCount = 13; # Updated Property DisplayName = "Domain Join"; Ensure = "Present"; OrganizationalUnit = "OU=workstation,CN=domain,CN=com"; - SupportsScopeTags = $False; # Updated Property ApplicationId = $ApplicationId; TenantId = $TenantId; CertificateThumbprint = $CertificateThumbprint; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/1-Create.ps1 index 917e26ab44..3e9058e5ef 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/1-Create.ps1 @@ -232,7 +232,6 @@ Configuration Example LocalSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $False; SmartScreenBlockOverrideForFiles = $True; SmartScreenEnableInShell = $True; - SupportsScopeTags = $True; UserRightsAccessCredentialManagerAsTrustedCaller = MSFT_MicrosoftGraphdeviceManagementUserRightsSetting{ State = 'allowed' LocalUsersOrGroups = @( diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/2-Update.ps1 index 27f4d9db02..e84261ee71 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationEndpointProtectionPolicyWindows10/2-Update.ps1 @@ -232,7 +232,6 @@ Configuration Example LocalSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $False; SmartScreenBlockOverrideForFiles = $True; SmartScreenEnableInShell = $True; - SupportsScopeTags = $True; UserRightsAccessCredentialManagerAsTrustedCaller = MSFT_MicrosoftGraphdeviceManagementUserRightsSetting{ State = 'allowed' LocalUsersOrGroups = @( diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/1-Create.ps1 index d771035f63..f2a50e419b 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/1-Create.ps1 @@ -46,7 +46,6 @@ Configuration Example RearCamera = "enabled"; SdCard = "notConfigured"; SimultaneousMultiThreading = "enabled"; - SupportsScopeTags = $True; UsbTypeAPort = "notConfigured"; VirtualizationOfCpuAndIO = "enabled"; WakeOnLAN = "notConfigured"; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/2-Update.ps1 index d74cbce780..a8c21b1844 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10/2-Update.ps1 @@ -46,7 +46,6 @@ Configuration Example RearCamera = "enabled"; SdCard = "notConfigured"; SimultaneousMultiThreading = "enabled"; - SupportsScopeTags = $True; UsbTypeAPort = "notConfigured"; VirtualizationOfCpuAndIO = "enabled"; WakeOnLAN = "notConfigured"; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/1-Create.ps1 index 8b7685ebab..1e6ec52379 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/1-Create.ps1 @@ -34,7 +34,6 @@ Configuration Example ConfigDeviceHealthMonitoringScope = @("bootPerformance","windowsUpdates"); DisplayName = "Health Monitoring Configuration"; Ensure = "Present"; - SupportsScopeTags = $True; ApplicationId = $ApplicationId; TenantId = $TenantId; CertificateThumbprint = $CertificateThumbprint; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/2-Update.ps1 index 56db5bb57e..1e6ec52379 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10/2-Update.ps1 @@ -34,7 +34,6 @@ Configuration Example ConfigDeviceHealthMonitoringScope = @("bootPerformance","windowsUpdates"); DisplayName = "Health Monitoring Configuration"; Ensure = "Present"; - SupportsScopeTags = $False; # Updated Property ApplicationId = $ApplicationId; TenantId = $TenantId; CertificateThumbprint = $CertificateThumbprint; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/1-Create.ps1 index 53710e648b..80f613bda0 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/1-Create.ps1 @@ -42,7 +42,6 @@ Configuration Example PinSpecialCharactersUsage = "allowed"; PinUppercaseCharactersUsage = "allowed"; SecurityDeviceRequired = $True; - SupportsScopeTags = $True; UnlockWithBiometricsEnabled = $True; UseCertificatesForOnPremisesAuthEnabled = $True; UseSecurityKeyForSignin = $True; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/2-Update.ps1 index ce8fe9037f..e383c893cc 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationIdentityProtectionPolicyWindows10/2-Update.ps1 @@ -42,7 +42,6 @@ Configuration Example PinSpecialCharactersUsage = "allowed"; PinUppercaseCharactersUsage = "allowed"; SecurityDeviceRequired = $True; - SupportsScopeTags = $True; UnlockWithBiometricsEnabled = $True; UseCertificatesForOnPremisesAuthEnabled = $True; UseSecurityKeyForSignin = $True; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/1-Create.ps1 index f788c8187f..5a8d4e501a 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/1-Create.ps1 @@ -32,7 +32,6 @@ Configuration Example ); DisplayName = "network boundary"; Ensure = "Present"; - SupportsScopeTags = $True; WindowsNetworkIsolationPolicy = MSFT_MicrosoftGraphwindowsNetworkIsolationPolicy{ EnterpriseProxyServers = @() EnterpriseInternalProxyServers = @() diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/2-Update.ps1 index 11c361adeb..c05c6cbac5 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10/2-Update.ps1 @@ -32,13 +32,12 @@ Configuration Example ); DisplayName = "network boundary"; Ensure = "Present"; - SupportsScopeTags = $False; # Updated Property WindowsNetworkIsolationPolicy = MSFT_MicrosoftGraphwindowsNetworkIsolationPolicy{ EnterpriseProxyServers = @() EnterpriseInternalProxyServers = @() EnterpriseIPRangesAreAuthoritative = $True EnterpriseProxyServersAreAuthoritative = $True - EnterpriseNetworkDomainNames = @('domain.com') + EnterpriseNetworkDomainNames = @('domain.com', 'domain2.com') # Updated Property EnterpriseIPRanges = @( MSFT_MicrosoftGraphIpRange1{ UpperAddress = '1.1.1.255' diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationPolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationPolicyWindows10/1-Create.ps1 index c8e9be6cc7..fcfcb3ce7c 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationPolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationPolicyWindows10/1-Create.ps1 @@ -250,7 +250,6 @@ Configuration Example StorageRequireMobileDeviceEncryption = $False; StorageRestrictAppDataToSystemVolume = $False; StorageRestrictAppInstallToSystemVolume = $False; - SupportsScopeTags = $True; TaskManagerBlockEndTask = $False; TenantLockdownRequireNetworkDuringOutOfBoxExperience = $False; UninstallBuiltInApps = $False; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationPolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationPolicyWindows10/2-Update.ps1 index e31803d2db..12d4b79465 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationPolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationPolicyWindows10/2-Update.ps1 @@ -250,7 +250,6 @@ Configuration Example StorageRequireMobileDeviceEncryption = $False; StorageRestrictAppDataToSystemVolume = $False; StorageRestrictAppInstallToSystemVolume = $False; - SupportsScopeTags = $True; TaskManagerBlockEndTask = $False; TenantLockdownRequireNetworkDuringOutOfBoxExperience = $False; UninstallBuiltInApps = $False; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationWindowsTeamPolicyWindows10/1-Create.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationWindowsTeamPolicyWindows10/1-Create.ps1 index daa9eae1b6..4e94b97054 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationWindowsTeamPolicyWindows10/1-Create.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationWindowsTeamPolicyWindows10/1-Create.ps1 @@ -43,7 +43,6 @@ Configuration Example SettingsBlockMyMeetingsAndFiles = $True; SettingsBlockSessionResume = $True; SettingsBlockSigninSuggestions = $True; - SupportsScopeTags = $True; WelcomeScreenBlockAutomaticWakeUp = $True; WelcomeScreenMeetingInformation = "showOrganizerAndTimeOnly"; ApplicationId = $ApplicationId; diff --git a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationWindowsTeamPolicyWindows10/2-Update.ps1 b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationWindowsTeamPolicyWindows10/2-Update.ps1 index d362300d56..e81c6b93bf 100644 --- a/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationWindowsTeamPolicyWindows10/2-Update.ps1 +++ b/Modules/Microsoft365DSC/Examples/Resources/IntuneDeviceConfigurationWindowsTeamPolicyWindows10/2-Update.ps1 @@ -43,7 +43,6 @@ Configuration Example SettingsBlockMyMeetingsAndFiles = $True; SettingsBlockSessionResume = $True; SettingsBlockSigninSuggestions = $True; - SupportsScopeTags = $True; WelcomeScreenBlockAutomaticWakeUp = $True; WelcomeScreenMeetingInformation = "showOrganizerAndTimeOnly"; ApplicationId = $ApplicationId; diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppCategory.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppCategory.Tests.ps1 index 500353b280..ed963c10e6 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppCategory.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppCategory.Tests.ps1 @@ -40,6 +40,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppCategory -MockWith { + return @{ + Id = '046e0b16-76ce-4b49-bf1b-1cc5bd94fb47' + DisplayName = 'Data Management' + } } Mock -CommandName New-MgBetaDeviceAppManagementMobileAppCategory -MockWith { } @@ -88,13 +92,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppCategory -MockWith { - return @{ - Id = '046e0b16-76ce-4b49-bf1b-1cc5bd94fb47' - DisplayName = 'Data Management' - } - } } It '2.1 Should return values from the Get method' { @@ -117,13 +114,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppCategory -MockWith { - return @{ - Id = '046e0b16-76ce-4b49-bf1b-1cc5bd94fb47' - DisplayName = 'Data Management' - } - } } It '3.0 Should return true from the Test method' { @@ -135,17 +125,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { BeforeAll { $testParams = @{ Id = "046e0b16-76ce-4b49-bf1b-1cc5bd94fb47" - DisplayName = "Data Management" + DisplayName = "Data Management 1" # Updated property Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppCategory -MockWith { - return @{ - Id = "046e0b16-76ce-4b49-bf1b-1cc5bd94fb47" - DisplayName = "Data Management 1" #drift - } - } } It '4.1 Should return Values from the Get method' { @@ -169,13 +152,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppCategory -MockWith { - return @{ - Id = "046e0b16-76ce-4b49-bf1b-1cc5bd94fb47" - DisplayName = "Data Management" - } - } } It '5.1 Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationDevicePolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationDevicePolicy.Tests.ps1 index 837da1316e..9008a9e0ff 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationDevicePolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationDevicePolicy.Tests.ps1 @@ -49,6 +49,43 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { + return @{ + Id = "FakeStringValue" + AdditionalProperties = @{ + packageId = "FakeStringValue" + '@odata.type' = "#microsoft.graph.androidManagedStoreApp" + } + } + } + + Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + appSupportsOemConfig = $True + '@odata.type' = "#microsoft.graph.androidManagedStoreAppConfiguration" + payloadJson = "eyJ0ZXN0IjoidmFsdWUifQ==" + profileApplicability = "default" + permissionActions = @( + @{ + permission = "FakeStringValue" + action = "prompt" + } + ) + packageId = "FakeStringValue" + connectedAppsEnabled = $True + } + createdDateTime = "2023-01-01T00:00:00.0000000+01:00" + description = "FakeStringValue" + displayName = "FakeStringValue" + id = "FakeStringValue" + lastModifiedDateTime = "2023-01-01T00:00:00.0000000+01:00" + roleScopeTagIds = @("FakeStringValue") + targetedMobileApps = @("FakeStringValue") + version = 25 + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -57,10 +94,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppConfigurationAssignment -MockWith { } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - } - } # Test contexts Context -Name "The IntuneAppConfigurationDevicePolicy should exist but it DOES NOT" -Fixture { @@ -85,16 +118,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential; } - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "FakeStringValue" - AdditionalProperties = @{ - packageId = "FakeStringValue" - '@odata.type' = "#microsoft.graph.androidManagedStoreApp" - } - } - } - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppConfiguration -MockWith { return $null } @@ -132,43 +155,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "FakeStringValue" - AdditionalProperties = @{ - packageId = "FakeStringValue" - '@odata.type' = "#microsoft.graph.androidManagedStoreApp" - } - } - } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - appSupportsOemConfig = $True - '@odata.type' = "#microsoft.graph.androidManagedStoreAppConfiguration" - payloadJson = "eyJ0ZXN0IjoidmFsdWUifQ==" - profileApplicability = "default" - permissionActions = @( - @{ - permission = "FakeStringValue" - action = "prompt" - } - ) - packageId = "FakeStringValue" - connectedAppsEnabled = $True - } - createdDateTime = "2023-01-01T00:00:00.0000000+01:00" - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - lastModifiedDateTime = "2023-01-01T00:00:00.0000000+01:00" - roleScopeTagIds = @("FakeStringValue") - targetedMobileApps = @("FakeStringValue") - version = 25 - } - } } It 'Should return Values from the Get method' { @@ -205,43 +191,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "FakeStringValue" - AdditionalProperties = @{ - packageId = "FakeStringValue" - '@odata.type' = "#microsoft.graph.androidManagedStoreApp" - } - } - } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - appSupportsOemConfig = $True - '@odata.type' = "#microsoft.graph.androidManagedStoreAppConfiguration" - payloadJson = "eyJ0ZXN0IjoidmFsdWUifQ==" - profileApplicability = "default" - permissionActions = @( - @{ - permission = "FakeStringValue" - action = "prompt" - } - ) - packageId = "FakeStringValue" - connectedAppsEnabled = $True - } - createdDateTime = "2023-01-01T00:00:00.0000000+01:00" - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - lastModifiedDateTime = "2023-01-01T00:00:00.0000000+01:00" - roleScopeTagIds = @("FakeStringValue") - targetedMobileApps = @("FakeStringValue") - version = 25 - } - } } It 'Should return true from the Test method' { @@ -261,7 +210,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PayloadJson = "{`"test`":`"value`"}" permissionActions = [CimInstance[]]@( (New-CimInstance -ClassName MSFT_MicrosoftGraphandroidPermissionAction -Property @{ - permission = "FakeStringValue" + permission = "OtherPermission" # Updated property action = "prompt" } -ClientOnly) ) @@ -271,40 +220,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "FakeStringValue" - AdditionalProperties = @{ - packageId = "FakeStringValue" - '@odata.type' = "#microsoft.graph.androidManagedStoreApp" - } - } - } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - profileApplicability = "default" - packageId = "FakeStringValue" - permissionActions = @( - @{ - permission = "FakeStringValue" - action = "prompt" - } - ) - payloadJson = "eyJ0ZXN0IjoidmFsdWUifQ==" - } - createdDateTime = "2023-01-01T00:00:00.0000000+01:00" - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - lastModifiedDateTime = "2023-01-01T00:00:00.0000000+01:00" - roleScopeTagIds = @("FakeStringValue") - targetedMobileApps = @("FakeStringValue") - version = 7 - } - } } It 'Should return Values from the Get method' { @@ -328,33 +243,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - appSupportsOemConfig = $True - '@odata.type' = "#microsoft.graph.androidManagedStoreAppConfiguration" - payloadJson = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("{`"test`":`"value`"}")) - profileApplicability = "default" - permissionActions = @( - @{ - permission = "FakeStringValue" - action = "prompt" - } - ) - packageId = "FakeStringValue" - connectedAppsEnabled = $True - } - createdDateTime = "2023-01-01T00:00:00.0000000+01:00" - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - lastModifiedDateTime = "2023-01-01T00:00:00.0000000+01:00" - roleScopeTagIds = @("FakeStringValue") - targetedMobileApps = @("FakeStringValue") - version = 25 - } - } } It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationPolicy.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationPolicy.Tests.ps1 index a20bdd145e..a094406ac7 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationPolicy.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppConfigurationPolicy.Tests.ps1 @@ -41,6 +41,23 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceAppManagementTargetedManagedAppConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceAppManagementTargetedManagedAppConfiguration -MockWith { + return @{ + DisplayName = 'Test App Configuration Policy Desire State' + Description = 'Test Definition' + Id = 'A_19dbaff5-9aff-48b0-a60d-d0471ddaf141' + RoleScopeTagIds = @("0") + TargetedAppManagementLevels = "unspecified" + AppGroupType = "selectedPublicApps" + CustomSettings = @( + @{ + name = 'FakeStringValue' + value = '1' + } + ) + } + } + Mock -CommandName Get-MgBetaDeviceAppManagementTargetedManagedAppConfigurationAssignment -MockWith { return @() } @@ -95,32 +112,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { RoleScopeTagIds = @("0") TargetedAppManagementLevels = "unspecified" AppGroupType = "selectedPublicApps" - CustomSettings = [CimInstance[]]@( + CustomSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_IntuneAppConfigurationPolicyCustomSetting ` -Property @{ - name = 'FakeStringValue' - value = '1' + name = 'FakeStringValue' + value = '2' # Updated property } -ClientOnly) ) } - - Mock -CommandName Get-MgBetaDeviceAppManagementTargetedManagedAppConfiguration -MockWith { - return @{ - DisplayName = 'Test App Configuration Policy' - Description = 'Different Value' - Id = 'A_19dbaff5-9aff-48b0-a60d-d0471ddaf141' - RoleScopeTagIds = @("0") - TargetedAppManagementLevels = "unspecified" - AppGroupType = "selectedPublicApps" - CustomSettings = @( - @{ - name = 'FakeStringValue' - value = '1' - } - ) - } - } } It 'Should return Present from the Get method' { @@ -147,7 +147,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { RoleScopeTagIds = @("0") TargetedAppManagementLevels = "unspecified" AppGroupType = "selectedPublicApps" - CustomSettings = [CimInstance[]]@( + CustomSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_IntuneAppConfigurationPolicyCustomSetting ` -Property @{ @@ -156,27 +156,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } -ClientOnly) ) } - - Mock -CommandName Get-MgBetaDeviceAppManagementTargetedManagedAppConfiguration -MockWith { - return @{ - DisplayName = 'Test App Configuration Policy Desire State' - Description = 'Test Definition' - Id = 'A_19dbaff5-9aff-48b0-a60d-d0471ddaf141' - RoleScopeTagIds = @("0") - TargetedAppManagementLevels = "unspecified" - AppGroupType = "selectedPublicApps" - CustomSettings = @( - @{ - name = 'FakeStringValue' - value = '1' - } - ) - } - } - Mock -CommandName Get-MgBetaDeviceAppManagementTargetedManagedAppConfigurationAssignment -MockWith { - return @() - } - } It 'Should return true from the Test method' { @@ -203,24 +182,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } -ClientOnly) ) } - - Mock -CommandName Get-MgBetaDeviceAppManagementTargetedManagedAppConfiguration -MockWith { - return @{ - DisplayName = 'Test App Configuration Policy' - Description = 'Test Definition' - Id = 'A_19dbaff5-9aff-48b0-a60d-d0471ddaf141' - RoleScopeTagIds = @("0") - TargetedAppManagementLevels = "unspecified" - AppGroupType = "selectedPublicApps" - Apps = @() - CustomSettings = @( - @{ - name = 'FakeStringValue' - value = '1' - } - ) - } - } } It 'Should return Present from the Get method' { @@ -244,23 +205,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementTargetedManagedAppConfiguration -MockWith { - return @{ - DisplayName = 'Test App Configuration Policy' - Description = 'Test Definition' - Id = 'A_19dbaff5-9aff-48b0-a60d-d0471ddaf141' - RoleScopeTagIds = @("0") - TargetedAppManagementLevels = "unspecified" - AppGroupType = "selectedPublicApps" - CustomSettings = @( - @{ - name = 'FakeStringValue' - value = '1' - } - ) - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppleMDMPushNotificationCertificate.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppleMDMPushNotificationCertificate.Tests.ps1 index 80edf77742..1244610be9 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppleMDMPushNotificationCertificate.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneAppleMDMPushNotificationCertificate.Tests.ps1 @@ -43,15 +43,24 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-MgBetaDeviceManagementApplePushNotificationCertificate -MockWith { + return @{ + AppleIdentifier = "Apple ID"; + Certificate = "Test cert"; + Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; + } } - Mock -CommandName Update-MgBetaDeviceManagementApplePushNotificationCertificate -MockWith { + Mock -CommandName Get-MgBetaDeviceManagementDataSharingConsent -MockWith { + return @{ + DataSharingConsentId = "appleMDMPushCertificate" + Granted = $True; + } } - Mock -CommandName Get-MgBetaDeviceManagementDataSharingConsent -MockWith { + Mock -CommandName Update-MgBetaDeviceManagementApplePushNotificationCertificate -MockWith { } - $Script:exportedInstances =$null + $Script:exportedInstance = $null $Script:ExportMode = $false } @@ -64,7 +73,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Certificate = "Test cert"; Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; DataSharingConsetGranted = $True; - Ensure = 'Present'; Credential = $Credential; } @@ -97,25 +105,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Certificate = "Test cert"; Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; DataSharingConsetGranted = $True; - Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementApplePushNotificationCertificate -MockWith { - return @{ - AppleIdentifier = "Patched cert"; - Certificate = "Test cert"; - Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; - } - } - - Mock -CommandName Get-MgBetaDeviceManagementDataSharingConsent -MockWith { - return @{ - DataSharingConsentId = "appleMDMPushCertificate" - Granted = $True; - } - } } It '2.1 Should return values from the Get method' { @@ -137,25 +129,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Certificate = "Test cert"; Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; DataSharingConsetGranted = $True; - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementApplePushNotificationCertificate -MockWith { - return @{ - AppleIdentifier = "Apple ID"; - Certificate = "Test cert"; - Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; - } - } - - Mock -CommandName Get-MgBetaDeviceManagementDataSharingConsent -MockWith { - return @{ - DataSharingConsentId = "appleMDMPushCertificate" - Granted = $True; - } - } } It '3.0 Should return true from the Test method' { @@ -166,29 +142,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name '4. The instance exists and values are NOT in the desired state' -Fixture { BeforeAll { $testParams = @{ - AppleIdentifier = "Apple ID"; - Certificate = "Test cert"; - Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; - DataSharingConsetGranted = $True; - + AppleIdentifier = "Apple ID"; + Certificate = "Patched cert"; # Updated property + Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; + DataSharingConsetGranted = $True; Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementApplePushNotificationCertificate -MockWith { - return @{ - AppleIdentifier = "Apple ID"; #drift - Certificate = "Patched cert base64 string"; #drift - Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; - } - } - - Mock -CommandName Get-MgBetaDeviceManagementDataSharingConsent -MockWith { - return @{ - DataSharingConsentId = "appleMDMPushCertificate" - Granted = $True; - } - } } It '4.1 Should return Values from the Get method' { @@ -212,21 +172,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementApplePushNotificationCertificate -MockWith { - return @{ - AppleIdentifier = "Apple ID"; - Certificate = "Test cert"; - Id = "66f4ec83-754f-4a59-a73d-e3182cc636a5"; - } - } - - Mock -CommandName Get-MgBetaDeviceManagementDataSharingConsent -MockWith { - return @{ - DataSharingConsentId = "appleMDMPushCertificate" - Granted = $True; - } - } } It '5.0 Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDerivedCredential.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDerivedCredential.Tests.ps1 index 8ec3f19f07..69ce32f354 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDerivedCredential.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDerivedCredential.Tests.ps1 @@ -40,6 +40,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Get-MgBetaDeviceManagementDerivedCredential -MockWith { + return @{ + Ensure = 'Present' + DisplayName = "K5"; + HelpUrl = "http://www.ff.com/"; + Id = "a409d85f-2a49-440d-884a-80fb52a557ab"; + Issuer = "purebred"; + NotificationType = "email"; + } } Mock -CommandName New-MgBetaDeviceManagementDerivedCredential -MockWith { } @@ -91,16 +99,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NotificationType = "email"; Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDerivedCredential -MockWith { - return @{ - DisplayName = "K5"; - HelpUrl = "http://www.ff.com/"; - Id = "a409d85f-2a49-440d-884a-80fb52a557ab"; - Issuer = "purebred"; - NotificationType = "email"; - } - } } It ' 2.1 Should return Values from the Get method' { (Get-TargetResource @testParams).Ensure | Should -Be 'Present' @@ -126,17 +124,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NotificationType = "email"; Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDerivedCredential -MockWith { - return @{ - Ensure = 'Present' - DisplayName = "K5"; - HelpUrl = "http://www.ff.com/"; - Id = "a409d85f-2a49-440d-884a-80fb52a557ab"; - Issuer = "purebred"; - NotificationType = "email"; - } - } } It ' 3.0 Should return true from the Test method' { @@ -149,22 +136,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Ensure = 'Present' DisplayName = "K5"; - HelpUrl = "http://www.ff.com/"; + HelpUrl = "http://www.ff2.com/"; # Updated property Id = "a409d85f-2a49-440d-884a-80fb52a557ab"; Issuer = "purebred"; NotificationType = "email"; Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDerivedCredential -MockWith { - return @{ - DisplayName = "K5 drift"; #drift - HelpUrl = "http://www.ff.com/"; - Id = "a409d85f-2a49-440d-884a-80fb52a557ab"; - Issuer = "purebred"; - NotificationType = "email"; - } - } } It ' 4.1 Should return Values from the Get method' { @@ -185,16 +162,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDerivedCredential -MockWith { - return @{ - DisplayName = "K5"; - HelpUrl = "http://www.ff.com/"; - Id = "a409d85f-2a49-440d-884a-80fb52a557ab"; - Issuer = "purebred"; - NotificationType = "email"; - } - } } It ' 5.0 Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceAndAppManagementAssignmentFilter.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceAndAppManagementAssignmentFilter.Tests.ps1 index 000e2ab662..6700ed0670 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceAndAppManagementAssignmentFilter.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceAndAppManagementAssignmentFilter.Tests.ps1 @@ -41,6 +41,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementAssignmentFilter -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementAssignmentFilter -MockWith { + return @{ + Description = 'Test' + DisplayName = 'Test Device Filter' + AssignmentFilterManagementType = 'devices' + Platform = 'windows10AndLater' + Rule = "(device.manufacturer -ne `"bibi`")" + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -86,19 +96,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = 'Test Device Filter' Ensure = 'Present' Platform = 'windows10AndLater' - Rule = "(device.manufacturer -ne `"bibi`")" + Rule = "(device.manufacturer -ne `"test`")" # Updated property Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementAssignmentFilter -MockWith { - return @{ - Description = 'Test' - DisplayName = 'Test Device Filter' - AssignmentFilterManagementType = 'devices' - Platform = 'windows10AndLater' - Rule = "(device.manufacturer -ne `"test`")"; #drift - } - } } It 'Should return Present from the Get method' { @@ -125,16 +125,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Rule = "(device.manufacturer -ne `"bibi`")" Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementAssignmentFilter -MockWith { - return @{ - Description = 'Test' - DisplayName = 'Test Device Filter' - AssignmentFilterManagementType = 'devices' - Platform = 'windows10AndLater' - Rule = "(device.manufacturer -ne `"bibi`")" - } - } } It 'Should return true from the Test method' { @@ -152,16 +142,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Rule = "(device.manufacturer -ne `"bibi`")" Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementAssignmentFilter -MockWith { - return @{ - Description = 'Test' - DisplayName = 'Test Device Filter' - AssignmentFilterManagementType = 'devices' - Platform = 'windows10AndLater' - Rule = "(device.manufacturer -ne `"bibi`")" - } - } } It 'Should return Present from the Get method' { @@ -185,16 +165,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementAssignmentFilter -MockWith { - return @{ - Description = 'Test' - DisplayName = 'Test Device Filter' - AssignmentFilterManagementType = 'devices' - Platform = 'windows10AndLater' - Rule = "(device.manufacturer -ne `"bibi`")" - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCategory.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCategory.Tests.ps1 index 9469f98e1a..77d54def2b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCategory.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCategory.Tests.ps1 @@ -32,6 +32,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCategory -MockWith { + return @{ + DisplayName = 'Test Category' + Description = 'Test Definition' + Id = '12345-12345-12345-12345-12345' + } + } + Mock -CommandName Update-MgBetaDeviceManagementDeviceCategory -MockWith { } @@ -85,14 +93,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCategory -MockWith { - return @{ - DisplayName = 'Test Category' - Description = 'Test Definition' - Id = '12345-12345-12345-12345-12345' - } - } } It 'Should return Present from the Get method' { @@ -117,14 +117,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCategory -MockWith { - return @{ - DisplayName = 'Test Category' - Description = 'Test Definition' - Id = '12345-12345-12345-12345-12345' - } - } } It 'Should return true from the Test method' { @@ -136,18 +128,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { BeforeAll { $testParams = @{ DisplayName = 'Test Category' - Description = 'Test Definition' + Description = 'Different Value' # Updated property Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCategory -MockWith { - return @{ - DisplayName = 'Test Category' - Description = 'Different Value' - Id = '12345-12345-12345-12345-12345' - } - } } It 'Should return Present from the Get method' { @@ -171,14 +155,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCategory -MockWith { - return @{ - DisplayName = 'Test Category' - Description = 'Test Definition' - Id = '12345-12345-12345-12345-12345' - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCleanupRule.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCleanupRule.Tests.ps1 index 028b34a7f8..fdbddbaf86 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCleanupRule.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCleanupRule.Tests.ps1 @@ -36,6 +36,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Invoke-MgGraphRequest -MockWith { + return @{ + DeviceInactivityBeforeRetirementInDays = 30 + } } # Mock Write-M365DSCHost to hide output during the tests @@ -86,12 +89,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { IsSingleInstance = 'Yes' Credential = $Credential } - - Mock -CommandName Invoke-MgGraphRequest -MockWith { - return @{ - DeviceInactivityBeforeRetirementInDays = 30 - } - } } It 'Should return true from the Test method' { @@ -106,12 +103,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Invoke-MgGraphRequest -MockWith { - return @{ - DeviceInactivityBeforeRetirementInDays = 30 - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidDeviceOwner.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidDeviceOwner.Tests.ps1 index a45a8f1946..475ec571fa 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidDeviceOwner.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidDeviceOwner.Tests.ps1 @@ -41,8 +41,74 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { } - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { + return @{ + DisplayName = 'Test Android Device Owner Device Compliance Policy' + Description = 'Test Android Device Owner Device Compliance Policy Description' + Id = '9c4e2ed7-706e-4874-a826-0c2778352d46' + ScheduledActionsForRule =@( + @{ + ruleName = '' + scheduledActionConfigurations = @( + @{ + actionType = 'block' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @() + }, + @{ + actionType = 'pushNotification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @() + }, + @{ + actionType = 'remoteLock' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @() + }, + @{ + actionType = 'Notification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') + } + ) + } + ) + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.androidDeviceOwnerCompliancePolicy' + PasswordMinimumLetterCharacters = 1 + PasswordMinimumLowerCaseCharacters = 1 + PasswordMinimumNonLetterCharacters = 1 + PasswordMinimumNumericCharacters = 1 + PasswordMinimumSymbolCharacters = 1 + PasswordMinimumUpperCaseCharacters = 1 + RequireNoPendingSystemUpdates = $true + DeviceThreatProtectionEnabled = $True + DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' + AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' + SecurityRequireSafetyNetAttestationBasicIntegrity = $True + SecurityRequireSafetyNetAttestationCertifiedDevice = $True + OsMinimumVersion = 7 + OsMaximumVersion = 11 + PasswordRequired = $True + PasswordMinimumLength = 6 + PasswordRequiredType = 'DeviceDefault' + PasswordMinutesOfInactivityBeforeLock = 5 + PasswordExpirationDays = 365 + PasswordPreviousPasswordCountToBlock = 10 + StorageRequireEncryption = $True + SecurityRequireIntuneAppIntegrity = $True + RoleScopeTagIds = '0' + minAndroidSecurityPatchLevel = '2024-01-24' + securityRequiredAndroidSafetyNetEvaluationType = 'hardwareBacked' + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { return @() } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -87,36 +153,36 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential ScheduledActionsForRule = [CimInstance[]]@( - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - } -ClientOnly) - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - } -ClientOnly) - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - } -ClientOnly) - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } -ClientOnly) - ) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'block' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + } -ClientOnly) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'pushNotification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + } -ClientOnly) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'remoteLock' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + } -ClientOnly) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'Notification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') + } -ClientOnly) + ) } Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { @@ -170,103 +236,36 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential ScheduledActionsForRule = [CimInstance[]]@( - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - } -ClientOnly) - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - } -ClientOnly) - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - } -ClientOnly) - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } -ClientOnly) - ) - } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test Android Device Owner Device Compliance Policy' - Description = 'Different Value' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d46' - ScheduledActionsForRule =@( - @{ - ruleName = '' - scheduledActionConfigurations = @( - @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } - ) - } - ) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidDeviceOwnerCompliancePolicy' - PasswordMinimumLetterCharacters = 1 - PasswordMinimumLowerCaseCharacters = 1 - PasswordMinimumNonLetterCharacters = 1 - PasswordMinimumNumericCharacters = 1 - PasswordMinimumSymbolCharacters = 1 - PasswordMinimumUpperCaseCharacters = 1 - RequireNoPendingSystemUpdates = $true - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' - SecurityRequireSafetyNetAttestationBasicIntegrity = $True - SecurityRequireSafetyNetAttestationCertifiedDevice = $True - OsMinimumVersion = 7 - OsMaximumVersion = 11 - PasswordRequired = $True - PasswordMinimumLength = 6 - PasswordRequiredType = 'DeviceDefault' - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordExpirationDays = 365 - PasswordPreviousPasswordCountToBlock = 10 - StorageRequireEncryption = $True - SecurityRequireIntuneAppIntegrity = $True - RoleScopeTagIds = '0' - minAndroidSecurityPatchLevel = '2024-01-24' - securityRequiredAndroidSafetyNetEvaluationType = 'hardwareBacked' - } - } + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'block' + gracePeriodHours = 1 # Updated property + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + } -ClientOnly) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'pushNotification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + } -ClientOnly) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'remoteLock' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + } -ClientOnly) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'Notification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') + } -ClientOnly) + ) } } @@ -316,103 +315,36 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { securityRequiredAndroidSafetyNetEvaluationType = 'hardwareBacked' Credential = $Credential ScheduledActionsForRule = [CimInstance[]]@( - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - } -ClientOnly) - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - } -ClientOnly) - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - } -ClientOnly) - (New-CimInstance ` - -ClassName MSFT_scheduledActionConfigurations ` - -Property @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } -ClientOnly) - ) - } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test Android Device Owner Device Compliance Policy' - Description = 'Test Android Device Owner Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d46' - ScheduledActionsForRule =@( - @{ - ruleName = '' - scheduledActionConfigurations = @( - @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } - ) - } - ) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidDeviceOwnerCompliancePolicy' - PasswordMinimumLetterCharacters = 1 - PasswordMinimumLowerCaseCharacters = 1 - PasswordMinimumNonLetterCharacters = 1 - PasswordMinimumNumericCharacters = 1 - PasswordMinimumSymbolCharacters = 1 - PasswordMinimumUpperCaseCharacters = 1 - RequireNoPendingSystemUpdates = $true - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' - SecurityRequireSafetyNetAttestationBasicIntegrity = $True - SecurityRequireSafetyNetAttestationCertifiedDevice = $True - OsMinimumVersion = 7 - OsMaximumVersion = 11 - PasswordRequired = $True - PasswordMinimumLength = 6 - PasswordRequiredType = 'DeviceDefault' - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordExpirationDays = 365 - PasswordPreviousPasswordCountToBlock = 10 - StorageRequireEncryption = $True - SecurityRequireIntuneAppIntegrity = $True - RoleScopeTagIds = '0' - minAndroidSecurityPatchLevel = '2024-01-24' - securityRequiredAndroidSafetyNetEvaluationType = 'hardwareBacked' - } - } + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'block' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + } -ClientOnly) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'pushNotification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + } -ClientOnly) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'remoteLock' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + } -ClientOnly) + (New-CimInstance ` + -ClassName MSFT_scheduledActionConfigurations ` + -Property @{ + actionType = 'Notification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') + } -ClientOnly) + ) } } @@ -428,73 +360,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test Android Device Owner Device Compliance Policy' - Description = 'Test Android Device Owner Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d46' - ScheduledActionsForRule =@( - @{ - ruleName = '' - scheduledActionConfigurations = @( - @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } - ) - } - ) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidDeviceOwnerCompliancePolicy' - PasswordMinimumLetterCharacters = 1 - PasswordMinimumLowerCaseCharacters = 1 - PasswordMinimumNonLetterCharacters = 1 - PasswordMinimumNumericCharacters = 1 - PasswordMinimumSymbolCharacters = 1 - PasswordMinimumUpperCaseCharacters = 1 - RequireNoPendingSystemUpdates = $true - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' - SecurityRequireSafetyNetAttestationBasicIntegrity = $True - SecurityRequireSafetyNetAttestationCertifiedDevice = $True - OsMinimumVersion = 7 - OsMaximumVersion = 11 - PasswordRequired = $True - PasswordMinimumLength = 6 - PasswordRequiredType = 'DeviceDefault' - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordExpirationDays = 365 - PasswordPreviousPasswordCountToBlock = 10 - StorageRequireEncryption = $True - SecurityRequireIntuneAppIntegrity = $True - RoleScopeTagIds = '0' - minAndroidSecurityPatchLevel = '2024-01-24' - securityRequiredAndroidSafetyNetEvaluationType = 'hardwareBacked' - } - } - } } It 'Should return Present from the Get method' { @@ -518,73 +383,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test Android Device Owner Device Compliance Policy' - Description = 'Test Android Device Owner Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d46' - ScheduledActionsForRule =@( - @{ - ruleName = '' - scheduledActionConfigurations = @( - @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } - ) - } - ) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidDeviceOwnerCompliancePolicy' - PasswordMinimumLetterCharacters = 1 - PasswordMinimumLowerCaseCharacters = 1 - PasswordMinimumNonLetterCharacters = 1 - PasswordMinimumNumericCharacters = 1 - PasswordMinimumSymbolCharacters = 1 - PasswordMinimumUpperCaseCharacters = 1 - RequireNoPendingSystemUpdates = $true - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' - SecurityRequireSafetyNetAttestationBasicIntegrity = $True - SecurityRequireSafetyNetAttestationCertifiedDevice = $True - OsMinimumVersion = 7 - OsMaximumVersion = 11 - PasswordRequired = $True - PasswordMinimumLength = 6 - PasswordRequiredType = 'DeviceDefault' - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordExpirationDays = 365 - PasswordPreviousPasswordCountToBlock = 10 - StorageRequireEncryption = $True - SecurityRequireIntuneAppIntegrity = $True - RoleScopeTagIds = '0' - minAndroidSecurityPatchLevel = '2024-01-24' - securityRequiredAndroidSafetyNetEvaluationType = 'hardwareBacked' - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidWorkProfile.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidWorkProfile.Tests.ps1 index bb3ae2d788..2d761a2519 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidWorkProfile.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyAndroidWorkProfile.Tests.ps1 @@ -41,8 +41,84 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { } - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { + return @{ + DisplayName = 'Test Android Work Profile Device Compliance Policy' + Description = 'Test Android Work Profile Device Compliance Policy Description' + Id = '9c4e2ed7-706e-4874-a826-0c2778352d46' + ScheduledActionsForRule =@( + @{ + ruleName = '' + scheduledActionConfigurations = @( + @{ + actionType = 'block' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @() + }, + @{ + actionType = 'pushNotification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @() + }, + @{ + actionType = 'remoteLock' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @() + }, + @{ + actionType = 'Notification' + gracePeriodHours = 0 + notificationTemplateId = '00000000-0000-0000-0000-000000000000' + notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') + } + ) + } + ) + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.androidWorkProfileCompliancePolicy' + PasswordRequired = $True + PasswordMinimumLength = 6 + PasswordRequiredType = 'DeviceDefault' + RequiredPasswordComplexity = 'low' + PasswordMinutesOfInactivityBeforeLock = 5 + PasswordExpirationDays = 365 + PasswordPreviousPasswordBlockCount = 10 + PasswordSignInFailureCountBeforeFactoryReset = 11 + SecurityPreventInstallAppsFromUnknownSources = $True + SecurityDisableUsbDebugging = $True + SecurityRequireVerifyApps = $True + DeviceThreatProtectionEnabled = $True + DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' + AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' + SecurityBlockJailbrokenDevices = $True + OsMinimumVersion = 7 + OsMaximumVersion = 11 + StorageRequireEncryption = $True + SecurityRequireSafetyNetAttestationBasicIntegrity = $True + SecurityRequireSafetyNetAttestationCertifiedDevice = $True + SecurityRequireGooglePlayServices = $True + SecurityRequireUpToDateSecurityProviders = $True + SecurityRequireCompanyPortalAppIntegrity = $True + RoleScopeTagIds = '0' + MinAndroidSecurityPatchLevel = "2024-01-01"; + SecurityRequiredAndroidSafetyNetEvaluationType = "hardwareBacked" + WorkProfileInactiveBeforeScreenLockInMinutes = 480 + WorkProfilePasswordExpirationInDays = 30 + WorkProfilePasswordMinimumLength = 12 + WorkProfilePasswordRequiredType = "atLeastNumeric" + WorkProfilePreviousPasswordBlockCount = 5 + WorkProfileRequiredPasswordComplexity = "high" + WorkProfileRequirePassword = $True + SecurityBlockDeviceAdministratorManagedDevices = $true + RestrictedApps = @('App1', 'App2', 'App3') + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { return @() } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -175,7 +251,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SecurityRequireCompanyPortalAppIntegrity = $True MinAndroidSecurityPatchLevel = "2024-01-01"; SecurityRequiredAndroidSafetyNetEvaluationType = "hardwareBacked" - WorkProfileInactiveBeforeScreenLockInMinutes = 480 + WorkProfileInactiveBeforeScreenLockInMinutes = 360 # Updated property WorkProfilePasswordExpirationInDays = 30 WorkProfilePasswordMinimumLength = 12 WorkProfilePasswordRequiredType = "atLeastNumeric" @@ -220,83 +296,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ) } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test Android Work Profile Device Compliance Policy' - Description = 'Test Android Work Profile Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d47' - ScheduledActionsForRule =@( - @{ - ruleName = '' - scheduledActionConfigurations = @( - @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } - ) - } - ) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileCompliancePolicy' - PasswordRequired = $True - PasswordMinimumLength = 6 - PasswordRequiredType = 'DeviceDefault' - RequiredPasswordComplexity = 'low' - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordExpirationDays = 365 - PasswordPreviousPasswordBlockCount = 10 - PasswordSignInFailureCountBeforeFactoryReset = 11 - SecurityPreventInstallAppsFromUnknownSources = $True - SecurityDisableUsbDebugging = $True - SecurityRequireVerifyApps = $True - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' - SecurityBlockJailbrokenDevices = $True - OsMinimumVersion = 7 - OsMaximumVersion = 11 - StorageRequireEncryption = $True - SecurityRequireSafetyNetAttestationBasicIntegrity = $True - SecurityRequireSafetyNetAttestationCertifiedDevice = $True - SecurityRequireGooglePlayServices = $True - SecurityRequireUpToDateSecurityProviders = $True - SecurityRequireCompanyPortalAppIntegrity = $True - RoleScopeTagIds = '0' - MinAndroidSecurityPatchLevel = "2024-01-01"; - SecurityRequiredAndroidSafetyNetEvaluationType = "hardwareBacked" - WorkProfileInactiveBeforeScreenLockInMinutes = 480 - WorkProfilePasswordExpirationInDays = 30 - WorkProfilePasswordMinimumLength = 12 - WorkProfilePasswordRequiredType = "atLeastNumeric" - WorkProfilePreviousPasswordBlockCount = 5 - WorkProfileRequiredPasswordComplexity = "high" - WorkProfileRequirePassword = $True - SecurityBlockDeviceAdministratorManagedDevices = $true - RestrictedApps = @('App1', 'App2', 'App3') - } - } - } } It 'Should return Present from the Get method' { @@ -386,83 +385,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } -ClientOnly) ) } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test Android Work Profile Device Compliance Policy' - Description = 'Test Android Work Profile Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d46' - ScheduledActionsForRule =@( - @{ - ruleName = '' - scheduledActionConfigurations = @( - @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } - ) - } - ) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileCompliancePolicy' - PasswordRequired = $True - PasswordMinimumLength = 6 - PasswordRequiredType = 'DeviceDefault' - RequiredPasswordComplexity = 'low' - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordExpirationDays = 365 - PasswordPreviousPasswordBlockCount = 10 - PasswordSignInFailureCountBeforeFactoryReset = 11 - SecurityPreventInstallAppsFromUnknownSources = $True - SecurityDisableUsbDebugging = $True - SecurityRequireVerifyApps = $True - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' - SecurityBlockJailbrokenDevices = $True - OsMinimumVersion = 7 - OsMaximumVersion = 11 - StorageRequireEncryption = $True - SecurityRequireSafetyNetAttestationBasicIntegrity = $True - SecurityRequireSafetyNetAttestationCertifiedDevice = $True - SecurityRequireGooglePlayServices = $True - SecurityRequireUpToDateSecurityProviders = $True - SecurityRequireCompanyPortalAppIntegrity = $True - RoleScopeTagIds = '0' - MinAndroidSecurityPatchLevel = "2024-01-01"; - SecurityRequiredAndroidSafetyNetEvaluationType = "hardwareBacked" - WorkProfileInactiveBeforeScreenLockInMinutes = 480 - WorkProfilePasswordExpirationInDays = 30 - WorkProfilePasswordMinimumLength = 12 - WorkProfilePasswordRequiredType = "atLeastNumeric" - WorkProfilePreviousPasswordBlockCount = 5 - WorkProfileRequiredPasswordComplexity = "high" - WorkProfileRequirePassword = $True - SecurityBlockDeviceAdministratorManagedDevices = $true - RestrictedApps = @('App1', 'App2', 'App3') - } - } - } } It 'Should return true from the Test method' { @@ -534,74 +456,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } -ClientOnly) ) } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test Android Work Profile Device Compliance Policy' - Description = 'Test Android Work Profile Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d46' - ScheduledActionsForRule =@( - @{ - ruleName = '' - scheduledActionConfigurations = @( - @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } - ) - } - ) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileCompliancePolicy' - PasswordRequired = $True - PasswordMinimumLength = 6 - PasswordRequiredType = 'DeviceDefault' - RequiredPasswordComplexity = 'low' - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordExpirationDays = 365 - PasswordPreviousPasswordBlockCount = 10 - PasswordSignInFailureCountBeforeFactoryReset = 11 - SecurityPreventInstallAppsFromUnknownSources = $True - SecurityDisableUsbDebugging = $True - SecurityRequireVerifyApps = $True - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' - SecurityBlockJailbrokenDevices = $True - OsMinimumVersion = 7 - OsMaximumVersion = 11 - StorageRequireEncryption = $True - SecurityRequireSafetyNetAttestationBasicIntegrity = $True - SecurityRequireSafetyNetAttestationCertifiedDevice = $True - SecurityRequireGooglePlayServices = $True - SecurityRequireUpToDateSecurityProviders = $True - SecurityRequireCompanyPortalAppIntegrity = $True - RoleScopeTagIds = '0' - SecurityBlockDeviceAdministratorManagedDevices = $true - RestrictedApps = @('App1', 'App2', 'App3') - } - } - } } It 'Should return Present from the Get method' { @@ -625,73 +479,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test Android Device Compliance Policy' - Description = 'Test Android Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d46' - ScheduledActionsForRule =@( - @{ - ruleName = '' - scheduledActionConfigurations = @( - @{ - actionType = 'block' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'pushNotification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'remoteLock' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @() - }, - @{ - actionType = 'Notification' - gracePeriodHours = 0 - notificationTemplateId = '00000000-0000-0000-0000-000000000000' - notificationMessageCCList = @('00000000-0000-0000-0000-000000000000','00000000-0000-0000-0000-000000000000') - } - ) - } - ) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileCompliancePolicy' - PasswordRequired = $True - PasswordMinimumLength = 6 - PasswordRequiredType = 'DeviceDefault' - RequiredPasswordComplexity = 'low' - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordExpirationDays = 365 - PasswordPreviousPasswordBlockCount = 10 - PasswordSignInFailureCountBeforeFactoryReset = 11 - SecurityPreventInstallAppsFromUnknownSources = $True - SecurityDisableUsbDebugging = $True - SecurityRequireVerifyApps = $True - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - AdvancedThreatProtectionRequiredSecurityLevel = 'Unavailable' - SecurityBlockJailbrokenDevices = $True - OsMinimumVersion = 7 - OsMaximumVersion = 11 - StorageRequireEncryption = $True - SecurityRequireSafetyNetAttestationBasicIntegrity = $True - SecurityRequireSafetyNetAttestationCertifiedDevice = $True - SecurityRequireGooglePlayServices = $True - SecurityRequireUpToDateSecurityProviders = $True - SecurityRequireCompanyPortalAppIntegrity = $True - SecurityBlockDeviceAdministratorManagedDevices = $true - RestrictedApps = @('App1', 'App2', 'App3') - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyMacOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyMacOS.Tests.ps1 index 7fe0748ddc..716fa56d6d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyMacOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyMacOS.Tests.ps1 @@ -41,6 +41,34 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { + return @{ + DisplayName = 'MacOS DSC Policy' + Description = 'Test policy' + Id = 'd95e706d-c92c-410d-a132-09e0b1032dbd' + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.macOSCompliancePolicy' + PasswordRequired = $False + PasswordBlockSimple = $False + PasswordExpirationDays = 365 + PasswordMinimumLength = 6 + PasswordMinutesOfInactivityBeforeLock = 5 + PasswordPreviousPasswordBlockCount = 13 + PasswordMinimumCharacterSetCount = 1 + PasswordRequiredType = 'DeviceDefault' + OsMinimumVersion = 10 + OsMaximumVersion = 13 + SystemIntegrityProtectionEnabled = $False + DeviceThreatProtectionEnabled = $False + DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' + StorageRequireEncryption = $False + FirewallEnabled = $False + FirewallBlockAllIncoming = $False + FirewallEnableStealthMode = $False + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { return @() @@ -113,7 +141,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PasswordPreviousPasswordBlockCount = 13 PasswordMinimumCharacterSetCount = 1 PasswordRequiredType = 'DeviceDefault' - OsMinimumVersion = 10 + OsMinimumVersion = 11 # Updated property OsMaximumVersion = 13 SystemIntegrityProtectionEnabled = $False DeviceThreatProtectionEnabled = $False @@ -125,35 +153,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'MacOS DSC Policy' - Description = 'Test policy with different value' - Id = 'd95e706d-c92c-410d-a132-09e0b1032dbd' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.macOSCompliancePolicy' - PasswordRequired = $False - PasswordBlockSimple = $False - PasswordExpirationDays = 365 - PasswordMinimumLength = 6 - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordPreviousPasswordBlockCount = 13 - PasswordMinimumCharacterSetCount = 1 - PasswordRequiredType = 'DeviceDefault' - OsMinimumVersion = 10 - OsMaximumVersion = 13 - SystemIntegrityProtectionEnabled = $False - DeviceThreatProtectionEnabled = $False - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - StorageRequireEncryption = $False - FirewallEnabled = $False - FirewallBlockAllIncoming = $False - FirewallEnableStealthMode = $False - RoleScopeTagIds = '0' - } - } - } } It 'Should return Present from the Get method' { @@ -196,37 +195,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'MacOS DSC Policy' - Description = 'Test policy' - Id = 'd95e706d-c92c-410d-a132-09e0b1032dbd' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.macOSCompliancePolicy' - PasswordRequired = $False - PasswordBlockSimple = $False - PasswordExpirationDays = 365 - PasswordMinimumLength = 6 - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordPreviousPasswordBlockCount = 13 - PasswordMinimumCharacterSetCount = 1 - PasswordRequiredType = 'DeviceDefault' - OsMinimumVersion = 10 - OsMaximumVersion = 13 - SystemIntegrityProtectionEnabled = $False - DeviceThreatProtectionEnabled = $False - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - StorageRequireEncryption = $False - FirewallEnabled = $False - FirewallBlockAllIncoming = $False - FirewallEnableStealthMode = $False - } - } - } - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { - return @() - } } It 'Should return true from the Test method' { @@ -259,35 +227,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'MacOS DSC Policy' - Description = 'Test policy' - Id = 'd95e706d-c92c-410d-a132-09e0b1032dbd' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.macOSCompliancePolicy' - PasswordRequired = $False - PasswordBlockSimple = $False - PasswordExpirationDays = 365 - PasswordMinimumLength = 6 - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordPreviousPasswordBlockCount = 13 - PasswordMinimumCharacterSetCount = 1 - PasswordRequiredType = 'DeviceDefault' - OsMinimumVersion = 10 - OsMaximumVersion = 13 - SystemIntegrityProtectionEnabled = $False - DeviceThreatProtectionEnabled = $False - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - StorageRequireEncryption = $False - FirewallEnabled = $False - FirewallBlockAllIncoming = $False - FirewallEnableStealthMode = $False - RoleScopeTagIds = '0' - } - } - } } It 'Should return Present from the Get method' { @@ -311,35 +250,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'MacOS DSC Policy' - Description = 'Test policy' - Id = 'd95e706d-c92c-410d-a132-09e0b1032dbd' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.macOSCompliancePolicy' - PasswordRequired = $False - PasswordBlockSimple = $False - PasswordExpirationDays = 365 - PasswordMinimumLength = 6 - PasswordMinutesOfInactivityBeforeLock = 5 - PasswordPreviousPasswordBlockCount = 13 - PasswordMinimumCharacterSetCount = 1 - PasswordRequiredType = 'DeviceDefault' - OsMinimumVersion = 10 - OsMaximumVersion = 13 - SystemIntegrityProtectionEnabled = $False - DeviceThreatProtectionEnabled = $False - DeviceThreatProtectionRequiredSecurityLevel = 'Unavailable' - StorageRequireEncryption = $False - FirewallEnabled = $False - FirewallBlockAllIncoming = $False - FirewallEnableStealthMode = $False - RoleScopeTagIds = '0' - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyWindows10.Tests.ps1 index 6ef354a92c..20e0445eca 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyWindows10.Tests.ps1 @@ -51,6 +51,50 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return @() } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { + return @{ + DisplayName = 'Windows 10 DSC Policy' + Description = 'Test policy' + Id = 'f38b283d-d893-4c33-b6d2-d3bcb5f2dcc2' + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.windows10CompliancePolicy' + PasswordRequired = $False + PasswordBlockSimple = $False + PasswordRequiredToUnlockFromIdle = $True + PasswordMinutesOfInactivityBeforeLock = 15 + PasswordExpirationDays = 365 + PasswordMinimumLength = 6 + PasswordPreviousPasswordBlockCount = 13 + PasswordMinimumCharacterSetCount = 1 + PasswordRequiredType = 'Devicedefault' + RequireHealthyDeviceReport = $True + OsMinimumVersion = 10 + OsMaximumVersion = 10.19 + MobileOsMinimumVersion = 10 + MobileOsMaximumVersion = 10.19 + EarlyLaunchAntiMalwareDriverEnabled = $False + BitLockerEnabled = $False + SecureBootEnabled = $True + CodeIntegrityEnabled = $True + StorageRequireEncryption = $True + ActiveFirewallRequired = $True + DefenderEnabled = $True + DefenderVersion = '' + SignatureOutOfDate = $True + RtpEnabled = $True + AntivirusRequired = $True + AntiSpywareRequired = $True + DeviceThreatProtectionEnabled = $True + DeviceThreatProtectionRequiredSecurityLevel = 'Medium' + ConfigurationManagerComplianceRequired = $False + TPMRequired = $False + DeviceCompliancePolicyScript = $null + ValidOperatingSystemBuildRanges = @() + RoleScopeTagIds = '0' + } + } + } + Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } @@ -134,7 +178,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = 'Windows 10 DSC Policy' Description = 'Test policy' PasswordRequired = $False - PasswordBlockSimple = $False + PasswordBlockSimple = $True # Drift PasswordRequiredToUnlockFromIdle = $True PasswordMinutesOfInactivityBeforeLock = 15 PasswordExpirationDays = 365 @@ -168,50 +212,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Windows 10 DSC Policy' - Description = 'Test policy' - Id = 'f38b283d-d893-4c33-b6d2-d3bcb5f2dcc2' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windows10CompliancePolicy' - PasswordRequired = $False - PasswordBlockSimple = $True; #Drift - PasswordRequiredToUnlockFromIdle = $True - PasswordMinutesOfInactivityBeforeLock = 15 - PasswordExpirationDays = 365 - PasswordMinimumLength = 6 - PasswordPreviousPasswordBlockCount = 13 - PasswordMinimumCharacterSetCount = 1 - PasswordRequiredType = 'Devicedefault' - RequireHealthyDeviceReport = $True - OsMinimumVersion = 10 - OsMaximumVersion = 10.19 - MobileOsMinimumVersion = 10 - MobileOsMaximumVersion = 10.19 - EarlyLaunchAntiMalwareDriverEnabled = $False - BitLockerEnabled = $False - SecureBootEnabled = $True - CodeIntegrityEnabled = $True - StorageRequireEncryption = $True - ActiveFirewallRequired = $True - DefenderEnabled = $True - DefenderVersion = '' - SignatureOutOfDate = $True - RtpEnabled = $True - AntivirusRequired = $True - AntiSpywareRequired = $True - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Medium' - ConfigurationManagerComplianceRequired = $False - TPMRequired = $False - DeviceCompliancePolicyScript = $null - ValidOperatingSystemBuildRanges = @() - RoleScopeTagIds = '0' - } - } - } } It 'Should return Present from the Get method' { @@ -268,50 +268,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Windows 10 DSC Policy' - Description = 'Test policy' - Id = 'f38b283d-d893-4c33-b6d2-d3bcb5f2dcc2' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windows10CompliancePolicy' - PasswordRequired = $False - PasswordBlockSimple = $False - PasswordRequiredToUnlockFromIdle = $True - PasswordMinutesOfInactivityBeforeLock = 15 - PasswordExpirationDays = 365 - PasswordMinimumLength = 6 - PasswordPreviousPasswordBlockCount = 13 - PasswordMinimumCharacterSetCount = 1 - PasswordRequiredType = 'Devicedefault' - RequireHealthyDeviceReport = $True - OsMinimumVersion = 10 - OsMaximumVersion = 10.19 - MobileOsMinimumVersion = 10 - MobileOsMaximumVersion = 10.19 - EarlyLaunchAntiMalwareDriverEnabled = $False - BitLockerEnabled = $False - SecureBootEnabled = $True - CodeIntegrityEnabled = $True - StorageRequireEncryption = $True - ActiveFirewallRequired = $True - DefenderEnabled = $True - DefenderVersion = '' - SignatureOutOfDate = $True - RtpEnabled = $True - AntivirusRequired = $True - AntiSpywareRequired = $True - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Medium' - ConfigurationManagerComplianceRequired = $False - TPMRequired = $False - DeviceCompliancePolicyScript = $null - ValidOperatingSystemBuildRanges = @() - RoleScopeTagIds = '0' - } - } - } } It 'Should return true from the Test method' { @@ -359,50 +315,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Windows 10 DSC Policy' - Description = 'Test policy' - Id = 'f38b283d-d893-4c33-b6d2-d3bcb5f2dcc2' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windows10CompliancePolicy' - PasswordRequired = $False - PasswordBlockSimple = $False - PasswordRequiredToUnlockFromIdle = $True - PasswordMinutesOfInactivityBeforeLock = 15 - PasswordExpirationDays = 365 - PasswordMinimumLength = 6 - PasswordPreviousPasswordBlockCount = 13 - PasswordMinimumCharacterSetCount = 1 - PasswordRequiredType = 'Devicedefault' - RequireHealthyDeviceReport = $True - OsMinimumVersion = 10 - OsMaximumVersion = 10.19 - MobileOsMinimumVersion = 10 - MobileOsMaximumVersion = 10.19 - EarlyLaunchAntiMalwareDriverEnabled = $False - BitLockerEnabled = $False - SecureBootEnabled = $True - CodeIntegrityEnabled = $True - StorageRequireEncryption = $True - ActiveFirewallRequired = $True - DefenderEnabled = $True - DefenderVersion = '' - SignatureOutOfDate = $True - RtpEnabled = $True - AntivirusRequired = $True - AntiSpywareRequired = $True - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Medium' - ConfigurationManagerComplianceRequired = $False - TPMRequired = $False - DeviceCompliancePolicyScript = $null - ValidOperatingSystemBuildRanges = @() - RoleScopeTagIds = '0' - } - } - } } It 'Should return Present from the Get method' { @@ -426,50 +338,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Windows 10 DSC Policy' - Description = 'Test policy' - Id = 'f38b283d-d893-4c33-b6d2-d3bcb5f2dcc2' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windows10CompliancePolicy' - PasswordRequired = $False - PasswordBlockSimple = $False - PasswordRequiredToUnlockFromIdle = $True - PasswordMinutesOfInactivityBeforeLock = 15 - PasswordExpirationDays = 365 - PasswordMinimumLength = 6 - PasswordPreviousPasswordBlockCount = 13 - PasswordMinimumCharacterSetCount = 1 - PasswordRequiredType = 'Devicedefault' - RequireHealthyDeviceReport = $True - OsMinimumVersion = 10 - OsMaximumVersion = 10.19 - MobileOsMinimumVersion = 10 - MobileOsMaximumVersion = 10.19 - EarlyLaunchAntiMalwareDriverEnabled = $False - BitLockerEnabled = $False - SecureBootEnabled = $True - CodeIntegrityEnabled = $True - StorageRequireEncryption = $True - ActiveFirewallRequired = $True - DefenderEnabled = $True - DefenderVersion = '' - SignatureOutOfDate = $True - RtpEnabled = $True - AntivirusRequired = $True - AntiSpywareRequired = $True - DeviceThreatProtectionEnabled = $True - DeviceThreatProtectionRequiredSecurityLevel = 'Medium' - ConfigurationManagerComplianceRequired = $False - TPMRequired = $False - DeviceCompliancePolicyScript = $null - ValidOperatingSystemBuildRanges = @() - RoleScopeTagIds = '0' - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyiOs.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyiOs.Tests.ps1 index 663821e551..9f0f55cf20 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyiOs.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceCompliancePolicyiOs.Tests.ps1 @@ -39,8 +39,33 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { } - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { + return @{ + DisplayName = 'Test iOS Device Compliance Policy' + Description = 'Test iOS Device Compliance Policy Description' + Id = '9c4e2ed7-706e-4874-a826-0c2778352d45' + AdditionalProperties = @{ + 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 + RoleScopeTagIds = '0' + '@odata.type' = '#microsoft.graph.iosCompliancePolicy' + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { return @() } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -108,7 +133,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PasscodeMinimumCharacterSetCount = 2 PasscodeRequiredType = 'numeric' PasscodeRequired = $True - OsMinimumVersion = 10 + OsMinimumVersion = 11 # Updated property OsMaximumVersion = 12 SecurityBlockJailbrokenDevices = $True DeviceThreatProtectionEnabled = $True @@ -117,32 +142,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test iOS Device Compliance Policy' - Description = 'Different Value' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d45' - AdditionalProperties = @{ - 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 - RoleScopeTagIds = '0' - '@odata.type' = '#microsoft.graph.iosCompliancePolicy' - } - } - } } It 'Should return Present from the Get method' { @@ -181,32 +180,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test iOS Device Compliance Policy' - Description = 'Test iOS Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d45' - AdditionalProperties = @{ - 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 - RoleScopeTagIds = '0' - '@odata.type' = '#microsoft.graph.iosCompliancePolicy' - } - } - } } It 'Should return true from the Test method' { @@ -236,32 +209,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test iOS Device Compliance Policy' - Description = 'Test iOS Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d45' - AdditionalProperties = @{ - 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 - RoleScopeTagIds = '0' - '@odata.type' = '#microsoft.graph.iosCompliancePolicy' - } - } - } } It 'Should return Present from the Get method' { @@ -285,32 +232,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicy -MockWith { - return @{ - DisplayName = 'Test iOS Device Compliance Policy' - Description = 'Test iOS Device Compliance Policy Description' - Id = '9c4e2ed7-706e-4874-a826-0c2778352d45' - AdditionalProperties = @{ - 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 - RoleScopeTagIds = '0' - '@odata.type' = '#microsoft.graph.iosCompliancePolicy' - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10.Tests.ps1 index 2e08ff437b..70662e7498 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10.Tests.ps1 @@ -49,6 +49,59 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.GroupPolicyConfiguration' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + PolicyConfigurationIngestionType = 'unknown' + } + } + + Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValue -MockWith { + return @( + @{ + ConfigurationType = 'policy' + Enabled = $true + Id = 'fakeDefinitionValueId' + PolicyConfigurationIngestionType = 'unknown' + } + ) + } + + Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValueDefinition -MockWith { + return @{ + Id = '37ab8b81-47d7-46d8-8b99-81d9cecdcce9' + DisplayName = 'Configure allowed app/extension types' + CategoryPath = '\Google\Google Chrome\Extensions' + PolicyType = 'admxIngested' + SupportedOn = 'Microsoft Windows 7 or later' + ClassType = 'machine' + } + } + + Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValuePresentationValue -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.groupPolicyPresentationValueList' + values = @( + @{ + name = "`"hosted_app`"" + } + ) + } + Id = 'fakePresentationId' + Presentation = @{ + Id = 'fakePresentationDefinitionId' + Label = 'fakePresentationLabel' + } + PolicyConfigurationIngestionType = 'unknown' + } + } + Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationAssignment -MockWith { return @(@{ target = @{ @@ -62,7 +115,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Update-DeviceConfigurationGroupPolicyDefinitionValue -MockWith { } - $Script:exportedInstances = $null $Script:exportedInstance = $null $Script:ExportMode = $false } @@ -180,59 +232,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } -ClientOnly) ) } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.GroupPolicyConfiguration' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - PolicyConfigurationIngestionType = 'unknown' - } - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValue -MockWith { - return @( - @{ - ConfigurationType = 'fakeConfigurationType' - Enabled = $true - Id = 'fakeDefinitionValueId' - PolicyConfigurationIngestionType = 'unknown' - } - ) - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValueDefinition -MockWith { - return @{ - Id = '37ab8b81-47d7-46d8-8b99-81d9cecdcce9' - DisplayName = 'Configure allowed app/extension types' - CategoryPath = '\Google\Google Chrome\Extensions' - PolicyType = 'admxIngested' - SupportedOn = 'Microsoft Windows 7 or later' - ClassType = 'machine' - } - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValuePresentationValue -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.groupPolicyPresentationValueList' - values = @( - @{ - name = "`"hosted_app`"" - } - ) - } - Id = 'fakePresentationId' - Presentation = @{ - Id = 'fakePresentationDefinitionId' - Label = 'fakePresentationLabel' - } - PolicyConfigurationIngestionType = 'unknown' - } - } } It 'Should return Values from the Get method' { @@ -248,6 +247,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Should -Invoke -CommandName Remove-MgBetaDeviceManagementGroupPolicyConfiguration -Exactly 1 } } + Context -Name 'The IntuneDeviceConfigurationAdministrativeTemplatePolicyWindows10 Exists and Values are already in the desired state' -Fixture { BeforeAll { $testParams = @{ @@ -292,57 +292,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } -ClientOnly) ) } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.GroupPolicyConfiguration' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - PolicyConfigurationIngestionType = 'unknown' - } - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValue -MockWith { - return @( - @{ - Enabled = $true - Id = 'fakeDefinitionValueId' - ConfigurationType = 'policy' - } - ) - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValueDefinition -MockWith { - return @{ - Id = '37ab8b81-47d7-46d8-8b99-81d9cecdcce9' - DisplayName = 'Configure allowed app/extension types' - CategoryPath = '\Google\Google Chrome\Extensions' - PolicyType = 'admxIngested' - SupportedOn = 'Microsoft Windows 7 or later' - ClassType = 'machine' - } - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValuePresentationValue -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.groupPolicyPresentationValueList' - values = @( - @{ - name = "`"hosted_app`"" - } - ) - } - Id = 'fakePresentationId' - Presentation = @{ - Id = 'fakePresentationDefinitionId' - Label = 'fakePresentationDefinitionLabel' - } - } - } } It 'Should return true from the Test method' { @@ -374,7 +323,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { presentationDefinitionLabel = 'fakePresentationDefinitionLabel' KeyValuePairValues = [CimInstance[]]@( (New-CimInstance -ClassName MSFT_IntuneGroupPolicyDefinitionValuePresentationValueKeyValuePair -Property @{ - Name = 'hosted_app' + Name = 'hosted_app_new' # Updated property } -ClientOnly) ) Id = 'fakePresentationId' @@ -394,57 +343,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } -ClientOnly) ) } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.GroupPolicyConfiguration' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - PolicyConfigurationIngestionType = 'unknown' - } - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValue -MockWith { - return @( - @{ - Enabled = $true - Id = 'fakeDefinitionValueId' - ConfigurationType = 'policy' - } - ) - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValueDefinition -MockWith { - return @{ - Id = '37ab8b81-47d7-46d8-8b99-81d9cecdcce9' - DisplayName = 'Configure allowed app/extension types' - CategoryPath = '\Google\Google Chrome\Extensions' - PolicyType = 'admxIngested' - SupportedOn = 'Microsoft Windows 7 or later' - ClassType = 'machine' - } - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValuePresentationValue -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.groupPolicyPresentationValueList' - values = @( - @{ - name = "`"user_script`"" - } - ) - } - Id = 'fakePresentationId' - Presentation = @{ - Id = 'fakePresentationDefinitionId' - Label = 'fakePresentationDefinitionLabel' - } - } - } } It 'Should return Values from the Get method' { @@ -470,59 +368,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfiguration -MockWith { - return @(@{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.GroupPolicyConfiguration' - } - Description = 'FakeStringValue' - DisplayName = 'AdministrativeTemplatePolicyWindows10' - Id = 'FakeStringValue' - PolicyConfigurationIngestionType = 'unknown' - }) - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValue -MockWith { - return @( - @{ - ConfigurationType = 'fakeConfigurationType' - Enabled = $true - Id = 'fakeDefinitionValueId' - PolicyConfigurationIngestionType = 'unknown' - } - ) - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValueDefinition -MockWith { - return @{ - Id = '37ab8b81-47d7-46d8-8b99-81d9cecdcce9' - DisplayName = 'Configure allowed app/extension types' - CategoryPath = '\Google\Google Chrome\Extensions' - PolicyType = 'admxIngested' - SupportedOn = 'Microsoft Windows 7 or later' - ClassType = 'machine' - } - } - - Mock -CommandName Get-MgBetaDeviceManagementGroupPolicyConfigurationDefinitionValuePresentationValue -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.groupPolicyPresentationValueList' - values = @( - @{ - name = "`"hosted_app`"" - } - ) - } - Id = 'fakePresentationId' - Presentation = @{ - Id = 'fakePresentationDefinitionId' - Label = 'fakePresentationLabel' - } - PolicyConfigurationIngestionType = 'unknown' - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationCustomPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationCustomPolicyWindows10.Tests.ps1 index 1883a19178..2ee0f5969c 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationCustomPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationCustomPolicyWindows10.Tests.ps1 @@ -42,6 +42,29 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = "#microsoft.graph.windows10CustomConfiguration" + omaSettings = @( + @{ + fileName = "FakeStringValue" + description = "FakeStringValue" + omaUri = "FakeStringValue" + '@odata.type' = "#microsoft.graph.omaSettingBase64" + secretReferenceValueId = "FakeStringValue" + value = "FakeStringValue" + isEncrypted = $True + displayName = "FakeStringValue" + } + ) + } + description = "FakeStringValue" + displayName = "FakeStringValue" + id = "FakeStringValue" + } + } + Mock -CommandName New-M365DSCConnection -MockWith { return "Credentials" } @@ -72,7 +95,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { displayName = "FakeStringValue" } -ClientOnly) ) - supportsScopeTags = $True Ensure = "Present" Credential = $Credential; } @@ -111,35 +133,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { displayName = "FakeStringValue" } -ClientOnly) ) - supportsScopeTags = $True Ensure = "Absent" Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.windows10CustomConfiguration" - omaSettings = @( - @{ - fileName = "FakeStringValue" - description = "FakeStringValue" - omaUri = "FakeStringValue" - '@odata.type' = "#microsoft.graph.omaSettingBase64" - secretReferenceValueId = "FakeStringValue" - value = "FakeStringValue" - isEncrypted = $True - displayName = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - supportsScopeTags = $True - - } - } } It "Should return Values from the Get method" { @@ -173,35 +169,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { displayName = "FakeStringValue" } -ClientOnly) ) - supportsScopeTags = $True Ensure = "Present" Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.windows10CustomConfiguration" - omaSettings = @( - @{ - fileName = "FakeStringValue" - description = "FakeStringValue" - omaUri = "FakeStringValue" - '@odata.type' = "#microsoft.graph.omaSettingBase64" - secretReferenceValueId = "FakeStringValue" - value = "FakeStringValue" - isEncrypted = $True - displayName = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - supportsScopeTags = $True - - } - } } @@ -223,37 +193,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { omaUri = "FakeStringValue" odataType = "#microsoft.graph.omaSettingBase64" secretReferenceValueId = "FakeStringValue" - value = "FakeStringValue" + value = "FakeStringValue2" # Updated property isEncrypted = $True displayName = "FakeStringValue" } -ClientOnly) ) - supportsScopeTags = $True Ensure = "Present" Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.windows10CustomConfiguration" - omaSettings = @( - @{ - '@odata.type' = "#microsoft.graph.omaSettingBase64" - description = "FakeStringValue" - fileName = "FakeStringValue" - omaUri = "FakeStringValue" - secretReferenceValueId = "FakeStringValue" - value = "FakeStringValue" - displayName = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - } - } } It "Should return Values from the Get method" { @@ -277,32 +224,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.windows10CustomConfiguration" - omaSettings = @( - @{ - fileName = "FakeStringValue" - description = "FakeStringValue" - omaUri = "FakeStringValue" - '@odata.type' = "#microsoft.graph.omaSettingBase64" - secretReferenceValueId = "FakeStringValue" - value = "FakeStringValue" - isEncrypted = $True - displayName = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - supportsScopeTags = $True - - } - } } + It "Should Reverse Engineer resource from the Export method" { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationCustomPolicyiOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationCustomPolicyiOS.Tests.ps1 index 2a204e8702..4fdc937be1 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationCustomPolicyiOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationCustomPolicyiOS.Tests.ps1 @@ -39,6 +39,20 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + DisplayName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' + Description = 'Test IntuneDeviceConfigurationCustomPolicyiOS Description' + Id = 'e30954ac-a65e-4dcb-ab79-91d45f3c52b4' + AdditionalProperties = @{ + Payload = 'PHJvb3Q+PC9yb290Pg==' + PayloadFileName = 'simple.xml' + PayloadName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' + '@odata.type' = '#microsoft.graph.iosCustomConfiguration' + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { return @() @@ -48,7 +62,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } - $Script:exportedInstances =$null + $Script:exportedInstance = $null $Script:ExportMode = $false } @@ -88,27 +102,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { BeforeAll { $testParams = @{ DisplayName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' - Description = 'Test IntuneDeviceConfigurationCustomPolicyiOS Description' + Description = 'Updated description' # Updated property Payload = 'PHJvb3Q+PC9yb290Pg==' PayloadFileName = 'simple.xml' PayloadName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' - Description = 'Different Value' - Id = 'e30954ac-a65e-4dcb-ab79-91d45f3c52b4' - AdditionalProperties = @{ - Payload = 'PHJvb3Q+PC9yb290Pg==' - PayloadFileName = 'simple.xml' - PayloadName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' - '@odata.type' = '#microsoft.graph.iosCustomConfiguration' - } - } - } } It 'Should return Present from the Get method' { @@ -137,20 +137,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' - Description = 'Test IntuneDeviceConfigurationCustomPolicyiOS Description' - Id = 'e30954ac-a65e-4dcb-ab79-91d45f3c52b4' - AdditionalProperties = @{ - Payload = 'PHJvb3Q+PC9yb290Pg==' - PayloadFileName = 'simple.xml' - PayloadName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' - '@odata.type' = '#microsoft.graph.iosCustomConfiguration' - } - } - } } It 'Should return true from the Test method' { @@ -169,20 +155,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' - Description = 'Test IntuneDeviceConfigurationCustomPolicyiOS Description' - Id = 'e30954ac-a65e-4dcb-ab79-91d45f3c52b4' - AdditionalProperties = @{ - Payload = 'PHJvb3Q+PC9yb290Pg==' - PayloadFileName = 'simple.xml' - PayloadName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' - '@odata.type' = '#microsoft.graph.iosCustomConfiguration' - } - } - } } It 'Should return Present from the Get method' { @@ -206,20 +178,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' - Description = 'Test IntuneDeviceConfigurationCustomPolicyiOS Description' - Id = 'e30954ac-a65e-4dcb-ab79-91d45f3c52b4' - AdditionalProperties = @{ - Payload = 'PHJvb3Q+PC9yb290Pg==' - PayloadFileName = 'simple.xml' - PayloadName = 'Test IntuneDeviceConfigurationCustomPolicyiOS' - '@odata.type' = '#microsoft.graph.iosCustomConfiguration' - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDefenderForEndpointOnboardingPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDefenderForEndpointOnboardingPolicyWindows10.Tests.ps1 index c5515a2234..4cb2fa3a7e 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDefenderForEndpointOnboardingPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDefenderForEndpointOnboardingPolicyWindows10.Tests.ps1 @@ -36,6 +36,25 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = "#microsoft.graph.windowsDefenderAdvancedThreatProtectionConfiguration" + advancedThreatProtectionOffboardingBlob = "FakeStringValue" + allowSampleSharing = $True + advancedThreatProtectionOffboardingFilename = "FakeStringValue" + enableExpeditedTelemetryReporting = $True + advancedThreatProtectionAutoPopulateOnboardingBlob = $True + advancedThreatProtectionOnboardingBlob = "FakeStringValue" + advancedThreatProtectionOnboardingFilename = "FakeStringValue" + } + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + Id = "FakeStringValue" + + } + } + Mock -CommandName New-M365DSCConnection -MockWith { return "Credentials" } @@ -101,25 +120,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.windowsDefenderAdvancedThreatProtectionConfiguration" - advancedThreatProtectionOffboardingBlob = "FakeStringValue" - allowSampleSharing = $True - advancedThreatProtectionOffboardingFilename = "FakeStringValue" - enableExpeditedTelemetryReporting = $True - advancedThreatProtectionAutoPopulateOnboardingBlob = $True - advancedThreatProtectionOnboardingBlob = "FakeStringValue" - advancedThreatProtectionOnboardingFilename = "FakeStringValue" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } It 'Should return Values from the Get method' { @@ -151,25 +151,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.windowsDefenderAdvancedThreatProtectionConfiguration" - advancedThreatProtectionOffboardingBlob = "FakeStringValue" - allowSampleSharing = $True - advancedThreatProtectionOffboardingFilename = "FakeStringValue" - enableExpeditedTelemetryReporting = $True - advancedThreatProtectionAutoPopulateOnboardingBlob = $True - advancedThreatProtectionOnboardingBlob = "FakeStringValue" - advancedThreatProtectionOnboardingFilename = "FakeStringValue" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } @@ -186,7 +167,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { AdvancedThreatProtectionOffboardingFilename = "FakeStringValue" AdvancedThreatProtectionOnboardingBlob = "FakeStringValue" AdvancedThreatProtectionOnboardingFilename = "FakeStringValue" - AllowSampleSharing = $True + AllowSampleSharing = $False # Updated property Description = "FakeStringValue" DisplayName = "FakeStringValue" EnableExpeditedTelemetryReporting = $True @@ -194,21 +175,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - advancedThreatProtectionOffboardingBlob = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsDefenderAdvancedThreatProtectionConfiguration" - advancedThreatProtectionOffboardingFilename = "FakeStringValue" - advancedThreatProtectionOnboardingBlob = "FakeStringValue" - advancedThreatProtectionOnboardingFilename = "FakeStringValue" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -232,26 +198,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.windowsDefenderAdvancedThreatProtectionConfiguration" - advancedThreatProtectionOffboardingBlob = "FakeStringValue" - allowSampleSharing = $True - advancedThreatProtectionOffboardingFilename = "FakeStringValue" - enableExpeditedTelemetryReporting = $True - advancedThreatProtectionAutoPopulateOnboardingBlob = $True - advancedThreatProtectionOnboardingBlob = "FakeStringValue" - advancedThreatProtectionOnboardingFilename = "FakeStringValue" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.Tests.ps1 index 5ecdb7d8d2..6fb3e1768a 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDeliveryOptimizationPolicyWindows10.Tests.ps1 @@ -42,6 +42,55 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + cacheServerForegroundDownloadFallbackToHttpDelayInSeconds = 25 + maximumCacheAgeInDays = 25 + cacheServerHostNames = @('FakeStringValue') + groupIdSource = @{ + groupIdCustom = 'FakeStringValue' + groupIdSourceOption = 'notConfigured' + '@odata.type' = '#microsoft.graph.deliveryOptimizationGroupIdCustom' + } + vpnPeerCaching = 'notConfigured' + minimumFileSizeToCacheInMegabytes = 25 + maximumCacheSize = @{ + '@odata.type' = '#microsoft.graph.deliveryOptimizationMaxCacheSizeAbsolute' + maximumCacheSizePercentage = 25 + } + '@odata.type' = '#microsoft.graph.windowsDeliveryOptimizationConfiguration' + minimumBatteryPercentageAllowedToUpload = 25 + minimumRamAllowedToPeerInGigabytes = 25 + cacheServerBackgroundDownloadFallbackToHttpDelayInSeconds = 25 + deliveryOptimizationMode = 'userDefined' + modifyCacheLocation = 'FakeStringValue' + bandwidthMode = @{ + maximumBackgroundBandwidthPercentage = 25 + bandwidthForegroundPercentageHours = @{ + bandwidthBeginBusinessHours = 25 + bandwidthPercentageOutsideBusinessHours = 25 + bandwidthPercentageDuringBusinessHours = 25 + bandwidthEndBusinessHours = 25 + } + bandwidthBackgroundPercentageHours = @{ + bandwidthBeginBusinessHours = 25 + bandwidthPercentageOutsideBusinessHours = 25 + bandwidthPercentageDuringBusinessHours = 25 + bandwidthEndBusinessHours = 25 + } + maximumForegroundBandwidthPercentage = 25 + '@odata.type' = '#microsoft.graph.deliveryOptimizationBandwidthAbsolute' + } + minimumDiskSizeAllowedToPeerInGigabytes = 25 + restrictPeerSelectionBy = 'notConfigured' + } + description = 'FakeStringValue' + displayName = 'FakeStringValue' + id = 'FakeStringValue' + } + } + Mock -CommandName New-M365DSCConnection -MockWith { return 'Credentials' } @@ -101,7 +150,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { minimumRamAllowedToPeerInGigabytes = 25 modifyCacheLocation = 'FakeStringValue' restrictPeerSelectionBy = 'notConfigured' - supportsScopeTags = $True vpnPeerCaching = 'notConfigured' Ensure = 'Present' Credential = $Credential @@ -166,62 +214,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { minimumRamAllowedToPeerInGigabytes = 25 modifyCacheLocation = 'FakeStringValue' restrictPeerSelectionBy = 'notConfigured' - supportsScopeTags = $True vpnPeerCaching = 'notConfigured' Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - cacheServerForegroundDownloadFallbackToHttpDelayInSeconds = 25 - maximumCacheAgeInDays = 25 - cacheServerHostNames = @('FakeStringValue') - groupIdSource = @{ - groupIdCustom = 'FakeStringValue' - groupIdSourceOption = 'notConfigured' - '@odata.type' = '#microsoft.graph.deliveryOptimizationGroupIdCustom' - } - vpnPeerCaching = 'notConfigured' - minimumFileSizeToCacheInMegabytes = 25 - maximumCacheSize = @{ - '@odata.type' = '#microsoft.graph.deliveryOptimizationMaxCacheSizeAbsolute' - maximumCacheSizePercentage = 25 - } - '@odata.type' = '#microsoft.graph.windowsDeliveryOptimizationConfiguration' - minimumBatteryPercentageAllowedToUpload = 25 - minimumRamAllowedToPeerInGigabytes = 25 - cacheServerBackgroundDownloadFallbackToHttpDelayInSeconds = 25 - deliveryOptimizationMode = 'userDefined' - modifyCacheLocation = 'FakeStringValue' - bandwidthMode = @{ - maximumBackgroundBandwidthPercentage = 25 - bandwidthForegroundPercentageHours = @{ - bandwidthBeginBusinessHours = 25 - bandwidthPercentageOutsideBusinessHours = 25 - bandwidthPercentageDuringBusinessHours = 25 - bandwidthEndBusinessHours = 25 - } - bandwidthBackgroundPercentageHours = @{ - bandwidthBeginBusinessHours = 25 - bandwidthPercentageOutsideBusinessHours = 25 - bandwidthPercentageDuringBusinessHours = 25 - bandwidthEndBusinessHours = 25 - } - maximumForegroundBandwidthPercentage = 25 - '@odata.type' = '#microsoft.graph.deliveryOptimizationBandwidthAbsolute' - } - minimumDiskSizeAllowedToPeerInGigabytes = 25 - restrictPeerSelectionBy = 'notConfigured' - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - supportsScopeTags = $True - - } - } } It 'Should return Values from the Get method' { @@ -280,62 +276,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { minimumRamAllowedToPeerInGigabytes = 25 modifyCacheLocation = 'FakeStringValue' restrictPeerSelectionBy = 'notConfigured' - supportsScopeTags = $True vpnPeerCaching = 'notConfigured' Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - cacheServerForegroundDownloadFallbackToHttpDelayInSeconds = 25 - maximumCacheAgeInDays = 25 - cacheServerHostNames = @('FakeStringValue') - groupIdSource = @{ - groupIdCustom = 'FakeStringValue' - groupIdSourceOption = 'notConfigured' - '@odata.type' = '#microsoft.graph.deliveryOptimizationGroupIdCustom' - } - vpnPeerCaching = 'notConfigured' - minimumFileSizeToCacheInMegabytes = 25 - maximumCacheSize = @{ - '@odata.type' = '#microsoft.graph.deliveryOptimizationMaxCacheSizeAbsolute' - maximumCacheSizePercentage = 25 - } - '@odata.type' = '#microsoft.graph.windowsDeliveryOptimizationConfiguration' - minimumBatteryPercentageAllowedToUpload = 25 - minimumRamAllowedToPeerInGigabytes = 25 - cacheServerBackgroundDownloadFallbackToHttpDelayInSeconds = 25 - deliveryOptimizationMode = 'userDefined' - modifyCacheLocation = 'FakeStringValue' - bandwidthMode = @{ - maximumBackgroundBandwidthPercentage = 25 - bandwidthForegroundPercentageHours = @{ - bandwidthBeginBusinessHours = 25 - bandwidthPercentageOutsideBusinessHours = 25 - bandwidthPercentageDuringBusinessHours = 25 - bandwidthEndBusinessHours = 25 - } - bandwidthBackgroundPercentageHours = @{ - bandwidthBeginBusinessHours = 25 - bandwidthPercentageOutsideBusinessHours = 25 - bandwidthPercentageDuringBusinessHours = 25 - bandwidthEndBusinessHours = 25 - } - maximumForegroundBandwidthPercentage = 25 - '@odata.type' = '#microsoft.graph.deliveryOptimizationBandwidthAbsolute' - } - minimumDiskSizeAllowedToPeerInGigabytes = 25 - restrictPeerSelectionBy = 'notConfigured' - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - supportsScopeTags = $True - - } - } } @@ -381,66 +325,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { odataType = '#microsoft.graph.deliveryOptimizationMaxCacheSizeAbsolute' maximumCacheSizePercentage = 25 } -ClientOnly) - minimumBatteryPercentageAllowedToUpload = 25 + minimumBatteryPercentageAllowedToUpload = 7 # Updated property minimumDiskSizeAllowedToPeerInGigabytes = 25 minimumFileSizeToCacheInMegabytes = 25 minimumRamAllowedToPeerInGigabytes = 25 modifyCacheLocation = 'FakeStringValue' restrictPeerSelectionBy = 'notConfigured' - supportsScopeTags = $True vpnPeerCaching = 'notConfigured' Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - cacheServerForegroundDownloadFallbackToHttpDelayInSeconds = 7 - maximumCacheAgeInDays = 7 - cacheServerHostNames = @('FakeStringValue') - groupIdSource = @{ - groupIdCustom = 'FakeStringValue' - groupIdSourceOption = 'notConfigured' - '@odata.type' = '#microsoft.graph.deliveryOptimizationGroupIdCustom' - } - vpnPeerCaching = 'notConfigured' - minimumFileSizeToCacheInMegabytes = 7 - maximumCacheSize = @{ - '@odata.type' = '#microsoft.graph.deliveryOptimizationMaxCacheSizeAbsolute' - maximumCacheSizePercentage = 7 - } - '@odata.type' = '#microsoft.graph.windowsDeliveryOptimizationConfiguration' - minimumBatteryPercentageAllowedToUpload = 7 - minimumRamAllowedToPeerInGigabytes = 7 - cacheServerBackgroundDownloadFallbackToHttpDelayInSeconds = 7 - deliveryOptimizationMode = 'userDefined' - modifyCacheLocation = 'FakeStringValue' - bandwidthMode = @{ - maximumBackgroundBandwidthPercentage = 7 - bandwidthForegroundPercentageHours = @{ - bandwidthBeginBusinessHours = 7 - bandwidthPercentageOutsideBusinessHours = 7 - bandwidthPercentageDuringBusinessHours = 7 - bandwidthEndBusinessHours = 7 - } - bandwidthBackgroundPercentageHours = @{ - bandwidthBeginBusinessHours = 7 - bandwidthPercentageOutsideBusinessHours = 7 - bandwidthPercentageDuringBusinessHours = 7 - bandwidthEndBusinessHours = 7 - } - maximumForegroundBandwidthPercentage = 7 - '@odata.type' = '#microsoft.graph.deliveryOptimizationBandwidthAbsolute' - } - minimumDiskSizeAllowedToPeerInGigabytes = 7 - restrictPeerSelectionBy = 'notConfigured' - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -464,58 +358,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - cacheServerForegroundDownloadFallbackToHttpDelayInSeconds = 25 - maximumCacheAgeInDays = 25 - cacheServerHostNames = @('FakeStringValue') - groupIdSource = @{ - groupIdCustom = 'FakeStringValue' - groupIdSourceOption = 'notConfigured' - '@odata.type' = '#microsoft.graph.deliveryOptimizationGroupIdCustom' - } - vpnPeerCaching = 'notConfigured' - minimumFileSizeToCacheInMegabytes = 25 - maximumCacheSize = @{ - '@odata.type' = '#microsoft.graph.deliveryOptimizationMaxCacheSizeAbsolute' - maximumCacheSizePercentage = 25 - } - '@odata.type' = '#microsoft.graph.windowsDeliveryOptimizationConfiguration' - minimumBatteryPercentageAllowedToUpload = 25 - minimumRamAllowedToPeerInGigabytes = 25 - cacheServerBackgroundDownloadFallbackToHttpDelayInSeconds = 25 - deliveryOptimizationMode = 'userDefined' - modifyCacheLocation = 'FakeStringValue' - bandwidthMode = @{ - maximumBackgroundBandwidthPercentage = 25 - bandwidthForegroundPercentageHours = @{ - bandwidthBeginBusinessHours = 25 - bandwidthPercentageOutsideBusinessHours = 25 - bandwidthPercentageDuringBusinessHours = 25 - bandwidthEndBusinessHours = 25 - } - bandwidthBackgroundPercentageHours = @{ - bandwidthBeginBusinessHours = 25 - bandwidthPercentageOutsideBusinessHours = 25 - bandwidthPercentageDuringBusinessHours = 25 - bandwidthEndBusinessHours = 25 - } - maximumForegroundBandwidthPercentage = 25 - '@odata.type' = '#microsoft.graph.deliveryOptimizationBandwidthAbsolute' - } - minimumDiskSizeAllowedToPeerInGigabytes = 25 - restrictPeerSelectionBy = 'notConfigured' - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - supportsScopeTags = $True - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDomainJoinPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDomainJoinPolicyWindows10.Tests.ps1 index e1e24c6a7b..b42b6dbef9 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDomainJoinPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationDomainJoinPolicyWindows10.Tests.ps1 @@ -42,6 +42,21 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + computerNameStaticPrefix = "FakeStringValue" + computerNameSuffixRandomCharCount = 25 + activeDirectoryDomainName = "FakeStringValue" + '@odata.type' = "#microsoft.graph.windowsDomainJoinConfiguration" + organizationalUnit = "FakeStringValue" + } + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + Id = "FakeStringValue" + } + } + Mock -CommandName New-M365DSCConnection -MockWith { return "Credentials" } @@ -68,7 +83,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = "FakeStringValue" Id = "FakeStringValue" OrganizationalUnit = "FakeStringValue" - SupportsScopeTags = $True Ensure = "Present" Credential = $Credential; } @@ -99,27 +113,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = "FakeStringValue" Id = "FakeStringValue" OrganizationalUnit = "FakeStringValue" - SupportsScopeTags = $True Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - computerNameStaticPrefix = "FakeStringValue" - computerNameSuffixRandomCharCount = 25 - activeDirectoryDomainName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsDomainJoinConfiguration" - organizationalUnit = "FakeStringValue" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - SupportsScopeTags = $True - - } - } } It 'Should return Values from the Get method' { @@ -145,30 +141,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = "FakeStringValue" Id = "FakeStringValue" OrganizationalUnit = "FakeStringValue" - SupportsScopeTags = $True Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - computerNameStaticPrefix = "FakeStringValue" - computerNameSuffixRandomCharCount = 25 - activeDirectoryDomainName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsDomainJoinConfiguration" - organizationalUnit = "FakeStringValue" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - SupportsScopeTags = $True - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -179,30 +156,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ ActiveDirectoryDomainName = "FakeStringValue" ComputerNameStaticPrefix = "FakeStringValue" - ComputerNameSuffixRandomCharCount = 25 + ComputerNameSuffixRandomCharCount = 7 # Updated property Description = "FakeStringValue" DisplayName = "FakeStringValue" Id = "FakeStringValue" OrganizationalUnit = "FakeStringValue" - SupportsScopeTags = $True Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - computerNameStaticPrefix = "FakeStringValue" - computerNameSuffixRandomCharCount = 7 - activeDirectoryDomainName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsDomainJoinConfiguration" - organizationalUnit = "FakeStringValue" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -226,24 +187,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - computerNameStaticPrefix = "FakeStringValue" - computerNameSuffixRandomCharCount = 25 - activeDirectoryDomainName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsDomainJoinConfiguration" - organizationalUnit = "FakeStringValue" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - SupportsScopeTags = $True - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationEmailProfilePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationEmailProfilePolicyWindows10.Tests.ps1 index 5d699ec0fe..2f2247118b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationEmailProfilePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationEmailProfilePolicyWindows10.Tests.ps1 @@ -41,6 +41,30 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + requireSsl = $True + '@odata.type' = "#microsoft.graph.windows10EasEmailProfileConfiguration" + accountName = "FakeStringValue" + hostName = "FakeStringValue" + syncContacts = $True + syncTasks = $True + emailSyncSchedule = "userDefined" + emailAddressSource = "userPrincipalName" + durationOfEmailToSync = "userDefined" + syncCalendar = $True + customDomainName = "FakeStringValue" + userDomainNameSource = "fullDomainName" + usernameAADSource = "userPrincipalName" + usernameSource = "userPrincipalName" + } + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + Id = "FakeStringValue" + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -113,30 +137,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - requireSsl = $True - '@odata.type' = "#microsoft.graph.windows10EasEmailProfileConfiguration" - accountName = "FakeStringValue" - hostName = "FakeStringValue" - syncContacts = $True - syncTasks = $True - emailSyncSchedule = "userDefined" - emailAddressSource = "userPrincipalName" - durationOfEmailToSync = "userDefined" - syncCalendar = $True - customDomainName = "FakeStringValue" - userDomainNameSource = "fullDomainName" - usernameAADSource = "userPrincipalName" - usernameSource = "userPrincipalName" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -174,30 +174,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - requireSsl = $True - '@odata.type' = "#microsoft.graph.windows10EasEmailProfileConfiguration" - accountName = "FakeStringValue" - hostName = "FakeStringValue" - syncContacts = $True - syncTasks = $True - emailSyncSchedule = "userDefined" - emailAddressSource = "userPrincipalName" - durationOfEmailToSync = "userDefined" - syncCalendar = $True - customDomainName = "FakeStringValue" - userDomainNameSource = "fullDomainName" - usernameAADSource = "userPrincipalName" - usernameSource = "userPrincipalName" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } @@ -218,7 +194,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { EmailSyncSchedule = "userDefined" HostName = "FakeStringValue" Id = "FakeStringValue" - RequireSsl = $True + RequireSsl = $False # Updated property SyncCalendar = $True SyncContacts = $True SyncTasks = $True @@ -228,26 +204,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.windows10EasEmailProfileConfiguration" - accountName = "FakeStringValue" - hostName = "FakeStringValue" - emailSyncSchedule = "userDefined" - emailAddressSource = "userPrincipalName" - durationOfEmailToSync = "userDefined" - customDomainName = "FakeStringValue" - userDomainNameSource = "fullDomainName" - usernameAADSource = "userPrincipalName" - usernameSource = "userPrincipalName" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -271,31 +227,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - requireSsl = $True - '@odata.type' = "#microsoft.graph.windows10EasEmailProfileConfiguration" - accountName = "FakeStringValue" - hostName = "FakeStringValue" - syncContacts = $True - syncTasks = $True - emailSyncSchedule = "userDefined" - emailAddressSource = "userPrincipalName" - durationOfEmailToSync = "userDefined" - syncCalendar = $True - customDomainName = "FakeStringValue" - userDomainNameSource = "fullDomainName" - usernameAADSource = "userPrincipalName" - usernameSource = "userPrincipalName" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.Tests.ps1 index 13aad01594..775defafdd 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationEndpointProtectionPolicyWindows10.Tests.ps1 @@ -46,6 +46,637 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + localSecurityOptionsClearVirtualMemoryPageFile = $True + defenderSecurityCenterDisableHardwareUI = $True + applicationGuardAllowPrintToNetworkPrinters = $True + defenderFilesAndFoldersToExclude = @("FakeStringValue") + defenderAllowScanArchiveFiles = $True + firewallIPSecExemptionsNone = $True + bitLockerAllowStandardUserEncryption = $True + localSecurityOptionsAllowRemoteCallsToSecurityAccountsManager = "FakeStringValue" + defenderScheduledScanDay = "userDefined" + firewallPacketQueueingMethod = "deviceDefault" + defenderUntrustedUSBProcessType = "userDefined" + defenderNetworkProtectionType = "userDefined" + defenderProcessCreation = "userDefined" + applicationGuardEnabledOptions = "notConfigured" + defenderOfficeAppsLaunchChildProcess = "userDefined" + defenderAllowRealTimeMonitoring = $True + firewallIPSecExemptionsAllowNeighborDiscovery = $True + defenderUntrustedExecutable = "userDefined" + defenderGuardMyFoldersType = "userDefined" + localSecurityOptionsInformationDisplayedOnLockScreen = "notConfigured" + defenderScheduledQuickScanTime = "00:00:00" + localSecurityOptionsUseAdminApprovalMode = $True + applicationGuardAllowCameraMicrophoneRedirection = $True + applicationGuardAllowPrintToXPS = $True + deviceGuardLaunchSystemGuard = "notConfigured" + defenderScanDirection = "monitorAllFiles" + userRightsIncreaseSchedulingPriority = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + deviceGuardEnableVirtualizationBasedSecurity = $True + defenderBlockEndUserAccess = $True + firewallIPSecExemptionsAllowRouterDiscovery = $True + xboxServicesLiveGameSaveServiceStartupMode = "manual" + bitLockerFixedDrivePolicy = @{ + RecoveryOptions = @{ + RecoveryInformationToStore = "passwordAndKey" + HideRecoveryOptions = $True + BlockDataRecoveryAgent = $True + RecoveryKeyUsage = "blocked" + EnableBitLockerAfterRecoveryInformationToStore = $True + EnableRecoveryInformationSaveToStore = $True + RecoveryPasswordUsage = "blocked" + } + RequireEncryptionForWriteAccess = $True + encryptionMethod = "aesCbc128" + } + userRightsCreateSymbolicLinks = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + applicationGuardBlockFileTransfer = "notConfigured" + defenderCheckForSignaturesBeforeRunningScan = $True + userRightsRemoteShutdown = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + firewallRules = @( + @{ + localAddressRanges = @("FakeStringValue") + action = "notConfigured" + description = "FakeStringValue" + interfaceTypes = "notConfigured" + remotePortRanges = @("FakeStringValue") + displayName = "FakeStringValue" + filePath = "FakeStringValue" + localUserAuthorizations = "FakeStringValue" + protocol = 25 + trafficDirection = "notConfigured" + remoteAddressRanges = @("FakeStringValue") + packageFamilyName = "FakeStringValue" + serviceName = "FakeStringValue" + localPortRanges = @("FakeStringValue") + profileTypes = "notConfigured" + edgeTraversal = "notConfigured" + } + ) + defenderSignatureUpdateIntervalInHours = 25 + defenderEnableLowCpuPriority = $True + localSecurityOptionsAllowAnonymousEnumerationOfSAMAccountsAndShares = $True + defenderFileExtensionsToExclude = @("FakeStringValue") + localSecurityOptionsHideLastSignedInUser = $True + userRightsBlockAccessFromNetwork = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedServers = "none" + xboxServicesLiveAuthManagerServiceStartupMode = "manual" + localSecurityOptionsMachineInactivityLimitInMinutes = 25 + localSecurityOptionsClientDigitallySignCommunicationsAlways = $True + defenderSecurityCenterDisableNetworkUI = $True + userRightsModifyObjectLabels = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + deviceGuardLocalSystemAuthorityCredentialGuardSettings = "notConfigured" + firewallIdleTimeoutForSecurityAssociationInSeconds = 25 + defenderSecurityCenterHelpURL = "FakeStringValue" + localSecurityOptionsDisableServerDigitallySignCommunicationsAlways = $True + localSecurityOptionsAllowRemoteCallsToSecurityAccountsManagerHelperBool = $True + userRightsChangeSystemTime = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + localSecurityOptionsAllowUndockWithoutHavingToLogon = $True + defenderEnableScanMappedNetworkDrivesDuringFullScan = $True + defenderUntrustedUSBProcess = "userDefined" + localSecurityOptionsHideUsernameAtSignIn = $True + defenderAllowScanDownloads = $True + localSecurityOptionsDisableAdministratorAccount = $True + defenderSecurityCenterDisableHealthUI = $True + userRightsCreateGlobalObjects = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + localSecurityOptionsRestrictAnonymousAccessToNamedPipesAndShares = $True + localSecurityOptionsMachineInactivityLimit = 25 + firewallCertificateRevocationListCheckMethod = "deviceDefault" + defenderSecurityCenterDisableFamilyUI = $True + defenderAllowCloudProtection = $True + bitLockerEnableStorageCardEncryptionOnMobile = $True + applicationGuardEnabled = $True + defenderOfficeAppsOtherProcessInjection = "userDefined" + userRightsImpersonateClient = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + '@odata.type' = "#microsoft.graph.windows10EndpointProtectionConfiguration" + localSecurityOptionsUseAdminApprovalModeForAdministrators = $True + lanManagerWorkstationDisableInsecureGuestLogons = $True + defenderAdvancedRansomewareProtectionType = "userDefined" + defenderUntrustedExecutableType = "userDefined" + defenderDisableScanArchiveFiles = $True + lanManagerAuthenticationLevel = "lmAndNltm" + userRightsActAsPartOfTheOperatingSystem = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + defenderPreventCredentialStealingType = "userDefined" + localSecurityOptionsAllowUIAccessApplicationsForSecureLocations = $True + deviceGuardEnableSecureBootWithDMA = $True + localSecurityOptionsDisableClientDigitallySignCommunicationsIfServerAgrees = $True + defenderScriptObfuscatedMacroCode = "userDefined" + defenderDaysBeforeDeletingQuarantinedMalware = 25 + defenderAllowScanRemovableDrivesDuringFullScan = $True + localSecurityOptionsDisableServerDigitallySignCommunicationsIfClientAgrees = $True + firewallProfilePrivate = @{ + policyRulesFromGroupPolicyNotMerged = $True + inboundConnectionsRequired = $True + securedPacketExemptionAllowed = $True + securedPacketExemptionBlocked = $True + globalPortRulesFromGroupPolicyMerged = $True + stealthModeBlocked = $True + outboundConnectionsBlocked = $True + inboundConnectionsBlocked = $True + authorizedApplicationRulesFromGroupPolicyMerged = $True + inboundNotificationsRequired = $True + firewallEnabled = "notConfigured" + stealthModeRequired = $True + incomingTrafficBlocked = $True + incomingTrafficRequired = $True + unicastResponsesToMulticastBroadcastsBlocked = $True + policyRulesFromGroupPolicyMerged = $True + unicastResponsesToMulticastBroadcastsRequired = $True + connectionSecurityRulesFromGroupPolicyNotMerged = $True + globalPortRulesFromGroupPolicyNotMerged = $True + outboundConnectionsRequired = $True + inboundNotificationsBlocked = $True + connectionSecurityRulesFromGroupPolicyMerged = $True + authorizedApplicationRulesFromGroupPolicyNotMerged = $True + } + defenderSecurityCenterDisableAppBrowserUI = $True + localSecurityOptionsInformationShownOnLockScreen = "notConfigured" + defenderOfficeAppsLaunchChildProcessType = "userDefined" + deviceGuardSecureBootWithDMA = "notConfigured" + applicationGuardAllowPrintToPDF = $True + userRightsCreateToken = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + defenderExploitProtectionXml = $True + userRightsRemoteDesktopServicesLogOn = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + localSecurityOptionsBlockRemoteLogonWithBlankPassword = $True + userRightsBackupData = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + userRightsDenyLocalLogOn = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + localSecurityOptionsOnlyElevateSignedExecutables = $True + applicationGuardAllowVirtualGPU = $True + defenderScanType = "userDefined" + bitLockerSystemDrivePolicy = @{ + prebootRecoveryEnableMessageAndUrl = $True + StartupAuthenticationTpmPinUsage = "blocked" + encryptionMethod = "aesCbc128" + minimumPinLength = 25 + prebootRecoveryMessage = "FakeStringValue" + StartupAuthenticationTpmPinAndKeyUsage = "blocked" + StartupAuthenticationRequired = $True + RecoveryOptions = @{ + RecoveryInformationToStore = "passwordAndKey" + HideRecoveryOptions = $True + BlockDataRecoveryAgent = $True + RecoveryKeyUsage = "blocked" + EnableBitLockerAfterRecoveryInformationToStore = $True + EnableRecoveryInformationSaveToStore = $True + RecoveryPasswordUsage = "blocked" + } + prebootRecoveryUrl = "FakeStringValue" + StartupAuthenticationTpmUsage = "blocked" + StartupAuthenticationTpmKeyUsage = "blocked" + StartupAuthenticationBlockWithoutTpmChip = $True + } + defenderAllowBehaviorMonitoring = $True + defenderAllowIntrusionPreventionSystem = $True + localSecurityOptionsDoNotStoreLANManagerHashValueOnNextPasswordChange = $True + defenderSecurityCenterHelpEmail = "FakeStringValue" + defenderDisableBehaviorMonitoring = $True + localSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $True + applicationGuardBlockClipboardSharing = "notConfigured" + defenderEmailContentExecution = "userDefined" + localSecurityOptionsBlockRemoteOpticalDriveAccess = $True + firewallProfilePublic = @{ + policyRulesFromGroupPolicyNotMerged = $True + inboundConnectionsRequired = $True + securedPacketExemptionAllowed = $True + securedPacketExemptionBlocked = $True + globalPortRulesFromGroupPolicyMerged = $True + stealthModeBlocked = $True + outboundConnectionsBlocked = $True + inboundConnectionsBlocked = $True + authorizedApplicationRulesFromGroupPolicyMerged = $True + inboundNotificationsRequired = $True + firewallEnabled = "notConfigured" + stealthModeRequired = $True + incomingTrafficBlocked = $True + incomingTrafficRequired = $True + unicastResponsesToMulticastBroadcastsBlocked = $True + policyRulesFromGroupPolicyMerged = $True + unicastResponsesToMulticastBroadcastsRequired = $True + connectionSecurityRulesFromGroupPolicyNotMerged = $True + globalPortRulesFromGroupPolicyNotMerged = $True + outboundConnectionsRequired = $True + inboundNotificationsBlocked = $True + connectionSecurityRulesFromGroupPolicyMerged = $True + authorizedApplicationRulesFromGroupPolicyNotMerged = $True + } + defenderScriptDownloadedPayloadExecutionType = "userDefined" + xboxServicesAccessoryManagementServiceStartupMode = "manual" + xboxServicesEnableXboxGameSaveTask = $True + bitLockerEncryptDevice = $True + localSecurityOptionsBlockMicrosoftAccounts = $True + bitLockerRemovableDrivePolicy = @{ + requireEncryptionForWriteAccess = $True + blockCrossOrganizationWriteAccess = $True + encryptionMethod = "aesCbc128" + } + defenderSecurityCenterBlockExploitProtectionOverride = $True + localSecurityOptionsLogOnMessageText = "FakeStringValue" + applicationGuardCertificateThumbprints = @("FakeStringValue") + defenderCloudBlockLevel = "notConfigured" + defenderProcessCreationType = "userDefined" + defenderDisableScanDownloads = $True + defenderOfficeCommunicationAppsLaunchChildProcess = "userDefined" + localSecurityOptionsClientSendUnencryptedPasswordToThirdPartySMBServers = $True + userRightsAllowAccessFromNetwork = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + applicationGuardForceAuditing = $True + defenderDisableRealTimeMonitoring = $True + defenderSecurityCenterNotificationsFromApp = "notConfigured" + localSecurityOptionsAdministratorAccountName = "FakeStringValue" + windowsDefenderTamperProtection = "notConfigured" + defenderSecurityCenterDisableAccountUI = $True + localSecurityOptionsSwitchToSecureDesktopWhenPromptingForElevation = $True + defenderEmailContentExecutionType = "userDefined" + defenderAllowScanNetworkFiles = $True + defenderSecurityCenterDisableNotificationAreaUI = $True + userRightsProfileSingleProcess = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + localSecurityOptionsSmartCardRemovalBehavior = "noAction" + defenderDisableCloudProtection = $True + userRightsManageVolumes = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + smartScreenEnableInShell = $True + applicationGuardBlockNonEnterpriseContent = $True + defenderAdditionalGuardedFolders = @("FakeStringValue") + localSecurityOptionsDoNotAllowAnonymousEnumerationOfSAMAccounts = $True + userRightsRestoreData = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedClients = "none" + defenderDisableOnAccessProtection = $True + bitLockerRecoveryPasswordRotation = "notConfigured" + firewallPreSharedKeyEncodingMethod = "deviceDefault" + userRightsDelegation = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + userRightsDebugPrograms = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + defenderSecurityCenterDisableVulnerableTpmFirmwareUpdateUI = $True + defenderSecurityCenterOrganizationDisplayName = "FakeStringValue" + localSecurityOptionsFormatAndEjectOfRemovableMediaAllowedUser = "notConfigured" + userRightsLockMemory = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + appLockerApplicationControl = "notConfigured" + defenderBlockPersistenceThroughWmiType = "userDefined" + defenderDisableScanNetworkFiles = $True + defenderDisableCatchupQuickScan = $True + localSecurityOptionsLogOnMessageTitle = "FakeStringValue" + localSecurityOptionsStandardUserElevationPromptBehavior = "notConfigured" + userRightsGenerateSecurityAudits = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + defenderSecurityCenterDisableClearTpmUI = $True + defenderEnableScanIncomingMail = $True + defenderSecurityCenterHelpPhone = "FakeStringValue" + localSecurityOptionsDoNotRequireCtrlAltDel = $True + userRightsTakeOwnership = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + userRightsLocalLogOn = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + applicationGuardAllowPersistence = $True + defenderCloudExtendedTimeoutInSeconds = 25 + firewallIPSecExemptionsAllowICMP = $True + defenderAllowEndUserAccess = $True + defenderScriptDownloadedPayloadExecution = "userDefined" + defenderExploitProtectionXmlFileName = "FakeStringValue" + defenderScriptObfuscatedMacroCodeType = "userDefined" + defenderDisableScanRemovableDrivesDuringFullScan = $True + localSecurityOptionsAllowSystemToBeShutDownWithoutHavingToLogOn = $True + defenderOfficeMacroCodeAllowWin32ImportsType = "userDefined" + firewallIPSecExemptionsAllowDHCP = $True + firewallProfileDomain = @{ + policyRulesFromGroupPolicyNotMerged = $True + inboundConnectionsRequired = $True + securedPacketExemptionAllowed = $True + securedPacketExemptionBlocked = $True + globalPortRulesFromGroupPolicyMerged = $True + stealthModeBlocked = $True + outboundConnectionsBlocked = $True + inboundConnectionsBlocked = $True + authorizedApplicationRulesFromGroupPolicyMerged = $True + inboundNotificationsRequired = $True + firewallEnabled = "notConfigured" + stealthModeRequired = $True + incomingTrafficBlocked = $True + incomingTrafficRequired = $True + unicastResponsesToMulticastBroadcastsBlocked = $True + policyRulesFromGroupPolicyMerged = $True + unicastResponsesToMulticastBroadcastsRequired = $True + connectionSecurityRulesFromGroupPolicyNotMerged = $True + globalPortRulesFromGroupPolicyNotMerged = $True + outboundConnectionsRequired = $True + inboundNotificationsBlocked = $True + connectionSecurityRulesFromGroupPolicyMerged = $True + authorizedApplicationRulesFromGroupPolicyNotMerged = $True + } + localSecurityOptionsAllowPKU2UAuthenticationRequests = $True + defenderSecurityCenterDisableTroubleshootingUI = $True + defenderPotentiallyUnwantedAppAction = "userDefined" + userRightsModifyFirmwareEnvironment = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + defenderOfficeAppsExecutableContentCreationOrLaunch = "userDefined" + defenderOfficeAppsExecutableContentCreationOrLaunchType = "userDefined" + defenderSubmitSamplesConsentType = "sendSafeSamplesAutomatically" + defenderAdobeReaderLaunchChildProcess = "userDefined" + localSecurityOptionsDetectApplicationInstallationsAndPromptForElevation = $True + defenderDisableIntrusionPreventionSystem = $True + defenderDisableCatchupFullScan = $True + bitLockerDisableWarningForOtherDiskEncryption = $True + xboxServicesLiveNetworkingServiceStartupMode = "manual" + firewallBlockStatefulFTP = $True + firewallMergeKeyingModuleSettings = $True + userRightsManageAuditingAndSecurityLogs = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + userRightsCreatePermanentSharedObjects = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + localSecurityOptionsBlockUsersInstallingPrinterDrivers = $True + smartScreenBlockOverrideForFiles = $True + userRightsCreatePageFile = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + defenderAllowOnAccessProtection = $True + dmaGuardDeviceEnumerationPolicy = "deviceDefault" + defenderOfficeAppsOtherProcessInjectionType = "userDefined" + localSecurityOptionsGuestAccountName = "FakeStringValue" + defenderDetectedMalwareActions = @{ + lowSeverity = "deviceDefault" + severeSeverity = "deviceDefault" + moderateSeverity = "deviceDefault" + highSeverity = "deviceDefault" + } + defenderProcessesToExclude = @("FakeStringValue") + defenderScheduledScanTime = "00:00:00" + defenderSecurityCenterDisableSecureBootUI = $True + applicationGuardAllowFileSaveOnHost = $True + localSecurityOptionsDisableGuestAccount = $True + defenderSecurityCenterDisableRansomwareUI = $True + defenderGuardedFoldersAllowedAppPaths = @("FakeStringValue") + defenderOfficeMacroCodeAllowWin32Imports = "userDefined" + applicationGuardAllowPrintToLocalPrinters = $True + defenderSecurityCenterITContactDisplay = "notConfigured" + defenderAttackSurfaceReductionExcludedPaths = @("FakeStringValue") + defenderAllowScanScriptsLoadedInInternetExplorer = $True + defenderSecurityCenterDisableVirusUI = $True + userRightsAccessCredentialManagerAsTrustedCaller = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + localSecurityOptionsAllowUIAccessApplicationElevation = $True + defenderDisableScanScriptsLoadedInInternetExplorer = $True + localSecurityOptionsAdministratorElevationPromptBehavior = "notConfigured" + userRightsLoadUnloadDrivers = @{ + State = "notConfigured" + LocalUsersOrGroups = @( + @{ + Description = "FakeStringValue" + Name = "FakeStringValue" + SecurityIdentifier = "FakeStringValue" + } + ) + } + defenderScanMaxCpuPercentage = 25 + } + description = "FakeStringValue" + displayName = "FakeStringValue" + id = "FakeStringValue" + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -388,7 +1019,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { localSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $True smartScreenBlockOverrideForFiles = $True smartScreenEnableInShell = $True - supportsScopeTags = $True userRightsAccessCredentialManagerAsTrustedCaller = (New-CimInstance -ClassName MSFT_MicrosoftGraphdeviceManagementUserRightsSetting -Property @{ State = "notConfigured" LocalUsersOrGroups = [CimInstance[]]@( @@ -1035,7 +1665,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { localSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $True smartScreenBlockOverrideForFiles = $True smartScreenEnableInShell = $True - supportsScopeTags = $True userRightsAccessCredentialManagerAsTrustedCaller = (New-CimInstance -ClassName MSFT_MicrosoftGraphdeviceManagementUserRightsSetting -Property @{ State = "notConfigured" LocalUsersOrGroups = [CimInstance[]]@( @@ -1335,639 +1964,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = "Absent" Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - localSecurityOptionsClearVirtualMemoryPageFile = $True - defenderSecurityCenterDisableHardwareUI = $True - applicationGuardAllowPrintToNetworkPrinters = $True - defenderFilesAndFoldersToExclude = @("FakeStringValue") - defenderAllowScanArchiveFiles = $True - firewallIPSecExemptionsNone = $True - bitLockerAllowStandardUserEncryption = $True - localSecurityOptionsAllowRemoteCallsToSecurityAccountsManager = "FakeStringValue" - defenderScheduledScanDay = "userDefined" - firewallPacketQueueingMethod = "deviceDefault" - defenderUntrustedUSBProcessType = "userDefined" - defenderNetworkProtectionType = "userDefined" - defenderProcessCreation = "userDefined" - applicationGuardEnabledOptions = "notConfigured" - defenderOfficeAppsLaunchChildProcess = "userDefined" - defenderAllowRealTimeMonitoring = $True - firewallIPSecExemptionsAllowNeighborDiscovery = $True - defenderUntrustedExecutable = "userDefined" - defenderGuardMyFoldersType = "userDefined" - localSecurityOptionsInformationDisplayedOnLockScreen = "notConfigured" - defenderScheduledQuickScanTime = "00:00:00" - localSecurityOptionsUseAdminApprovalMode = $True - applicationGuardAllowCameraMicrophoneRedirection = $True - applicationGuardAllowPrintToXPS = $True - deviceGuardLaunchSystemGuard = "notConfigured" - defenderScanDirection = "monitorAllFiles" - userRightsIncreaseSchedulingPriority = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - deviceGuardEnableVirtualizationBasedSecurity = $True - defenderBlockEndUserAccess = $True - firewallIPSecExemptionsAllowRouterDiscovery = $True - xboxServicesLiveGameSaveServiceStartupMode = "manual" - bitLockerFixedDrivePolicy = @{ - RecoveryOptions = @{ - RecoveryInformationToStore = "passwordAndKey" - HideRecoveryOptions = $True - BlockDataRecoveryAgent = $True - RecoveryKeyUsage = "blocked" - EnableBitLockerAfterRecoveryInformationToStore = $True - EnableRecoveryInformationSaveToStore = $True - RecoveryPasswordUsage = "blocked" - } - RequireEncryptionForWriteAccess = $True - encryptionMethod = "aesCbc128" - } - userRightsCreateSymbolicLinks = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardBlockFileTransfer = "notConfigured" - defenderCheckForSignaturesBeforeRunningScan = $True - userRightsRemoteShutdown = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - firewallRules = @( - @{ - localAddressRanges = @("FakeStringValue") - action = "notConfigured" - description = "FakeStringValue" - interfaceTypes = "notConfigured" - remotePortRanges = @("FakeStringValue") - displayName = "FakeStringValue" - filePath = "FakeStringValue" - localUserAuthorizations = "FakeStringValue" - protocol = 25 - trafficDirection = "notConfigured" - remoteAddressRanges = @("FakeStringValue") - packageFamilyName = "FakeStringValue" - serviceName = "FakeStringValue" - localPortRanges = @("FakeStringValue") - profileTypes = "notConfigured" - edgeTraversal = "notConfigured" - } - ) - defenderSignatureUpdateIntervalInHours = 25 - defenderEnableLowCpuPriority = $True - localSecurityOptionsAllowAnonymousEnumerationOfSAMAccountsAndShares = $True - defenderFileExtensionsToExclude = @("FakeStringValue") - localSecurityOptionsHideLastSignedInUser = $True - userRightsBlockAccessFromNetwork = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedServers = "none" - xboxServicesLiveAuthManagerServiceStartupMode = "manual" - localSecurityOptionsMachineInactivityLimitInMinutes = 25 - localSecurityOptionsClientDigitallySignCommunicationsAlways = $True - defenderSecurityCenterDisableNetworkUI = $True - userRightsModifyObjectLabels = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - deviceGuardLocalSystemAuthorityCredentialGuardSettings = "notConfigured" - firewallIdleTimeoutForSecurityAssociationInSeconds = 25 - defenderSecurityCenterHelpURL = "FakeStringValue" - localSecurityOptionsDisableServerDigitallySignCommunicationsAlways = $True - localSecurityOptionsAllowRemoteCallsToSecurityAccountsManagerHelperBool = $True - userRightsChangeSystemTime = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsAllowUndockWithoutHavingToLogon = $True - defenderEnableScanMappedNetworkDrivesDuringFullScan = $True - defenderUntrustedUSBProcess = "userDefined" - localSecurityOptionsHideUsernameAtSignIn = $True - defenderAllowScanDownloads = $True - localSecurityOptionsDisableAdministratorAccount = $True - defenderSecurityCenterDisableHealthUI = $True - userRightsCreateGlobalObjects = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsRestrictAnonymousAccessToNamedPipesAndShares = $True - localSecurityOptionsMachineInactivityLimit = 25 - firewallCertificateRevocationListCheckMethod = "deviceDefault" - defenderSecurityCenterDisableFamilyUI = $True - defenderAllowCloudProtection = $True - bitLockerEnableStorageCardEncryptionOnMobile = $True - applicationGuardEnabled = $True - defenderOfficeAppsOtherProcessInjection = "userDefined" - userRightsImpersonateClient = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - '@odata.type' = "#microsoft.graph.windows10EndpointProtectionConfiguration" - localSecurityOptionsUseAdminApprovalModeForAdministrators = $True - lanManagerWorkstationDisableInsecureGuestLogons = $True - defenderAdvancedRansomewareProtectionType = "userDefined" - defenderUntrustedExecutableType = "userDefined" - defenderDisableScanArchiveFiles = $True - lanManagerAuthenticationLevel = "lmAndNltm" - userRightsActAsPartOfTheOperatingSystem = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderPreventCredentialStealingType = "userDefined" - localSecurityOptionsAllowUIAccessApplicationsForSecureLocations = $True - deviceGuardEnableSecureBootWithDMA = $True - localSecurityOptionsDisableClientDigitallySignCommunicationsIfServerAgrees = $True - defenderScriptObfuscatedMacroCode = "userDefined" - defenderDaysBeforeDeletingQuarantinedMalware = 25 - defenderAllowScanRemovableDrivesDuringFullScan = $True - localSecurityOptionsDisableServerDigitallySignCommunicationsIfClientAgrees = $True - firewallProfilePrivate = @{ - policyRulesFromGroupPolicyNotMerged = $True - inboundConnectionsRequired = $True - securedPacketExemptionAllowed = $True - securedPacketExemptionBlocked = $True - globalPortRulesFromGroupPolicyMerged = $True - stealthModeBlocked = $True - outboundConnectionsBlocked = $True - inboundConnectionsBlocked = $True - authorizedApplicationRulesFromGroupPolicyMerged = $True - inboundNotificationsRequired = $True - firewallEnabled = "notConfigured" - stealthModeRequired = $True - incomingTrafficBlocked = $True - incomingTrafficRequired = $True - unicastResponsesToMulticastBroadcastsBlocked = $True - policyRulesFromGroupPolicyMerged = $True - unicastResponsesToMulticastBroadcastsRequired = $True - connectionSecurityRulesFromGroupPolicyNotMerged = $True - globalPortRulesFromGroupPolicyNotMerged = $True - outboundConnectionsRequired = $True - inboundNotificationsBlocked = $True - connectionSecurityRulesFromGroupPolicyMerged = $True - authorizedApplicationRulesFromGroupPolicyNotMerged = $True - } - defenderSecurityCenterDisableAppBrowserUI = $True - localSecurityOptionsInformationShownOnLockScreen = "notConfigured" - defenderOfficeAppsLaunchChildProcessType = "userDefined" - deviceGuardSecureBootWithDMA = "notConfigured" - applicationGuardAllowPrintToPDF = $True - userRightsCreateToken = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderExploitProtectionXml = $True - userRightsRemoteDesktopServicesLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsBlockRemoteLogonWithBlankPassword = $True - userRightsBackupData = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsDenyLocalLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsOnlyElevateSignedExecutables = $True - applicationGuardAllowVirtualGPU = $True - defenderScanType = "userDefined" - bitLockerSystemDrivePolicy = @{ - prebootRecoveryEnableMessageAndUrl = $True - StartupAuthenticationTpmPinUsage = "blocked" - encryptionMethod = "aesCbc128" - minimumPinLength = 25 - prebootRecoveryMessage = "FakeStringValue" - StartupAuthenticationTpmPinAndKeyUsage = "blocked" - StartupAuthenticationRequired = $True - RecoveryOptions = @{ - RecoveryInformationToStore = "passwordAndKey" - HideRecoveryOptions = $True - BlockDataRecoveryAgent = $True - RecoveryKeyUsage = "blocked" - EnableBitLockerAfterRecoveryInformationToStore = $True - EnableRecoveryInformationSaveToStore = $True - RecoveryPasswordUsage = "blocked" - } - prebootRecoveryUrl = "FakeStringValue" - StartupAuthenticationTpmUsage = "blocked" - StartupAuthenticationTpmKeyUsage = "blocked" - StartupAuthenticationBlockWithoutTpmChip = $True - } - defenderAllowBehaviorMonitoring = $True - defenderAllowIntrusionPreventionSystem = $True - localSecurityOptionsDoNotStoreLANManagerHashValueOnNextPasswordChange = $True - defenderSecurityCenterHelpEmail = "FakeStringValue" - defenderDisableBehaviorMonitoring = $True - localSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $True - applicationGuardBlockClipboardSharing = "notConfigured" - defenderEmailContentExecution = "userDefined" - localSecurityOptionsBlockRemoteOpticalDriveAccess = $True - firewallProfilePublic = @{ - policyRulesFromGroupPolicyNotMerged = $True - inboundConnectionsRequired = $True - securedPacketExemptionAllowed = $True - securedPacketExemptionBlocked = $True - globalPortRulesFromGroupPolicyMerged = $True - stealthModeBlocked = $True - outboundConnectionsBlocked = $True - inboundConnectionsBlocked = $True - authorizedApplicationRulesFromGroupPolicyMerged = $True - inboundNotificationsRequired = $True - firewallEnabled = "notConfigured" - stealthModeRequired = $True - incomingTrafficBlocked = $True - incomingTrafficRequired = $True - unicastResponsesToMulticastBroadcastsBlocked = $True - policyRulesFromGroupPolicyMerged = $True - unicastResponsesToMulticastBroadcastsRequired = $True - connectionSecurityRulesFromGroupPolicyNotMerged = $True - globalPortRulesFromGroupPolicyNotMerged = $True - outboundConnectionsRequired = $True - inboundNotificationsBlocked = $True - connectionSecurityRulesFromGroupPolicyMerged = $True - authorizedApplicationRulesFromGroupPolicyNotMerged = $True - } - defenderScriptDownloadedPayloadExecutionType = "userDefined" - xboxServicesAccessoryManagementServiceStartupMode = "manual" - xboxServicesEnableXboxGameSaveTask = $True - bitLockerEncryptDevice = $True - localSecurityOptionsBlockMicrosoftAccounts = $True - bitLockerRemovableDrivePolicy = @{ - requireEncryptionForWriteAccess = $True - blockCrossOrganizationWriteAccess = $True - encryptionMethod = "aesCbc128" - } - defenderSecurityCenterBlockExploitProtectionOverride = $True - localSecurityOptionsLogOnMessageText = "FakeStringValue" - applicationGuardCertificateThumbprints = @("FakeStringValue") - defenderCloudBlockLevel = "notConfigured" - defenderProcessCreationType = "userDefined" - defenderDisableScanDownloads = $True - defenderOfficeCommunicationAppsLaunchChildProcess = "userDefined" - localSecurityOptionsClientSendUnencryptedPasswordToThirdPartySMBServers = $True - userRightsAllowAccessFromNetwork = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardForceAuditing = $True - defenderDisableRealTimeMonitoring = $True - defenderSecurityCenterNotificationsFromApp = "notConfigured" - localSecurityOptionsAdministratorAccountName = "FakeStringValue" - windowsDefenderTamperProtection = "notConfigured" - defenderSecurityCenterDisableAccountUI = $True - localSecurityOptionsSwitchToSecureDesktopWhenPromptingForElevation = $True - defenderEmailContentExecutionType = "userDefined" - defenderAllowScanNetworkFiles = $True - defenderSecurityCenterDisableNotificationAreaUI = $True - userRightsProfileSingleProcess = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsSmartCardRemovalBehavior = "noAction" - defenderDisableCloudProtection = $True - userRightsManageVolumes = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - smartScreenEnableInShell = $True - applicationGuardBlockNonEnterpriseContent = $True - defenderAdditionalGuardedFolders = @("FakeStringValue") - localSecurityOptionsDoNotAllowAnonymousEnumerationOfSAMAccounts = $True - userRightsRestoreData = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedClients = "none" - defenderDisableOnAccessProtection = $True - bitLockerRecoveryPasswordRotation = "notConfigured" - firewallPreSharedKeyEncodingMethod = "deviceDefault" - userRightsDelegation = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsDebugPrograms = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderSecurityCenterDisableVulnerableTpmFirmwareUpdateUI = $True - defenderSecurityCenterOrganizationDisplayName = "FakeStringValue" - localSecurityOptionsFormatAndEjectOfRemovableMediaAllowedUser = "notConfigured" - userRightsLockMemory = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - appLockerApplicationControl = "notConfigured" - defenderBlockPersistenceThroughWmiType = "userDefined" - defenderDisableScanNetworkFiles = $True - defenderDisableCatchupQuickScan = $True - localSecurityOptionsLogOnMessageTitle = "FakeStringValue" - localSecurityOptionsStandardUserElevationPromptBehavior = "notConfigured" - userRightsGenerateSecurityAudits = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderSecurityCenterDisableClearTpmUI = $True - defenderEnableScanIncomingMail = $True - defenderSecurityCenterHelpPhone = "FakeStringValue" - localSecurityOptionsDoNotRequireCtrlAltDel = $True - userRightsTakeOwnership = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsLocalLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardAllowPersistence = $True - defenderCloudExtendedTimeoutInSeconds = 25 - firewallIPSecExemptionsAllowICMP = $True - defenderAllowEndUserAccess = $True - defenderScriptDownloadedPayloadExecution = "userDefined" - defenderExploitProtectionXmlFileName = "FakeStringValue" - defenderScriptObfuscatedMacroCodeType = "userDefined" - defenderDisableScanRemovableDrivesDuringFullScan = $True - localSecurityOptionsAllowSystemToBeShutDownWithoutHavingToLogOn = $True - defenderOfficeMacroCodeAllowWin32ImportsType = "userDefined" - firewallIPSecExemptionsAllowDHCP = $True - firewallProfileDomain = @{ - policyRulesFromGroupPolicyNotMerged = $True - inboundConnectionsRequired = $True - securedPacketExemptionAllowed = $True - securedPacketExemptionBlocked = $True - globalPortRulesFromGroupPolicyMerged = $True - stealthModeBlocked = $True - outboundConnectionsBlocked = $True - inboundConnectionsBlocked = $True - authorizedApplicationRulesFromGroupPolicyMerged = $True - inboundNotificationsRequired = $True - firewallEnabled = "notConfigured" - stealthModeRequired = $True - incomingTrafficBlocked = $True - incomingTrafficRequired = $True - unicastResponsesToMulticastBroadcastsBlocked = $True - policyRulesFromGroupPolicyMerged = $True - unicastResponsesToMulticastBroadcastsRequired = $True - connectionSecurityRulesFromGroupPolicyNotMerged = $True - globalPortRulesFromGroupPolicyNotMerged = $True - outboundConnectionsRequired = $True - inboundNotificationsBlocked = $True - connectionSecurityRulesFromGroupPolicyMerged = $True - authorizedApplicationRulesFromGroupPolicyNotMerged = $True - } - localSecurityOptionsAllowPKU2UAuthenticationRequests = $True - defenderSecurityCenterDisableTroubleshootingUI = $True - defenderPotentiallyUnwantedAppAction = "userDefined" - userRightsModifyFirmwareEnvironment = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderOfficeAppsExecutableContentCreationOrLaunch = "userDefined" - defenderOfficeAppsExecutableContentCreationOrLaunchType = "userDefined" - defenderSubmitSamplesConsentType = "sendSafeSamplesAutomatically" - defenderAdobeReaderLaunchChildProcess = "userDefined" - localSecurityOptionsDetectApplicationInstallationsAndPromptForElevation = $True - defenderDisableIntrusionPreventionSystem = $True - defenderDisableCatchupFullScan = $True - bitLockerDisableWarningForOtherDiskEncryption = $True - xboxServicesLiveNetworkingServiceStartupMode = "manual" - firewallBlockStatefulFTP = $True - firewallMergeKeyingModuleSettings = $True - userRightsManageAuditingAndSecurityLogs = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsCreatePermanentSharedObjects = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsBlockUsersInstallingPrinterDrivers = $True - smartScreenBlockOverrideForFiles = $True - userRightsCreatePageFile = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderAllowOnAccessProtection = $True - dmaGuardDeviceEnumerationPolicy = "deviceDefault" - defenderOfficeAppsOtherProcessInjectionType = "userDefined" - localSecurityOptionsGuestAccountName = "FakeStringValue" - defenderDetectedMalwareActions = @{ - lowSeverity = "deviceDefault" - severeSeverity = "deviceDefault" - moderateSeverity = "deviceDefault" - highSeverity = "deviceDefault" - } - defenderProcessesToExclude = @("FakeStringValue") - defenderScheduledScanTime = "00:00:00" - defenderSecurityCenterDisableSecureBootUI = $True - applicationGuardAllowFileSaveOnHost = $True - localSecurityOptionsDisableGuestAccount = $True - defenderSecurityCenterDisableRansomwareUI = $True - defenderGuardedFoldersAllowedAppPaths = @("FakeStringValue") - defenderOfficeMacroCodeAllowWin32Imports = "userDefined" - applicationGuardAllowPrintToLocalPrinters = $True - defenderSecurityCenterITContactDisplay = "notConfigured" - defenderAttackSurfaceReductionExcludedPaths = @("FakeStringValue") - defenderAllowScanScriptsLoadedInInternetExplorer = $True - defenderSecurityCenterDisableVirusUI = $True - userRightsAccessCredentialManagerAsTrustedCaller = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsAllowUIAccessApplicationElevation = $True - defenderDisableScanScriptsLoadedInInternetExplorer = $True - localSecurityOptionsAdministratorElevationPromptBehavior = "notConfigured" - userRightsLoadUnloadDrivers = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderScanMaxCpuPercentage = 25 - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - supportsScopeTags = $True - - } - } } It "Should return Values from the Get method" { @@ -2313,7 +2309,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { localSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $True smartScreenBlockOverrideForFiles = $True smartScreenEnableInShell = $True - supportsScopeTags = $True userRightsAccessCredentialManagerAsTrustedCaller = (New-CimInstance -ClassName MSFT_MicrosoftGraphdeviceManagementUserRightsSetting -Property @{ State = "notConfigured" LocalUsersOrGroups = [CimInstance[]]@( @@ -2613,642 +2608,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = "Present" Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - localSecurityOptionsClearVirtualMemoryPageFile = $True - defenderSecurityCenterDisableHardwareUI = $True - applicationGuardAllowPrintToNetworkPrinters = $True - defenderFilesAndFoldersToExclude = @("FakeStringValue") - defenderAllowScanArchiveFiles = $True - firewallIPSecExemptionsNone = $True - bitLockerAllowStandardUserEncryption = $True - localSecurityOptionsAllowRemoteCallsToSecurityAccountsManager = "FakeStringValue" - defenderScheduledScanDay = "userDefined" - firewallPacketQueueingMethod = "deviceDefault" - defenderUntrustedUSBProcessType = "userDefined" - defenderNetworkProtectionType = "userDefined" - defenderProcessCreation = "userDefined" - applicationGuardEnabledOptions = "notConfigured" - defenderOfficeAppsLaunchChildProcess = "userDefined" - defenderAllowRealTimeMonitoring = $True - firewallIPSecExemptionsAllowNeighborDiscovery = $True - defenderUntrustedExecutable = "userDefined" - defenderGuardMyFoldersType = "userDefined" - localSecurityOptionsInformationDisplayedOnLockScreen = "notConfigured" - defenderScheduledQuickScanTime = "00:00:00" - localSecurityOptionsUseAdminApprovalMode = $True - applicationGuardAllowCameraMicrophoneRedirection = $True - applicationGuardAllowPrintToXPS = $True - deviceGuardLaunchSystemGuard = "notConfigured" - defenderScanDirection = "monitorAllFiles" - userRightsIncreaseSchedulingPriority = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - deviceGuardEnableVirtualizationBasedSecurity = $True - defenderBlockEndUserAccess = $True - firewallIPSecExemptionsAllowRouterDiscovery = $True - xboxServicesLiveGameSaveServiceStartupMode = "manual" - bitLockerFixedDrivePolicy = @{ - RecoveryOptions = @{ - RecoveryInformationToStore = "passwordAndKey" - HideRecoveryOptions = $True - BlockDataRecoveryAgent = $True - RecoveryKeyUsage = "blocked" - EnableBitLockerAfterRecoveryInformationToStore = $True - EnableRecoveryInformationSaveToStore = $True - RecoveryPasswordUsage = "blocked" - } - RequireEncryptionForWriteAccess = $True - encryptionMethod = "aesCbc128" - } - userRightsCreateSymbolicLinks = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardBlockFileTransfer = "notConfigured" - defenderCheckForSignaturesBeforeRunningScan = $True - userRightsRemoteShutdown = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - firewallRules = @( - @{ - localAddressRanges = @("FakeStringValue") - action = "notConfigured" - description = "FakeStringValue" - interfaceTypes = "notConfigured" - remotePortRanges = @("FakeStringValue") - displayName = "FakeStringValue" - filePath = "FakeStringValue" - localUserAuthorizations = "FakeStringValue" - protocol = 25 - trafficDirection = "notConfigured" - remoteAddressRanges = @("FakeStringValue") - packageFamilyName = "FakeStringValue" - serviceName = "FakeStringValue" - localPortRanges = @("FakeStringValue") - profileTypes = "notConfigured" - edgeTraversal = "notConfigured" - } - ) - defenderSignatureUpdateIntervalInHours = 25 - defenderEnableLowCpuPriority = $True - localSecurityOptionsAllowAnonymousEnumerationOfSAMAccountsAndShares = $True - defenderFileExtensionsToExclude = @("FakeStringValue") - localSecurityOptionsHideLastSignedInUser = $True - userRightsBlockAccessFromNetwork = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedServers = "none" - xboxServicesLiveAuthManagerServiceStartupMode = "manual" - localSecurityOptionsMachineInactivityLimitInMinutes = 25 - localSecurityOptionsClientDigitallySignCommunicationsAlways = $True - defenderSecurityCenterDisableNetworkUI = $True - userRightsModifyObjectLabels = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - deviceGuardLocalSystemAuthorityCredentialGuardSettings = "notConfigured" - firewallIdleTimeoutForSecurityAssociationInSeconds = 25 - defenderSecurityCenterHelpURL = "FakeStringValue" - localSecurityOptionsDisableServerDigitallySignCommunicationsAlways = $True - localSecurityOptionsAllowRemoteCallsToSecurityAccountsManagerHelperBool = $True - userRightsChangeSystemTime = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsAllowUndockWithoutHavingToLogon = $True - defenderEnableScanMappedNetworkDrivesDuringFullScan = $True - defenderUntrustedUSBProcess = "userDefined" - localSecurityOptionsHideUsernameAtSignIn = $True - defenderAllowScanDownloads = $True - localSecurityOptionsDisableAdministratorAccount = $True - defenderSecurityCenterDisableHealthUI = $True - userRightsCreateGlobalObjects = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsRestrictAnonymousAccessToNamedPipesAndShares = $True - localSecurityOptionsMachineInactivityLimit = 25 - firewallCertificateRevocationListCheckMethod = "deviceDefault" - defenderSecurityCenterDisableFamilyUI = $True - defenderAllowCloudProtection = $True - bitLockerEnableStorageCardEncryptionOnMobile = $True - applicationGuardEnabled = $True - defenderOfficeAppsOtherProcessInjection = "userDefined" - userRightsImpersonateClient = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - '@odata.type' = "#microsoft.graph.windows10EndpointProtectionConfiguration" - localSecurityOptionsUseAdminApprovalModeForAdministrators = $True - lanManagerWorkstationDisableInsecureGuestLogons = $True - defenderAdvancedRansomewareProtectionType = "userDefined" - defenderUntrustedExecutableType = "userDefined" - defenderDisableScanArchiveFiles = $True - lanManagerAuthenticationLevel = "lmAndNltm" - userRightsActAsPartOfTheOperatingSystem = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderPreventCredentialStealingType = "userDefined" - localSecurityOptionsAllowUIAccessApplicationsForSecureLocations = $True - deviceGuardEnableSecureBootWithDMA = $True - localSecurityOptionsDisableClientDigitallySignCommunicationsIfServerAgrees = $True - defenderScriptObfuscatedMacroCode = "userDefined" - defenderDaysBeforeDeletingQuarantinedMalware = 25 - defenderAllowScanRemovableDrivesDuringFullScan = $True - localSecurityOptionsDisableServerDigitallySignCommunicationsIfClientAgrees = $True - firewallProfilePrivate = @{ - policyRulesFromGroupPolicyNotMerged = $True - inboundConnectionsRequired = $True - securedPacketExemptionAllowed = $True - securedPacketExemptionBlocked = $True - globalPortRulesFromGroupPolicyMerged = $True - stealthModeBlocked = $True - outboundConnectionsBlocked = $True - inboundConnectionsBlocked = $True - authorizedApplicationRulesFromGroupPolicyMerged = $True - inboundNotificationsRequired = $True - firewallEnabled = "notConfigured" - stealthModeRequired = $True - incomingTrafficBlocked = $True - incomingTrafficRequired = $True - unicastResponsesToMulticastBroadcastsBlocked = $True - policyRulesFromGroupPolicyMerged = $True - unicastResponsesToMulticastBroadcastsRequired = $True - connectionSecurityRulesFromGroupPolicyNotMerged = $True - globalPortRulesFromGroupPolicyNotMerged = $True - outboundConnectionsRequired = $True - inboundNotificationsBlocked = $True - connectionSecurityRulesFromGroupPolicyMerged = $True - authorizedApplicationRulesFromGroupPolicyNotMerged = $True - } - defenderSecurityCenterDisableAppBrowserUI = $True - localSecurityOptionsInformationShownOnLockScreen = "notConfigured" - defenderOfficeAppsLaunchChildProcessType = "userDefined" - deviceGuardSecureBootWithDMA = "notConfigured" - applicationGuardAllowPrintToPDF = $True - userRightsCreateToken = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderExploitProtectionXml = $True - userRightsRemoteDesktopServicesLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsBlockRemoteLogonWithBlankPassword = $True - userRightsBackupData = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsDenyLocalLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsOnlyElevateSignedExecutables = $True - applicationGuardAllowVirtualGPU = $True - defenderScanType = "userDefined" - bitLockerSystemDrivePolicy = @{ - prebootRecoveryEnableMessageAndUrl = $True - StartupAuthenticationTpmPinUsage = "blocked" - encryptionMethod = "aesCbc128" - minimumPinLength = 25 - prebootRecoveryMessage = "FakeStringValue" - StartupAuthenticationTpmPinAndKeyUsage = "blocked" - StartupAuthenticationRequired = $True - RecoveryOptions = @{ - RecoveryInformationToStore = "passwordAndKey" - HideRecoveryOptions = $True - BlockDataRecoveryAgent = $True - RecoveryKeyUsage = "blocked" - EnableBitLockerAfterRecoveryInformationToStore = $True - EnableRecoveryInformationSaveToStore = $True - RecoveryPasswordUsage = "blocked" - } - prebootRecoveryUrl = "FakeStringValue" - StartupAuthenticationTpmUsage = "blocked" - StartupAuthenticationTpmKeyUsage = "blocked" - StartupAuthenticationBlockWithoutTpmChip = $True - } - defenderAllowBehaviorMonitoring = $True - defenderAllowIntrusionPreventionSystem = $True - localSecurityOptionsDoNotStoreLANManagerHashValueOnNextPasswordChange = $True - defenderSecurityCenterHelpEmail = "FakeStringValue" - defenderDisableBehaviorMonitoring = $True - localSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $True - applicationGuardBlockClipboardSharing = "notConfigured" - defenderEmailContentExecution = "userDefined" - localSecurityOptionsBlockRemoteOpticalDriveAccess = $True - firewallProfilePublic = @{ - policyRulesFromGroupPolicyNotMerged = $True - inboundConnectionsRequired = $True - securedPacketExemptionAllowed = $True - securedPacketExemptionBlocked = $True - globalPortRulesFromGroupPolicyMerged = $True - stealthModeBlocked = $True - outboundConnectionsBlocked = $True - inboundConnectionsBlocked = $True - authorizedApplicationRulesFromGroupPolicyMerged = $True - inboundNotificationsRequired = $True - firewallEnabled = "notConfigured" - stealthModeRequired = $True - incomingTrafficBlocked = $True - incomingTrafficRequired = $True - unicastResponsesToMulticastBroadcastsBlocked = $True - policyRulesFromGroupPolicyMerged = $True - unicastResponsesToMulticastBroadcastsRequired = $True - connectionSecurityRulesFromGroupPolicyNotMerged = $True - globalPortRulesFromGroupPolicyNotMerged = $True - outboundConnectionsRequired = $True - inboundNotificationsBlocked = $True - connectionSecurityRulesFromGroupPolicyMerged = $True - authorizedApplicationRulesFromGroupPolicyNotMerged = $True - } - defenderScriptDownloadedPayloadExecutionType = "userDefined" - xboxServicesAccessoryManagementServiceStartupMode = "manual" - xboxServicesEnableXboxGameSaveTask = $True - bitLockerEncryptDevice = $True - localSecurityOptionsBlockMicrosoftAccounts = $True - bitLockerRemovableDrivePolicy = @{ - requireEncryptionForWriteAccess = $True - blockCrossOrganizationWriteAccess = $True - encryptionMethod = "aesCbc128" - } - defenderSecurityCenterBlockExploitProtectionOverride = $True - localSecurityOptionsLogOnMessageText = "FakeStringValue" - applicationGuardCertificateThumbprints = @("FakeStringValue") - defenderCloudBlockLevel = "notConfigured" - defenderProcessCreationType = "userDefined" - defenderDisableScanDownloads = $True - defenderOfficeCommunicationAppsLaunchChildProcess = "userDefined" - localSecurityOptionsClientSendUnencryptedPasswordToThirdPartySMBServers = $True - userRightsAllowAccessFromNetwork = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardForceAuditing = $True - defenderDisableRealTimeMonitoring = $True - defenderSecurityCenterNotificationsFromApp = "notConfigured" - localSecurityOptionsAdministratorAccountName = "FakeStringValue" - windowsDefenderTamperProtection = "notConfigured" - defenderSecurityCenterDisableAccountUI = $True - localSecurityOptionsSwitchToSecureDesktopWhenPromptingForElevation = $True - defenderEmailContentExecutionType = "userDefined" - defenderAllowScanNetworkFiles = $True - defenderSecurityCenterDisableNotificationAreaUI = $True - userRightsProfileSingleProcess = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsSmartCardRemovalBehavior = "noAction" - defenderDisableCloudProtection = $True - userRightsManageVolumes = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - smartScreenEnableInShell = $True - applicationGuardBlockNonEnterpriseContent = $True - defenderAdditionalGuardedFolders = @("FakeStringValue") - localSecurityOptionsDoNotAllowAnonymousEnumerationOfSAMAccounts = $True - userRightsRestoreData = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedClients = "none" - defenderDisableOnAccessProtection = $True - bitLockerRecoveryPasswordRotation = "notConfigured" - firewallPreSharedKeyEncodingMethod = "deviceDefault" - userRightsDelegation = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsDebugPrograms = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderSecurityCenterDisableVulnerableTpmFirmwareUpdateUI = $True - defenderSecurityCenterOrganizationDisplayName = "FakeStringValue" - localSecurityOptionsFormatAndEjectOfRemovableMediaAllowedUser = "notConfigured" - userRightsLockMemory = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - appLockerApplicationControl = "notConfigured" - defenderBlockPersistenceThroughWmiType = "userDefined" - defenderDisableScanNetworkFiles = $True - defenderDisableCatchupQuickScan = $True - localSecurityOptionsLogOnMessageTitle = "FakeStringValue" - localSecurityOptionsStandardUserElevationPromptBehavior = "notConfigured" - userRightsGenerateSecurityAudits = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderSecurityCenterDisableClearTpmUI = $True - defenderEnableScanIncomingMail = $True - defenderSecurityCenterHelpPhone = "FakeStringValue" - localSecurityOptionsDoNotRequireCtrlAltDel = $True - userRightsTakeOwnership = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsLocalLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardAllowPersistence = $True - defenderCloudExtendedTimeoutInSeconds = 25 - firewallIPSecExemptionsAllowICMP = $True - defenderAllowEndUserAccess = $True - defenderScriptDownloadedPayloadExecution = "userDefined" - defenderExploitProtectionXmlFileName = "FakeStringValue" - defenderScriptObfuscatedMacroCodeType = "userDefined" - defenderDisableScanRemovableDrivesDuringFullScan = $True - localSecurityOptionsAllowSystemToBeShutDownWithoutHavingToLogOn = $True - defenderOfficeMacroCodeAllowWin32ImportsType = "userDefined" - firewallIPSecExemptionsAllowDHCP = $True - firewallProfileDomain = @{ - policyRulesFromGroupPolicyNotMerged = $True - inboundConnectionsRequired = $True - securedPacketExemptionAllowed = $True - securedPacketExemptionBlocked = $True - globalPortRulesFromGroupPolicyMerged = $True - stealthModeBlocked = $True - outboundConnectionsBlocked = $True - inboundConnectionsBlocked = $True - authorizedApplicationRulesFromGroupPolicyMerged = $True - inboundNotificationsRequired = $True - firewallEnabled = "notConfigured" - stealthModeRequired = $True - incomingTrafficBlocked = $True - incomingTrafficRequired = $True - unicastResponsesToMulticastBroadcastsBlocked = $True - policyRulesFromGroupPolicyMerged = $True - unicastResponsesToMulticastBroadcastsRequired = $True - connectionSecurityRulesFromGroupPolicyNotMerged = $True - globalPortRulesFromGroupPolicyNotMerged = $True - outboundConnectionsRequired = $True - inboundNotificationsBlocked = $True - connectionSecurityRulesFromGroupPolicyMerged = $True - authorizedApplicationRulesFromGroupPolicyNotMerged = $True - } - localSecurityOptionsAllowPKU2UAuthenticationRequests = $True - defenderSecurityCenterDisableTroubleshootingUI = $True - defenderPotentiallyUnwantedAppAction = "userDefined" - userRightsModifyFirmwareEnvironment = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderOfficeAppsExecutableContentCreationOrLaunch = "userDefined" - defenderOfficeAppsExecutableContentCreationOrLaunchType = "userDefined" - defenderSubmitSamplesConsentType = "sendSafeSamplesAutomatically" - defenderAdobeReaderLaunchChildProcess = "userDefined" - localSecurityOptionsDetectApplicationInstallationsAndPromptForElevation = $True - defenderDisableIntrusionPreventionSystem = $True - defenderDisableCatchupFullScan = $True - bitLockerDisableWarningForOtherDiskEncryption = $True - xboxServicesLiveNetworkingServiceStartupMode = "manual" - firewallBlockStatefulFTP = $True - firewallMergeKeyingModuleSettings = $True - userRightsManageAuditingAndSecurityLogs = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsCreatePermanentSharedObjects = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsBlockUsersInstallingPrinterDrivers = $True - smartScreenBlockOverrideForFiles = $True - userRightsCreatePageFile = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderAllowOnAccessProtection = $True - dmaGuardDeviceEnumerationPolicy = "deviceDefault" - defenderOfficeAppsOtherProcessInjectionType = "userDefined" - localSecurityOptionsGuestAccountName = "FakeStringValue" - defenderDetectedMalwareActions = @{ - lowSeverity = "deviceDefault" - severeSeverity = "deviceDefault" - moderateSeverity = "deviceDefault" - highSeverity = "deviceDefault" - } - defenderProcessesToExclude = @("FakeStringValue") - defenderScheduledScanTime = "00:00:00" - defenderSecurityCenterDisableSecureBootUI = $True - applicationGuardAllowFileSaveOnHost = $True - localSecurityOptionsDisableGuestAccount = $True - defenderSecurityCenterDisableRansomwareUI = $True - defenderGuardedFoldersAllowedAppPaths = @("FakeStringValue") - defenderOfficeMacroCodeAllowWin32Imports = "userDefined" - applicationGuardAllowPrintToLocalPrinters = $True - defenderSecurityCenterITContactDisplay = "notConfigured" - defenderAttackSurfaceReductionExcludedPaths = @("FakeStringValue") - defenderAllowScanScriptsLoadedInInternetExplorer = $True - defenderSecurityCenterDisableVirusUI = $True - userRightsAccessCredentialManagerAsTrustedCaller = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsAllowUIAccessApplicationElevation = $True - defenderDisableScanScriptsLoadedInInternetExplorer = $True - localSecurityOptionsAdministratorElevationPromptBehavior = "notConfigured" - userRightsLoadUnloadDrivers = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderScanMaxCpuPercentage = 25 - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - supportsScopeTags = $True - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -3257,7 +2618,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The IntuneDeviceConfigurationEndpointProtectionPolicyWindows10 exists and values are NOT in the desired state" -Fixture { BeforeAll { $testParams = @{ - ApplicationGuardAllowCameraMicrophoneRedirection = $True + ApplicationGuardAllowCameraMicrophoneRedirection = $False # Updated property ApplicationGuardAllowFileSaveOnHost = $True ApplicationGuardAllowPersistence = $True ApplicationGuardAllowPrintToLocalPrinters = $True @@ -3584,7 +2945,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { localSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $True smartScreenBlockOverrideForFiles = $True smartScreenEnableInShell = $True - supportsScopeTags = $True userRightsAccessCredentialManagerAsTrustedCaller = (New-CimInstance -ClassName MSFT_MicrosoftGraphdeviceManagementUserRightsSetting -Property @{ State = "notConfigured" LocalUsersOrGroups = [CimInstance[]]@( @@ -3884,455 +3244,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = "Present" Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - userRightsManageAuditingAndSecurityLogs = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - bitLockerSystemDrivePolicy = @{ - StartupAuthenticationTpmPinUsage = "blocked" - encryptionMethod = "aesCbc128" - minimumPinLength = 7 - prebootRecoveryMessage = "FakeStringValue" - StartupAuthenticationTpmPinAndKeyUsage = "blocked" - RecoveryOptions = @{ - RecoveryPasswordUsage = "blocked" - RecoveryInformationToStore = "passwordAndKey" - RecoveryKeyUsage = "blocked" - } - prebootRecoveryUrl = "FakeStringValue" - StartupAuthenticationTpmUsage = "blocked" - StartupAuthenticationTpmKeyUsage = "blocked" - } - localSecurityOptionsGuestAccountName = "FakeStringValue" - defenderSecurityCenterOrganizationDisplayName = "FakeStringValue" - userRightsAccessCredentialManagerAsTrustedCaller = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedClients = "none" - userRightsTakeOwnership = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - firewallPacketQueueingMethod = "deviceDefault" - defenderProcessCreation = "userDefined" - windowsDefenderTamperProtection = "notConfigured" - firewallIdleTimeoutForSecurityAssociationInSeconds = 7 - defenderUntrustedUSBProcessType = "userDefined" - deviceGuardLaunchSystemGuard = "notConfigured" - userRightsCreatePermanentSharedObjects = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - firewallPreSharedKeyEncodingMethod = "deviceDefault" - applicationGuardBlockClipboardSharing = "notConfigured" - userRightsLocalLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderAdvancedRansomewareProtectionType = "userDefined" - firewallProfilePublic = @{ - firewallEnabled = "notConfigured" - } - defenderOfficeAppsLaunchChildProcess = "userDefined" - defenderDetectedMalwareActions = @{ - lowSeverity = "deviceDefault" - severeSeverity = "deviceDefault" - moderateSeverity = "deviceDefault" - highSeverity = "deviceDefault" - } - localSecurityOptionsSmartCardRemovalBehavior = "noAction" - lanManagerAuthenticationLevel = "lmAndNltm" - userRightsCreateGlobalObjects = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - xboxServicesAccessoryManagementServiceStartupMode = "manual" - applicationGuardCertificateThumbprints = @("FakeStringValue") - xboxServicesLiveNetworkingServiceStartupMode = "manual" - '@odata.type' = "#microsoft.graph.windows10EndpointProtectionConfiguration" - userRightsManageVolumes = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderSecurityCenterHelpEmail = "FakeStringValue" - localSecurityOptionsLogOnMessageTitle = "FakeStringValue" - userRightsDenyLocalLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderAdditionalGuardedFolders = @("FakeStringValue") - defenderUntrustedExecutable = "userDefined" - localSecurityOptionsStandardUserElevationPromptBehavior = "notConfigured" - firewallRules = @( - @{ - localAddressRanges = @("FakeStringValue") - action = "notConfigured" - description = "FakeStringValue" - interfaceTypes = "notConfigured" - remotePortRanges = @("FakeStringValue") - displayName = "FakeStringValue" - filePath = "FakeStringValue" - localUserAuthorizations = "FakeStringValue" - protocol = 7 - trafficDirection = "notConfigured" - remoteAddressRanges = @("FakeStringValue") - packageFamilyName = "FakeStringValue" - serviceName = "FakeStringValue" - localPortRanges = @("FakeStringValue") - profileTypes = "notConfigured" - edgeTraversal = "notConfigured" - } - ) - bitLockerRemovableDrivePolicy = @{ - encryptionMethod = "aesCbc128" - } - defenderGuardedFoldersAllowedAppPaths = @("FakeStringValue") - defenderEmailContentExecutionType = "userDefined" - defenderScriptDownloadedPayloadExecutionType = "userDefined" - dmaGuardDeviceEnumerationPolicy = "deviceDefault" - defenderEmailContentExecution = "userDefined" - userRightsLockMemory = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderSubmitSamplesConsentType = "sendSafeSamplesAutomatically" - defenderSecurityCenterHelpURL = "FakeStringValue" - defenderScheduledScanDay = "userDefined" - userRightsLoadUnloadDrivers = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsGenerateSecurityAudits = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderDaysBeforeDeletingQuarantinedMalware = 7 - defenderBlockPersistenceThroughWmiType = "userDefined" - defenderFilesAndFoldersToExclude = @("FakeStringValue") - defenderSecurityCenterNotificationsFromApp = "notConfigured" - userRightsBlockAccessFromNetwork = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - bitLockerRecoveryPasswordRotation = "notConfigured" - defenderFileExtensionsToExclude = @("FakeStringValue") - defenderProcessCreationType = "userDefined" - defenderScanMaxCpuPercentage = 7 - userRightsChangeSystemTime = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderScanDirection = "monitorAllFiles" - defenderOfficeAppsExecutableContentCreationOrLaunch = "userDefined" - localSecurityOptionsMachineInactivityLimit = 7 - userRightsModifyFirmwareEnvironment = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsInformationDisplayedOnLockScreen = "notConfigured" - defenderOfficeAppsExecutableContentCreationOrLaunchType = "userDefined" - userRightsRemoteShutdown = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsInformationShownOnLockScreen = "notConfigured" - defenderOfficeCommunicationAppsLaunchChildProcess = "userDefined" - bitLockerFixedDrivePolicy = @{ - RecoveryOptions = @{ - RecoveryPasswordUsage = "blocked" - RecoveryInformationToStore = "passwordAndKey" - RecoveryKeyUsage = "blocked" - } - encryptionMethod = "aesCbc128" - } - userRightsDelegation = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderExploitProtectionXmlFileName = "FakeStringValue" - userRightsImpersonateClient = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsMachineInactivityLimitInMinutes = 7 - firewallProfileDomain = @{ - firewallEnabled = "notConfigured" - } - defenderCloudBlockLevel = "notConfigured" - firewallProfilePrivate = @{ - firewallEnabled = "notConfigured" - } - defenderCloudExtendedTimeoutInSeconds = 7 - userRightsIncreaseSchedulingPriority = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsAdministratorAccountName = "FakeStringValue" - defenderAttackSurfaceReductionExcludedPaths = @("FakeStringValue") - userRightsCreatePageFile = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderAdobeReaderLaunchChildProcess = "userDefined" - userRightsBackupData = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderOfficeAppsLaunchChildProcessType = "userDefined" - defenderOfficeMacroCodeAllowWin32Imports = "userDefined" - applicationGuardEnabledOptions = "notConfigured" - deviceGuardSecureBootWithDMA = "notConfigured" - defenderScheduledQuickScanTime = "00:00:00" - defenderScriptObfuscatedMacroCode = "userDefined" - defenderScriptObfuscatedMacroCodeType = "userDefined" - defenderPreventCredentialStealingType = "userDefined" - defenderOfficeMacroCodeAllowWin32ImportsType = "userDefined" - userRightsAllowAccessFromNetwork = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderProcessesToExclude = @("FakeStringValue") - defenderNetworkProtectionType = "userDefined" - firewallCertificateRevocationListCheckMethod = "deviceDefault" - userRightsCreateToken = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderOfficeAppsOtherProcessInjection = "userDefined" - localSecurityOptionsLogOnMessageText = "FakeStringValue" - defenderUntrustedExecutableType = "userDefined" - defenderScanType = "userDefined" - deviceGuardLocalSystemAuthorityCredentialGuardSettings = "notConfigured" - userRightsModifyObjectLabels = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderSecurityCenterHelpPhone = "FakeStringValue" - appLockerApplicationControl = "notConfigured" - userRightsRemoteDesktopServicesLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderUntrustedUSBProcess = "userDefined" - userRightsDebugPrograms = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardBlockFileTransfer = "notConfigured" - localSecurityOptionsFormatAndEjectOfRemovableMediaAllowedUser = "notConfigured" - userRightsProfileSingleProcess = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderOfficeAppsOtherProcessInjectionType = "userDefined" - defenderGuardMyFoldersType = "userDefined" - xboxServicesLiveGameSaveServiceStartupMode = "manual" - userRightsRestoreData = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsAdministratorElevationPromptBehavior = "notConfigured" - localSecurityOptionsAllowRemoteCallsToSecurityAccountsManager = "FakeStringValue" - defenderPotentiallyUnwantedAppAction = "userDefined" - defenderScriptDownloadedPayloadExecution = "userDefined" - defenderSecurityCenterITContactDisplay = "notConfigured" - userRightsCreateSymbolicLinks = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderScheduledScanTime = "00:00:00" - xboxServicesLiveAuthManagerServiceStartupMode = "manual" - userRightsActAsPartOfTheOperatingSystem = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedServers = "none" - defenderSignatureUpdateIntervalInHours = 7 - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - } - } } It "Should return Values from the Get method" { @@ -4356,640 +3267,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - localSecurityOptionsClearVirtualMemoryPageFile = $True - defenderSecurityCenterDisableHardwareUI = $True - applicationGuardAllowPrintToNetworkPrinters = $True - defenderFilesAndFoldersToExclude = @("FakeStringValue") - defenderAllowScanArchiveFiles = $True - firewallIPSecExemptionsNone = $True - bitLockerAllowStandardUserEncryption = $True - localSecurityOptionsAllowRemoteCallsToSecurityAccountsManager = "FakeStringValue" - defenderScheduledScanDay = "userDefined" - firewallPacketQueueingMethod = "deviceDefault" - defenderUntrustedUSBProcessType = "userDefined" - defenderNetworkProtectionType = "userDefined" - defenderProcessCreation = "userDefined" - applicationGuardEnabledOptions = "notConfigured" - defenderOfficeAppsLaunchChildProcess = "userDefined" - defenderAllowRealTimeMonitoring = $True - firewallIPSecExemptionsAllowNeighborDiscovery = $True - defenderUntrustedExecutable = "userDefined" - defenderGuardMyFoldersType = "userDefined" - localSecurityOptionsInformationDisplayedOnLockScreen = "notConfigured" - defenderScheduledQuickScanTime = "00:00:00" - localSecurityOptionsUseAdminApprovalMode = $True - applicationGuardAllowCameraMicrophoneRedirection = $True - applicationGuardAllowPrintToXPS = $True - deviceGuardLaunchSystemGuard = "notConfigured" - defenderScanDirection = "monitorAllFiles" - userRightsIncreaseSchedulingPriority = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - deviceGuardEnableVirtualizationBasedSecurity = $True - defenderBlockEndUserAccess = $True - firewallIPSecExemptionsAllowRouterDiscovery = $True - xboxServicesLiveGameSaveServiceStartupMode = "manual" - bitLockerFixedDrivePolicy = @{ - RecoveryOptions = @{ - RecoveryInformationToStore = "passwordAndKey" - HideRecoveryOptions = $True - BlockDataRecoveryAgent = $True - RecoveryKeyUsage = "blocked" - EnableBitLockerAfterRecoveryInformationToStore = $True - EnableRecoveryInformationSaveToStore = $True - RecoveryPasswordUsage = "blocked" - } - RequireEncryptionForWriteAccess = $True - encryptionMethod = "aesCbc128" - } - userRightsCreateSymbolicLinks = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardBlockFileTransfer = "notConfigured" - defenderCheckForSignaturesBeforeRunningScan = $True - userRightsRemoteShutdown = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - firewallRules = @( - @{ - localAddressRanges = @("FakeStringValue") - action = "notConfigured" - description = "FakeStringValue" - interfaceTypes = "notConfigured" - remotePortRanges = @("FakeStringValue") - displayName = "FakeStringValue" - filePath = "FakeStringValue" - localUserAuthorizations = "FakeStringValue" - protocol = 25 - trafficDirection = "notConfigured" - remoteAddressRanges = @("FakeStringValue") - packageFamilyName = "FakeStringValue" - serviceName = "FakeStringValue" - localPortRanges = @("FakeStringValue") - profileTypes = "notConfigured" - edgeTraversal = "notConfigured" - } - ) - defenderSignatureUpdateIntervalInHours = 25 - defenderEnableLowCpuPriority = $True - localSecurityOptionsAllowAnonymousEnumerationOfSAMAccountsAndShares = $True - defenderFileExtensionsToExclude = @("FakeStringValue") - localSecurityOptionsHideLastSignedInUser = $True - userRightsBlockAccessFromNetwork = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedServers = "none" - xboxServicesLiveAuthManagerServiceStartupMode = "manual" - localSecurityOptionsMachineInactivityLimitInMinutes = 25 - localSecurityOptionsClientDigitallySignCommunicationsAlways = $True - defenderSecurityCenterDisableNetworkUI = $True - userRightsModifyObjectLabels = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - deviceGuardLocalSystemAuthorityCredentialGuardSettings = "notConfigured" - firewallIdleTimeoutForSecurityAssociationInSeconds = 25 - defenderSecurityCenterHelpURL = "FakeStringValue" - localSecurityOptionsDisableServerDigitallySignCommunicationsAlways = $True - localSecurityOptionsAllowRemoteCallsToSecurityAccountsManagerHelperBool = $True - userRightsChangeSystemTime = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsAllowUndockWithoutHavingToLogon = $True - defenderEnableScanMappedNetworkDrivesDuringFullScan = $True - defenderUntrustedUSBProcess = "userDefined" - localSecurityOptionsHideUsernameAtSignIn = $True - defenderAllowScanDownloads = $True - localSecurityOptionsDisableAdministratorAccount = $True - defenderSecurityCenterDisableHealthUI = $True - userRightsCreateGlobalObjects = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsRestrictAnonymousAccessToNamedPipesAndShares = $True - localSecurityOptionsMachineInactivityLimit = 25 - firewallCertificateRevocationListCheckMethod = "deviceDefault" - defenderSecurityCenterDisableFamilyUI = $True - defenderAllowCloudProtection = $True - bitLockerEnableStorageCardEncryptionOnMobile = $True - applicationGuardEnabled = $True - defenderOfficeAppsOtherProcessInjection = "userDefined" - userRightsImpersonateClient = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - '@odata.type' = "#microsoft.graph.windows10EndpointProtectionConfiguration" - localSecurityOptionsUseAdminApprovalModeForAdministrators = $True - lanManagerWorkstationDisableInsecureGuestLogons = $True - defenderAdvancedRansomewareProtectionType = "userDefined" - defenderUntrustedExecutableType = "userDefined" - defenderDisableScanArchiveFiles = $True - lanManagerAuthenticationLevel = "lmAndNltm" - userRightsActAsPartOfTheOperatingSystem = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderPreventCredentialStealingType = "userDefined" - localSecurityOptionsAllowUIAccessApplicationsForSecureLocations = $True - deviceGuardEnableSecureBootWithDMA = $True - localSecurityOptionsDisableClientDigitallySignCommunicationsIfServerAgrees = $True - defenderScriptObfuscatedMacroCode = "userDefined" - defenderDaysBeforeDeletingQuarantinedMalware = 25 - defenderAllowScanRemovableDrivesDuringFullScan = $True - localSecurityOptionsDisableServerDigitallySignCommunicationsIfClientAgrees = $True - firewallProfilePrivate = @{ - policyRulesFromGroupPolicyNotMerged = $True - inboundConnectionsRequired = $True - securedPacketExemptionAllowed = $True - securedPacketExemptionBlocked = $True - globalPortRulesFromGroupPolicyMerged = $True - stealthModeBlocked = $True - outboundConnectionsBlocked = $True - inboundConnectionsBlocked = $True - authorizedApplicationRulesFromGroupPolicyMerged = $True - inboundNotificationsRequired = $True - firewallEnabled = "notConfigured" - stealthModeRequired = $True - incomingTrafficBlocked = $True - incomingTrafficRequired = $True - unicastResponsesToMulticastBroadcastsBlocked = $True - policyRulesFromGroupPolicyMerged = $True - unicastResponsesToMulticastBroadcastsRequired = $True - connectionSecurityRulesFromGroupPolicyNotMerged = $True - globalPortRulesFromGroupPolicyNotMerged = $True - outboundConnectionsRequired = $True - inboundNotificationsBlocked = $True - connectionSecurityRulesFromGroupPolicyMerged = $True - authorizedApplicationRulesFromGroupPolicyNotMerged = $True - } - defenderSecurityCenterDisableAppBrowserUI = $True - localSecurityOptionsInformationShownOnLockScreen = "notConfigured" - defenderOfficeAppsLaunchChildProcessType = "userDefined" - deviceGuardSecureBootWithDMA = "notConfigured" - applicationGuardAllowPrintToPDF = $True - userRightsCreateToken = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderExploitProtectionXml = $True - userRightsRemoteDesktopServicesLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsBlockRemoteLogonWithBlankPassword = $True - userRightsBackupData = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsDenyLocalLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsOnlyElevateSignedExecutables = $True - applicationGuardAllowVirtualGPU = $True - defenderScanType = "userDefined" - bitLockerSystemDrivePolicy = @{ - prebootRecoveryEnableMessageAndUrl = $True - StartupAuthenticationTpmPinUsage = "blocked" - encryptionMethod = "aesCbc128" - minimumPinLength = 25 - prebootRecoveryMessage = "FakeStringValue" - StartupAuthenticationTpmPinAndKeyUsage = "blocked" - StartupAuthenticationRequired = $True - RecoveryOptions = @{ - RecoveryInformationToStore = "passwordAndKey" - HideRecoveryOptions = $True - BlockDataRecoveryAgent = $True - RecoveryKeyUsage = "blocked" - EnableBitLockerAfterRecoveryInformationToStore = $True - EnableRecoveryInformationSaveToStore = $True - RecoveryPasswordUsage = "blocked" - } - prebootRecoveryUrl = "FakeStringValue" - StartupAuthenticationTpmUsage = "blocked" - StartupAuthenticationTpmKeyUsage = "blocked" - StartupAuthenticationBlockWithoutTpmChip = $True - } - defenderAllowBehaviorMonitoring = $True - defenderAllowIntrusionPreventionSystem = $True - localSecurityOptionsDoNotStoreLANManagerHashValueOnNextPasswordChange = $True - defenderSecurityCenterHelpEmail = "FakeStringValue" - defenderDisableBehaviorMonitoring = $True - localSecurityOptionsVirtualizeFileAndRegistryWriteFailuresToPerUserLocations = $True - applicationGuardBlockClipboardSharing = "notConfigured" - defenderEmailContentExecution = "userDefined" - localSecurityOptionsBlockRemoteOpticalDriveAccess = $True - firewallProfilePublic = @{ - policyRulesFromGroupPolicyNotMerged = $True - inboundConnectionsRequired = $True - securedPacketExemptionAllowed = $True - securedPacketExemptionBlocked = $True - globalPortRulesFromGroupPolicyMerged = $True - stealthModeBlocked = $True - outboundConnectionsBlocked = $True - inboundConnectionsBlocked = $True - authorizedApplicationRulesFromGroupPolicyMerged = $True - inboundNotificationsRequired = $True - firewallEnabled = "notConfigured" - stealthModeRequired = $True - incomingTrafficBlocked = $True - incomingTrafficRequired = $True - unicastResponsesToMulticastBroadcastsBlocked = $True - policyRulesFromGroupPolicyMerged = $True - unicastResponsesToMulticastBroadcastsRequired = $True - connectionSecurityRulesFromGroupPolicyNotMerged = $True - globalPortRulesFromGroupPolicyNotMerged = $True - outboundConnectionsRequired = $True - inboundNotificationsBlocked = $True - connectionSecurityRulesFromGroupPolicyMerged = $True - authorizedApplicationRulesFromGroupPolicyNotMerged = $True - } - defenderScriptDownloadedPayloadExecutionType = "userDefined" - xboxServicesAccessoryManagementServiceStartupMode = "manual" - xboxServicesEnableXboxGameSaveTask = $True - bitLockerEncryptDevice = $True - localSecurityOptionsBlockMicrosoftAccounts = $True - bitLockerRemovableDrivePolicy = @{ - requireEncryptionForWriteAccess = $True - blockCrossOrganizationWriteAccess = $True - encryptionMethod = "aesCbc128" - } - defenderSecurityCenterBlockExploitProtectionOverride = $True - localSecurityOptionsLogOnMessageText = "FakeStringValue" - applicationGuardCertificateThumbprints = @("FakeStringValue") - defenderCloudBlockLevel = "notConfigured" - defenderProcessCreationType = "userDefined" - defenderDisableScanDownloads = $True - defenderOfficeCommunicationAppsLaunchChildProcess = "userDefined" - localSecurityOptionsClientSendUnencryptedPasswordToThirdPartySMBServers = $True - userRightsAllowAccessFromNetwork = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardForceAuditing = $True - defenderDisableRealTimeMonitoring = $True - defenderSecurityCenterNotificationsFromApp = "notConfigured" - localSecurityOptionsAdministratorAccountName = "FakeStringValue" - windowsDefenderTamperProtection = "notConfigured" - defenderSecurityCenterDisableAccountUI = $True - localSecurityOptionsSwitchToSecureDesktopWhenPromptingForElevation = $True - defenderEmailContentExecutionType = "userDefined" - defenderAllowScanNetworkFiles = $True - defenderSecurityCenterDisableNotificationAreaUI = $True - userRightsProfileSingleProcess = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsSmartCardRemovalBehavior = "noAction" - defenderDisableCloudProtection = $True - userRightsManageVolumes = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - smartScreenEnableInShell = $True - applicationGuardBlockNonEnterpriseContent = $True - defenderAdditionalGuardedFolders = @("FakeStringValue") - localSecurityOptionsDoNotAllowAnonymousEnumerationOfSAMAccounts = $True - userRightsRestoreData = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsMinimumSessionSecurityForNtlmSspBasedClients = "none" - defenderDisableOnAccessProtection = $True - bitLockerRecoveryPasswordRotation = "notConfigured" - firewallPreSharedKeyEncodingMethod = "deviceDefault" - userRightsDelegation = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsDebugPrograms = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderSecurityCenterDisableVulnerableTpmFirmwareUpdateUI = $True - defenderSecurityCenterOrganizationDisplayName = "FakeStringValue" - localSecurityOptionsFormatAndEjectOfRemovableMediaAllowedUser = "notConfigured" - userRightsLockMemory = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - appLockerApplicationControl = "notConfigured" - defenderBlockPersistenceThroughWmiType = "userDefined" - defenderDisableScanNetworkFiles = $True - defenderDisableCatchupQuickScan = $True - localSecurityOptionsLogOnMessageTitle = "FakeStringValue" - localSecurityOptionsStandardUserElevationPromptBehavior = "notConfigured" - userRightsGenerateSecurityAudits = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderSecurityCenterDisableClearTpmUI = $True - defenderEnableScanIncomingMail = $True - defenderSecurityCenterHelpPhone = "FakeStringValue" - localSecurityOptionsDoNotRequireCtrlAltDel = $True - userRightsTakeOwnership = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsLocalLogOn = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - applicationGuardAllowPersistence = $True - defenderCloudExtendedTimeoutInSeconds = 25 - firewallIPSecExemptionsAllowICMP = $True - defenderAllowEndUserAccess = $True - defenderScriptDownloadedPayloadExecution = "userDefined" - defenderExploitProtectionXmlFileName = "FakeStringValue" - defenderScriptObfuscatedMacroCodeType = "userDefined" - defenderDisableScanRemovableDrivesDuringFullScan = $True - localSecurityOptionsAllowSystemToBeShutDownWithoutHavingToLogOn = $True - defenderOfficeMacroCodeAllowWin32ImportsType = "userDefined" - firewallIPSecExemptionsAllowDHCP = $True - firewallProfileDomain = @{ - policyRulesFromGroupPolicyNotMerged = $True - inboundConnectionsRequired = $True - securedPacketExemptionAllowed = $True - securedPacketExemptionBlocked = $True - globalPortRulesFromGroupPolicyMerged = $True - stealthModeBlocked = $True - outboundConnectionsBlocked = $True - inboundConnectionsBlocked = $True - authorizedApplicationRulesFromGroupPolicyMerged = $True - inboundNotificationsRequired = $True - firewallEnabled = "notConfigured" - stealthModeRequired = $True - incomingTrafficBlocked = $True - incomingTrafficRequired = $True - unicastResponsesToMulticastBroadcastsBlocked = $True - policyRulesFromGroupPolicyMerged = $True - unicastResponsesToMulticastBroadcastsRequired = $True - connectionSecurityRulesFromGroupPolicyNotMerged = $True - globalPortRulesFromGroupPolicyNotMerged = $True - outboundConnectionsRequired = $True - inboundNotificationsBlocked = $True - connectionSecurityRulesFromGroupPolicyMerged = $True - authorizedApplicationRulesFromGroupPolicyNotMerged = $True - } - localSecurityOptionsAllowPKU2UAuthenticationRequests = $True - defenderSecurityCenterDisableTroubleshootingUI = $True - defenderPotentiallyUnwantedAppAction = "userDefined" - userRightsModifyFirmwareEnvironment = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderOfficeAppsExecutableContentCreationOrLaunch = "userDefined" - defenderOfficeAppsExecutableContentCreationOrLaunchType = "userDefined" - defenderSubmitSamplesConsentType = "sendSafeSamplesAutomatically" - defenderAdobeReaderLaunchChildProcess = "userDefined" - localSecurityOptionsDetectApplicationInstallationsAndPromptForElevation = $True - defenderDisableIntrusionPreventionSystem = $True - defenderDisableCatchupFullScan = $True - bitLockerDisableWarningForOtherDiskEncryption = $True - xboxServicesLiveNetworkingServiceStartupMode = "manual" - firewallBlockStatefulFTP = $True - firewallMergeKeyingModuleSettings = $True - userRightsManageAuditingAndSecurityLogs = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - userRightsCreatePermanentSharedObjects = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsBlockUsersInstallingPrinterDrivers = $True - smartScreenBlockOverrideForFiles = $True - userRightsCreatePageFile = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderAllowOnAccessProtection = $True - dmaGuardDeviceEnumerationPolicy = "deviceDefault" - defenderOfficeAppsOtherProcessInjectionType = "userDefined" - localSecurityOptionsGuestAccountName = "FakeStringValue" - defenderDetectedMalwareActions = @{ - lowSeverity = "deviceDefault" - severeSeverity = "deviceDefault" - moderateSeverity = "deviceDefault" - highSeverity = "deviceDefault" - } - defenderProcessesToExclude = @("FakeStringValue") - defenderScheduledScanTime = "00:00:00" - defenderSecurityCenterDisableSecureBootUI = $True - applicationGuardAllowFileSaveOnHost = $True - localSecurityOptionsDisableGuestAccount = $True - defenderSecurityCenterDisableRansomwareUI = $True - defenderGuardedFoldersAllowedAppPaths = @("FakeStringValue") - defenderOfficeMacroCodeAllowWin32Imports = "userDefined" - applicationGuardAllowPrintToLocalPrinters = $True - defenderSecurityCenterITContactDisplay = "notConfigured" - defenderAttackSurfaceReductionExcludedPaths = @("FakeStringValue") - defenderAllowScanScriptsLoadedInInternetExplorer = $True - defenderSecurityCenterDisableVirusUI = $True - userRightsAccessCredentialManagerAsTrustedCaller = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - localSecurityOptionsAllowUIAccessApplicationElevation = $True - defenderDisableScanScriptsLoadedInInternetExplorer = $True - localSecurityOptionsAdministratorElevationPromptBehavior = "notConfigured" - userRightsLoadUnloadDrivers = @{ - State = "notConfigured" - LocalUsersOrGroups = @( - @{ - Description = "FakeStringValue" - Name = "FakeStringValue" - SecurityIdentifier = "FakeStringValue" - } - ) - } - defenderScanMaxCpuPercentage = 25 - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - supportsScopeTags = $True - - } - } } + It "Should Reverse Engineer resource from the Export method" { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.Tests.ps1 index 31a04b51d0..15b8adfc60 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationFirmwareInterfacePolicyWindows10.Tests.ps1 @@ -46,6 +46,38 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + wakeOnPower = "notConfigured" + microphone = "notConfigured" + bootFromBuiltInNetworkAdapters = "notConfigured" + radios = "notConfigured" + simultaneousMultiThreading = "notConfigured" + usbTypeAPort = "notConfigured" + microphonesAndSpeakers = "notConfigured" + rearCamera = "notConfigured" + infraredCamera = "notConfigured" + changeUefiSettingsPermission = "notConfiguredOnly" + sdCard = "notConfigured" + bootFromExternalMedia = "notConfigured" + frontCamera = "notConfigured" + windowsPlatformBinaryTable = "notConfigured" + '@odata.type' = "#microsoft.graph.windows10DeviceFirmwareConfigurationInterface" + wakeOnLAN = "notConfigured" + virtualizationOfCpuAndIO = "notConfigured" + wirelessWideAreaNetwork = "notConfigured" + nearFieldCommunication = "notConfigured" + wiFi = "notConfigured" + bluetooth = "notConfigured" + cameras = "notConfigured" + } + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + Id = "FakeStringValue" + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -78,7 +110,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { RearCamera = "notConfigured" SdCard = "notConfigured" SimultaneousMultiThreading = "notConfigured" - SupportsScopeTags = $True UsbTypeAPort = "notConfigured" VirtualizationOfCpuAndIO = "notConfigured" WakeOnLAN = "notConfigured" @@ -126,7 +157,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { RearCamera = "notConfigured" SdCard = "notConfigured" SimultaneousMultiThreading = "notConfigured" - SupportsScopeTags = $True UsbTypeAPort = "notConfigured" VirtualizationOfCpuAndIO = "notConfigured" WakeOnLAN = "notConfigured" @@ -137,40 +167,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - wakeOnPower = "notConfigured" - microphone = "notConfigured" - bootFromBuiltInNetworkAdapters = "notConfigured" - radios = "notConfigured" - simultaneousMultiThreading = "notConfigured" - usbTypeAPort = "notConfigured" - microphonesAndSpeakers = "notConfigured" - rearCamera = "notConfigured" - infraredCamera = "notConfigured" - changeUefiSettingsPermission = "notConfiguredOnly" - sdCard = "notConfigured" - bootFromExternalMedia = "notConfigured" - frontCamera = "notConfigured" - windowsPlatformBinaryTable = "notConfigured" - '@odata.type' = "#microsoft.graph.windows10DeviceFirmwareConfigurationInterface" - wakeOnLAN = "notConfigured" - virtualizationOfCpuAndIO = "notConfigured" - wirelessWideAreaNetwork = "notConfigured" - nearFieldCommunication = "notConfigured" - wiFi = "notConfigured" - bluetooth = "notConfigured" - cameras = "notConfigured" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - SupportsScopeTags = $True - - } - } } It 'Should return Values from the Get method' { @@ -206,7 +202,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { RearCamera = "notConfigured" SdCard = "notConfigured" SimultaneousMultiThreading = "notConfigured" - SupportsScopeTags = $True UsbTypeAPort = "notConfigured" VirtualizationOfCpuAndIO = "notConfigured" WakeOnLAN = "notConfigured" @@ -217,40 +212,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - wakeOnPower = "notConfigured" - microphone = "notConfigured" - bootFromBuiltInNetworkAdapters = "notConfigured" - radios = "notConfigured" - simultaneousMultiThreading = "notConfigured" - usbTypeAPort = "notConfigured" - microphonesAndSpeakers = "notConfigured" - rearCamera = "notConfigured" - infraredCamera = "notConfigured" - changeUefiSettingsPermission = "notConfiguredOnly" - sdCard = "notConfigured" - bootFromExternalMedia = "notConfigured" - frontCamera = "notConfigured" - windowsPlatformBinaryTable = "notConfigured" - '@odata.type' = "#microsoft.graph.windows10DeviceFirmwareConfigurationInterface" - wakeOnLAN = "notConfigured" - virtualizationOfCpuAndIO = "notConfigured" - wirelessWideAreaNetwork = "notConfigured" - nearFieldCommunication = "notConfigured" - wiFi = "notConfigured" - bluetooth = "notConfigured" - cameras = "notConfigured" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - SupportsScopeTags = $True - - } - } } @@ -278,8 +239,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Radios = "notConfigured" RearCamera = "notConfigured" SdCard = "notConfigured" - SimultaneousMultiThreading = "notConfigured" - SupportsScopeTags = $True + SimultaneousMultiThreading = "enabled" # Updated property UsbTypeAPort = "notConfigured" VirtualizationOfCpuAndIO = "notConfigured" WakeOnLAN = "notConfigured" @@ -290,38 +250,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - wakeOnPower = "notConfigured" - microphone = "notConfigured" - bootFromBuiltInNetworkAdapters = "notConfigured" - radios = "notConfigured" - simultaneousMultiThreading = "notConfigured" - usbTypeAPort = "notConfigured" - microphonesAndSpeakers = "notConfigured" - rearCamera = "notConfigured" - infraredCamera = "notConfigured" - changeUefiSettingsPermission = "notConfiguredOnly" - sdCard = "notConfigured" - bootFromExternalMedia = "notConfigured" - frontCamera = "notConfigured" - windowsPlatformBinaryTable = "notConfigured" - '@odata.type' = "#microsoft.graph.windows10DeviceFirmwareConfigurationInterface" - wakeOnLAN = "notConfigured" - virtualizationOfCpuAndIO = "notConfigured" - wirelessWideAreaNetwork = "notConfigured" - nearFieldCommunication = "notConfigured" - wiFi = "notConfigured" - bluetooth = "notConfigured" - cameras = "notConfigured" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -345,41 +273,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - wakeOnPower = "notConfigured" - microphone = "notConfigured" - bootFromBuiltInNetworkAdapters = "notConfigured" - radios = "notConfigured" - simultaneousMultiThreading = "notConfigured" - usbTypeAPort = "notConfigured" - microphonesAndSpeakers = "notConfigured" - rearCamera = "notConfigured" - infraredCamera = "notConfigured" - changeUefiSettingsPermission = "notConfiguredOnly" - sdCard = "notConfigured" - bootFromExternalMedia = "notConfigured" - frontCamera = "notConfigured" - windowsPlatformBinaryTable = "notConfigured" - '@odata.type' = "#microsoft.graph.windows10DeviceFirmwareConfigurationInterface" - wakeOnLAN = "notConfigured" - virtualizationOfCpuAndIO = "notConfigured" - wirelessWideAreaNetwork = "notConfigured" - nearFieldCommunication = "notConfigured" - wiFi = "notConfigured" - bluetooth = "notConfigured" - cameras = "notConfigured" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - SupportsScopeTags = $True - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.Tests.ps1 index 2163d962ed..3278f33bb0 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10.Tests.ps1 @@ -49,6 +49,20 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.windowsHealthMonitoringConfiguration' + configDeviceHealthMonitoringCustomScope = 'FakeStringValue' + allowDeviceHealthMonitoring = 'notConfigured' + configDeviceHealthMonitoringScope = 'undefined' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + } + } + Mock -CommandName Write-M365DSCHost -MockWith{ } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -70,7 +84,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Description = 'FakeStringValue' DisplayName = 'FakeStringValue' Id = 'FakeStringValue' - SupportsScopeTags = $True Ensure = 'Present' Credential = $Credential } @@ -100,25 +113,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Description = 'FakeStringValue' DisplayName = 'FakeStringValue' Id = 'FakeStringValue' - SupportsScopeTags = $True Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windowsHealthMonitoringConfiguration' - configDeviceHealthMonitoringCustomScope = 'FakeStringValue' - allowDeviceHealthMonitoring = 'notConfigured' - configDeviceHealthMonitoringScope = 'undefined' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - SupportsScopeTags = $True - } - } } It 'Should return Values from the Get method' { @@ -143,25 +140,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Description = 'FakeStringValue' DisplayName = 'FakeStringValue' Id = 'FakeStringValue' - SupportsScopeTags = $True Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windowsHealthMonitoringConfiguration' - configDeviceHealthMonitoringCustomScope = 'FakeStringValue' - allowDeviceHealthMonitoring = 'notConfigured' - configDeviceHealthMonitoringScope = 'undefined' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - SupportsScopeTags = $True - } - } } @@ -173,30 +154,15 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'The IntuneDeviceConfigurationHealthMonitoringConfigurationPolicyWindows10 exists and values are NOT in the desired state' -Fixture { BeforeAll { $testParams = @{ - AllowDeviceHealthMonitoring = 'notConfigured' + AllowDeviceHealthMonitoring = 'enabled' # Updated property ConfigDeviceHealthMonitoringCustomScope = 'FakeStringValue' ConfigDeviceHealthMonitoringScope = 'undefined' Description = 'FakeStringValue' DisplayName = 'FakeStringValue' Id = 'FakeStringValue' - SupportsScopeTags = $True Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windowsHealthMonitoringConfiguration' - configDeviceHealthMonitoringCustomScope = 'FakeStringValue' - allowDeviceHealthMonitoring = 'notConfigured' - configDeviceHealthMonitoringScope = 'undefined' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -220,22 +186,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windowsHealthMonitoringConfiguration' - configDeviceHealthMonitoringCustomScope = 'FakeStringValue' - allowDeviceHealthMonitoring = 'notConfigured' - configDeviceHealthMonitoringScope = 'undefined' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - SupportsScopeTags = $True - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.Tests.ps1 index 98e86cbe4e..87bd1c20b9 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationIdentityProtectionPolicyWindows10.Tests.ps1 @@ -46,6 +46,31 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + pinRecoveryEnabled = $True + pinExpirationInDays = 25 + pinMinimumLength = 25 + securityDeviceRequired = $True + useCertificatesForOnPremisesAuthEnabled = $True + unlockWithBiometricsEnabled = $True + '@odata.type' = '#microsoft.graph.windowsIdentityProtectionConfiguration' + pinLowercaseCharactersUsage = 'blocked' + pinPreviousBlockCount = 25 + windowsHelloForBusinessBlocked = $True + useSecurityKeyForSignin = $True + pinSpecialCharactersUsage = 'blocked' + pinMaximumLength = 25 + enhancedAntiSpoofingForFacialFeaturesEnabled = $True + pinUppercaseCharactersUsage = 'blocked' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -77,7 +102,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PinSpecialCharactersUsage = 'blocked' PinUppercaseCharactersUsage = 'blocked' SecurityDeviceRequired = $True - SupportsScopeTags = $True UnlockWithBiometricsEnabled = $True UseCertificatesForOnPremisesAuthEnabled = $True UseSecurityKeyForSignin = $True @@ -118,7 +142,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PinSpecialCharactersUsage = 'blocked' PinUppercaseCharactersUsage = 'blocked' SecurityDeviceRequired = $True - SupportsScopeTags = $True UnlockWithBiometricsEnabled = $True UseCertificatesForOnPremisesAuthEnabled = $True UseSecurityKeyForSignin = $True @@ -126,33 +149,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - pinRecoveryEnabled = $True - pinExpirationInDays = 25 - pinMinimumLength = 25 - securityDeviceRequired = $True - useCertificatesForOnPremisesAuthEnabled = $True - unlockWithBiometricsEnabled = $True - '@odata.type' = '#microsoft.graph.windowsIdentityProtectionConfiguration' - pinLowercaseCharactersUsage = 'blocked' - pinPreviousBlockCount = 25 - windowsHelloForBusinessBlocked = $True - useSecurityKeyForSignin = $True - pinSpecialCharactersUsage = 'blocked' - pinMaximumLength = 25 - enhancedAntiSpoofingForFacialFeaturesEnabled = $True - pinUppercaseCharactersUsage = 'blocked' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - SupportsScopeTags = $True - - } - } } It 'Should return Values from the Get method' { @@ -184,7 +180,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PinSpecialCharactersUsage = 'blocked' PinUppercaseCharactersUsage = 'blocked' SecurityDeviceRequired = $True - SupportsScopeTags = $True UnlockWithBiometricsEnabled = $True UseCertificatesForOnPremisesAuthEnabled = $True UseSecurityKeyForSignin = $True @@ -192,33 +187,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - pinRecoveryEnabled = $True - pinExpirationInDays = 25 - pinMinimumLength = 25 - securityDeviceRequired = $True - useCertificatesForOnPremisesAuthEnabled = $True - unlockWithBiometricsEnabled = $True - '@odata.type' = '#microsoft.graph.windowsIdentityProtectionConfiguration' - pinLowercaseCharactersUsage = 'blocked' - pinPreviousBlockCount = 25 - windowsHelloForBusinessBlocked = $True - useSecurityKeyForSignin = $True - pinSpecialCharactersUsage = 'blocked' - pinMaximumLength = 25 - enhancedAntiSpoofingForFacialFeaturesEnabled = $True - pinUppercaseCharactersUsage = 'blocked' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - SupportsScopeTags = $True - - } - } } @@ -234,7 +202,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = 'FakeStringValue' EnhancedAntiSpoofingForFacialFeaturesEnabled = $True Id = 'FakeStringValue' - PinExpirationInDays = 25 + PinExpirationInDays = 7 # Updated property PinLowercaseCharactersUsage = 'blocked' PinMaximumLength = 25 PinMinimumLength = 25 @@ -243,7 +211,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PinSpecialCharactersUsage = 'blocked' PinUppercaseCharactersUsage = 'blocked' SecurityDeviceRequired = $True - SupportsScopeTags = $True UnlockWithBiometricsEnabled = $True UseCertificatesForOnPremisesAuthEnabled = $True UseSecurityKeyForSignin = $True @@ -251,24 +218,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windowsIdentityProtectionConfiguration' - pinUppercaseCharactersUsage = 'blocked' - pinPreviousBlockCount = 7 - pinMinimumLength = 7 - pinSpecialCharactersUsage = 'blocked' - pinExpirationInDays = 7 - pinLowercaseCharactersUsage = 'blocked' - pinMaximumLength = 7 - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -292,33 +241,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - pinRecoveryEnabled = $True - pinExpirationInDays = 25 - pinMinimumLength = 25 - securityDeviceRequired = $True - useCertificatesForOnPremisesAuthEnabled = $True - unlockWithBiometricsEnabled = $True - '@odata.type' = '#microsoft.graph.windowsIdentityProtectionConfiguration' - pinLowercaseCharactersUsage = 'blocked' - pinPreviousBlockCount = 25 - windowsHelloForBusinessBlocked = $True - useSecurityKeyForSignin = $True - pinSpecialCharactersUsage = 'blocked' - pinMaximumLength = 25 - enhancedAntiSpoofingForFacialFeaturesEnabled = $True - pinUppercaseCharactersUsage = 'blocked' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - SupportsScopeTags = $True - - } - } } It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationImportedPfxCertificatePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationImportedPfxCertificatePolicyWindows10.Tests.ps1 index 0a31c4e230..678426dcc1 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationImportedPfxCertificatePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationImportedPfxCertificatePolicyWindows10.Tests.ps1 @@ -46,6 +46,25 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + intendedPurpose = "unassigned" + subjectAlternativeNameType = "none" + certificateValidityPeriodScale = "days" + '@odata.type' = "#microsoft.graph.windows10ImportedPFXCertificateProfile" + keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" + subjectNameFormat = "commonName" + certificateValidityPeriodValue = 25 + renewalThresholdPercentage = 25 + } + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + Id = "FakeStringValue" + + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -107,25 +126,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - intendedPurpose = "unassigned" - subjectAlternativeNameType = "none" - certificateValidityPeriodScale = "days" - '@odata.type' = "#microsoft.graph.windows10ImportedPFXCertificateProfile" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - subjectNameFormat = "commonName" - certificateValidityPeriodValue = 25 - renewalThresholdPercentage = 25 - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } It 'Should return Values from the Get method' { @@ -157,25 +157,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - intendedPurpose = "unassigned" - subjectAlternativeNameType = "none" - certificateValidityPeriodScale = "days" - '@odata.type' = "#microsoft.graph.windows10ImportedPFXCertificateProfile" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - subjectNameFormat = "commonName" - certificateValidityPeriodValue = 25 - renewalThresholdPercentage = 25 - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } @@ -194,30 +175,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Id = "FakeStringValue" IntendedPurpose = "unassigned" KeyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - RenewalThresholdPercentage = 25 + RenewalThresholdPercentage = 7 # Updated property SubjectAlternativeNameType = "none" SubjectNameFormat = "commonName" Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - intendedPurpose = "unassigned" - subjectAlternativeNameType = "none" - certificateValidityPeriodScale = "days" - '@odata.type' = "#microsoft.graph.windows10ImportedPFXCertificateProfile" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - subjectNameFormat = "commonName" - certificateValidityPeriodValue = 7 - renewalThresholdPercentage = 7 - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -241,25 +204,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - intendedPurpose = "unassigned" - subjectAlternativeNameType = "none" - certificateValidityPeriodScale = "days" - '@odata.type' = "#microsoft.graph.windows10ImportedPFXCertificateProfile" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - subjectNameFormat = "commonName" - certificateValidityPeriodValue = 25 - renewalThresholdPercentage = 25 - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationKioskPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationKioskPolicyWindows10.Tests.ps1 index a6439421dc..36d4b83e98 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationKioskPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationKioskPolicyWindows10.Tests.ps1 @@ -40,6 +40,113 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + kioskBrowserBlockedURLs = @("FakeStringValue") + kioskBrowserDefaultUrl = "FakeStringValue" + '@odata.type' = "#microsoft.graph.windowsKioskConfiguration" + kioskBrowserEnableNavigationButtons = $True + edgeKioskEnablePublicBrowsing = $True + kioskBrowserRestartOnIdleTimeInMinutes = 25 + kioskBrowserBlockedUrlExceptions = @("FakeStringValue") + kioskBrowserEnableHomeButton = $True + windowsKioskForceUpdateSchedule = @{ + runImmediatelyIfAfterStartDateTime = $True + startDateTime = "2023-01-01T00:00:00.0000000+00:00" + dayofMonth = 25 + recurrence = "none" + dayofWeek = "sunday" + } + kioskProfiles = @( + @{ + profileId = "FakeStringValue" + userAccountsConfiguration = @( + @{ + groupId = "FakeStringValue" + '@odata.type' = "#microsoft.graph.windowsKioskActiveDirectoryGroup" + userName = "FakeStringValue" + userPrincipalName = "FakeStringValue" + groupName = "FakeStringValue" + userId = "FakeStringValue" + displayName = "FakeStringValue" + } + ) + profileName = "FakeStringValue" + appConfiguration = @{ + uwpApp = @{ + edgeNoFirstRun = $True + name = "FakeStringValue" + edgeKiosk = "FakeStringValue" + classicAppPath = "FakeStringValue" + appId = "FakeStringValue" + appUserModelId = "FakeStringValue" + edgeKioskIdleTimeoutMinutes = 25 + autoLaunch = $True + startLayoutTileSize = "hidden" + appType = "unknown" + '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" + edgeKioskType = "publicBrowsing" + containedAppId = "FakeStringValue" + desktopApplicationId = "FakeStringValue" + desktopApplicationLinkPath = "FakeStringValue" + path = "FakeStringValue" + } + win32App = @{ + edgeNoFirstRun = $True + name = "FakeStringValue" + edgeKiosk = "FakeStringValue" + classicAppPath = "FakeStringValue" + edgeKioskIdleTimeoutMinutes = 25 + appUserModelId = "FakeStringValue" + appId = "FakeStringValue" + autoLaunch = $True + startLayoutTileSize = "hidden" + appType = "unknown" + '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" + edgeKioskType = "publicBrowsing" + containedAppId = "FakeStringValue" + desktopApplicationId = "FakeStringValue" + desktopApplicationLinkPath = "FakeStringValue" + path = "FakeStringValue" + } + '@odata.type' = "#microsoft.graph.windowsKioskMultipleApps" + apps = @( + @{ + edgeNoFirstRun = $True + name = "FakeStringValue" + edgeKiosk = "FakeStringValue" + classicAppPath = "FakeStringValue" + appId = "FakeStringValue" + appUserModelId = "FakeStringValue" + edgeKioskIdleTimeoutMinutes = 25 + autoLaunch = $True + startLayoutTileSize = "hidden" + appType = "unknown" + '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" + edgeKioskType = "publicBrowsing" + containedAppId = "FakeStringValue" + desktopApplicationId = "FakeStringValue" + desktopApplicationLinkPath = "FakeStringValue" + path = "FakeStringValue" + } + ) + allowAccessToDownloadsFolder = $True + showTaskBar = $True + disallowDesktopApps = $True + startMenuLayoutXml = $True + } + } + ) + kioskBrowserEnableEndSessionButton = $True + } + description = "FakeStringValue" + displayName = "FakeStringValue" + id = "FakeStringValue" + + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -277,113 +384,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - kioskBrowserBlockedURLs = @("FakeStringValue") - kioskBrowserDefaultUrl = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsKioskConfiguration" - kioskBrowserEnableNavigationButtons = $True - edgeKioskEnablePublicBrowsing = $True - kioskBrowserRestartOnIdleTimeInMinutes = 25 - kioskBrowserBlockedUrlExceptions = @("FakeStringValue") - kioskBrowserEnableHomeButton = $True - windowsKioskForceUpdateSchedule = @{ - runImmediatelyIfAfterStartDateTime = $True - startDateTime = "2023-01-01T00:00:00.0000000+00:00" - dayofMonth = 25 - recurrence = "none" - dayofWeek = "sunday" - } - kioskProfiles = @( - @{ - profileId = "FakeStringValue" - userAccountsConfiguration = @( - @{ - groupId = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsKioskActiveDirectoryGroup" - userName = "FakeStringValue" - userPrincipalName = "FakeStringValue" - groupName = "FakeStringValue" - userId = "FakeStringValue" - displayName = "FakeStringValue" - } - ) - profileName = "FakeStringValue" - appConfiguration = @{ - uwpApp = @{ - edgeNoFirstRun = $True - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - appId = "FakeStringValue" - appUserModelId = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 25 - autoLaunch = $True - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - win32App = @{ - edgeNoFirstRun = $True - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 25 - appUserModelId = "FakeStringValue" - appId = "FakeStringValue" - autoLaunch = $True - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - '@odata.type' = "#microsoft.graph.windowsKioskMultipleApps" - apps = @( - @{ - edgeNoFirstRun = $True - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - appId = "FakeStringValue" - appUserModelId = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 25 - autoLaunch = $True - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - ) - allowAccessToDownloadsFolder = $True - showTaskBar = $True - disallowDesktopApps = $True - startMenuLayoutXml = $True - } - } - ) - kioskBrowserEnableEndSessionButton = $True - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } It 'Should return Values from the Get method' { @@ -503,116 +503,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - kioskBrowserBlockedURLs = @("FakeStringValue") - kioskBrowserDefaultUrl = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsKioskConfiguration" - kioskBrowserEnableNavigationButtons = $True - edgeKioskEnablePublicBrowsing = $True - kioskBrowserRestartOnIdleTimeInMinutes = 25 - kioskBrowserBlockedUrlExceptions = @("FakeStringValue") - kioskBrowserEnableHomeButton = $True - windowsKioskForceUpdateSchedule = @{ - runImmediatelyIfAfterStartDateTime = $True - startDateTime = "2023-01-01T00:00:00.0000000+00:00" - dayofMonth = 25 - recurrence = "none" - dayofWeek = "sunday" - } - kioskProfiles = @( - @{ - profileId = "FakeStringValue" - userAccountsConfiguration = @( - @{ - groupId = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsKioskActiveDirectoryGroup" - userName = "FakeStringValue" - userPrincipalName = "FakeStringValue" - groupName = "FakeStringValue" - userId = "FakeStringValue" - displayName = "FakeStringValue" - } - ) - profileName = "FakeStringValue" - appConfiguration = @{ - uwpApp = @{ - edgeNoFirstRun = $True - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - appId = "FakeStringValue" - appUserModelId = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 25 - autoLaunch = $True - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - win32App = @{ - edgeNoFirstRun = $True - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 25 - appUserModelId = "FakeStringValue" - appId = "FakeStringValue" - autoLaunch = $True - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - '@odata.type' = "#microsoft.graph.windowsKioskMultipleApps" - apps = @( - @{ - edgeNoFirstRun = $True - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - appId = "FakeStringValue" - appUserModelId = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 25 - autoLaunch = $True - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - ) - allowAccessToDownloadsFolder = $True - showTaskBar = $True - disallowDesktopApps = $True - startMenuLayoutXml = $True - } - } - ) - kioskBrowserEnableEndSessionButton = $True - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -631,7 +523,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { KioskBrowserEnableEndSessionButton = $True KioskBrowserEnableHomeButton = $True KioskBrowserEnableNavigationButtons = $True - KioskBrowserRestartOnIdleTimeInMinutes = 25 + KioskBrowserRestartOnIdleTimeInMinutes = 7 # Updated property kioskProfiles = [CimInstance[]]@( (New-CimInstance -ClassName MSFT_MicrosoftGraphwindowsKioskProfile -Property @{ profileId = "FakeStringValue" @@ -722,97 +614,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - kioskBrowserBlockedURLs = @("FakeStringValue") - kioskBrowserDefaultUrl = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsKioskConfiguration" - kioskBrowserBlockedUrlExceptions = @("FakeStringValue") - kioskBrowserRestartOnIdleTimeInMinutes = 7 - windowsKioskForceUpdateSchedule = @{ - startDateTime = "2023-01-01T00:00:00.0000000+00:00" - dayofMonth = 7 - recurrence = "none" - dayofWeek = "sunday" - } - kioskProfiles = @( - @{ - profileId = "FakeStringValue" - userAccountsConfiguration = @( - @{ - groupId = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsKioskActiveDirectoryGroup" - userName = "FakeStringValue" - userPrincipalName = "FakeStringValue" - groupName = "FakeStringValue" - userId = "FakeStringValue" - displayName = "FakeStringValue" - } - ) - profileName = "FakeStringValue" - appConfiguration = @{ - apps = @( - @{ - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - appId = "FakeStringValue" - appUserModelId = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 7 - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - ) - uwpApp = @{ - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - appId = "FakeStringValue" - appUserModelId = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 7 - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - '@odata.type' = "#microsoft.graph.windowsKioskMultipleApps" - win32App = @{ - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - appId = "FakeStringValue" - appUserModelId = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 7 - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - } - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -836,113 +637,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - kioskBrowserBlockedURLs = @("FakeStringValue") - kioskBrowserDefaultUrl = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsKioskConfiguration" - kioskBrowserEnableNavigationButtons = $True - edgeKioskEnablePublicBrowsing = $True - kioskBrowserRestartOnIdleTimeInMinutes = 25 - kioskBrowserBlockedUrlExceptions = @("FakeStringValue") - kioskBrowserEnableHomeButton = $True - windowsKioskForceUpdateSchedule = @{ - runImmediatelyIfAfterStartDateTime = $True - startDateTime = "2023-01-01T00:00:00.0000000+00:00" - dayofMonth = 25 - recurrence = "none" - dayofWeek = "sunday" - } - kioskProfiles = @( - @{ - profileId = "FakeStringValue" - userAccountsConfiguration = @( - @{ - groupId = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windowsKioskActiveDirectoryGroup" - userName = "FakeStringValue" - userPrincipalName = "FakeStringValue" - groupName = "FakeStringValue" - userId = "FakeStringValue" - displayName = "FakeStringValue" - } - ) - profileName = "FakeStringValue" - appConfiguration = @{ - uwpApp = @{ - edgeNoFirstRun = $True - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - appId = "FakeStringValue" - appUserModelId = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 25 - autoLaunch = $True - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - win32App = @{ - edgeNoFirstRun = $True - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 25 - appUserModelId = "FakeStringValue" - appId = "FakeStringValue" - autoLaunch = $True - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - '@odata.type' = "#microsoft.graph.windowsKioskMultipleApps" - apps = @( - @{ - edgeNoFirstRun = $True - name = "FakeStringValue" - edgeKiosk = "FakeStringValue" - classicAppPath = "FakeStringValue" - appId = "FakeStringValue" - appUserModelId = "FakeStringValue" - edgeKioskIdleTimeoutMinutes = 25 - autoLaunch = $True - startLayoutTileSize = "hidden" - appType = "unknown" - '@odata.type' = "#microsoft.graph.windowsKioskDesktopApp" - edgeKioskType = "publicBrowsing" - containedAppId = "FakeStringValue" - desktopApplicationId = "FakeStringValue" - desktopApplicationLinkPath = "FakeStringValue" - path = "FakeStringValue" - } - ) - allowAccessToDownloadsFolder = $True - showTaskBar = $True - disallowDesktopApps = $True - startMenuLayoutXml = $True - } - } - ) - kioskBrowserEnableEndSessionButton = $True - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.Tests.ps1 index 512b02d69a..13c35037fb 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationNetworkBoundaryPolicyWindows10.Tests.ps1 @@ -46,6 +46,39 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + windowsNetworkIsolationPolicy = @{ + EnterpriseProxyServers = @('FakeStringValue') + EnterpriseInternalProxyServers = @('FakeStringValue') + EnterpriseIPRangesAreAuthoritative = $True + EnterpriseCloudResources = @( + @{ + Proxy = 'FakeStringValue' + IpAddressOrFQDN = 'FakeStringValue' + } + ) + EnterpriseProxyServersAreAuthoritative = $True + EnterpriseNetworkDomainNames = @('FakeStringValue') + EnterpriseIPRanges = @( + @{ + CidrAddress = 'FakeStringValue' + UpperAddress = 'FakeStringValue' + LowerAddress = 'FakeStringValue' + '@odata.type' = '#microsoft.graph.iPv4CidrRange' + } + ) + NeutralDomainResources = @('FakeStringValue') + } + '@odata.type' = '#microsoft.graph.windows10NetworkBoundaryConfiguration' + } + description = 'FakeStringValue' + displayName = 'FakeStringValue' + id = 'FakeStringValue' + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -64,7 +97,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { description = 'FakeStringValue' displayName = 'FakeStringValue' id = 'FakeStringValue' - supportsScopeTags = $True windowsNetworkIsolationPolicy = (New-CimInstance -ClassName MSFT_MicrosoftGraphwindowsNetworkIsolationPolicy -Property @{ EnterpriseProxyServers = @('FakeStringValue') EnterpriseInternalProxyServers = @('FakeStringValue') @@ -113,7 +145,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { description = 'FakeStringValue' displayName = 'FakeStringValue' id = 'FakeStringValue' - supportsScopeTags = $True windowsNetworkIsolationPolicy = (New-CimInstance -ClassName MSFT_MicrosoftGraphwindowsNetworkIsolationPolicy -Property @{ EnterpriseProxyServers = @('FakeStringValue') EnterpriseInternalProxyServers = @('FakeStringValue') @@ -139,41 +170,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - windowsNetworkIsolationPolicy = @{ - EnterpriseProxyServers = @('FakeStringValue') - EnterpriseInternalProxyServers = @('FakeStringValue') - EnterpriseIPRangesAreAuthoritative = $True - EnterpriseCloudResources = @( - @{ - Proxy = 'FakeStringValue' - IpAddressOrFQDN = 'FakeStringValue' - } - ) - EnterpriseProxyServersAreAuthoritative = $True - EnterpriseNetworkDomainNames = @('FakeStringValue') - EnterpriseIPRanges = @( - @{ - CidrAddress = 'FakeStringValue' - UpperAddress = 'FakeStringValue' - LowerAddress = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.iPv4CidrRange' - } - ) - NeutralDomainResources = @('FakeStringValue') - } - '@odata.type' = '#microsoft.graph.windows10NetworkBoundaryConfiguration' - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - supportsScopeTags = $True - - } - } } It 'Should return Values from the Get method' { @@ -195,7 +191,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { description = 'FakeStringValue' displayName = 'FakeStringValue' id = 'FakeStringValue' - supportsScopeTags = $True windowsNetworkIsolationPolicy = (New-CimInstance -ClassName MSFT_MicrosoftGraphwindowsNetworkIsolationPolicy -Property @{ EnterpriseProxyServers = @('FakeStringValue') EnterpriseInternalProxyServers = @('FakeStringValue') @@ -221,41 +216,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - windowsNetworkIsolationPolicy = @{ - EnterpriseProxyServers = @('FakeStringValue') - EnterpriseInternalProxyServers = @('FakeStringValue') - EnterpriseIPRangesAreAuthoritative = $True - EnterpriseCloudResources = @( - @{ - Proxy = 'FakeStringValue' - IpAddressOrFQDN = 'FakeStringValue' - } - ) - EnterpriseProxyServersAreAuthoritative = $True - EnterpriseNetworkDomainNames = @('FakeStringValue') - EnterpriseIPRanges = @( - @{ - CidrAddress = 'FakeStringValue' - UpperAddress = 'FakeStringValue' - LowerAddress = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.iPv4CidrRange' - } - ) - NeutralDomainResources = @('FakeStringValue') - } - '@odata.type' = '#microsoft.graph.windows10NetworkBoundaryConfiguration' - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - supportsScopeTags = $True - - } - } } @@ -270,11 +230,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { description = 'FakeStringValue' displayName = 'FakeStringValue' id = 'FakeStringValue' - supportsScopeTags = $True windowsNetworkIsolationPolicy = (New-CimInstance -ClassName MSFT_MicrosoftGraphwindowsNetworkIsolationPolicy -Property @{ EnterpriseProxyServers = @('FakeStringValue') EnterpriseInternalProxyServers = @('FakeStringValue') - EnterpriseIPRangesAreAuthoritative = $True + EnterpriseIPRangesAreAuthoritative = $False # Updated property EnterpriseCloudResources = [CimInstance[]]@( (New-CimInstance -ClassName MSFT_MicrosoftGraphproxiedDomain1 -Property @{ Proxy = 'FakeStringValue' @@ -296,37 +255,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - windowsNetworkIsolationPolicy = @{ - EnterpriseProxyServers = @('FakeStringValue') - EnterpriseInternalProxyServers = @('FakeStringValue') - EnterpriseCloudResources = @( - @{ - Proxy = 'FakeStringValue' - IpAddressOrFQDN = 'FakeStringValue' - } - ) - EnterpriseNetworkDomainNames = @('FakeStringValue') - EnterpriseIPRanges = @( - @{ - CidrAddress = 'FakeStringValue' - UpperAddress = 'FakeStringValue' - LowerAddress = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.iPv4CidrRange' - } - ) - NeutralDomainResources = @('FakeStringValue') - } - '@odata.type' = '#microsoft.graph.windows10NetworkBoundaryConfiguration' - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -350,42 +278,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - windowsNetworkIsolationPolicy = @{ - EnterpriseProxyServers = @('FakeStringValue') - EnterpriseInternalProxyServers = @('FakeStringValue') - EnterpriseIPRangesAreAuthoritative = $True - EnterpriseCloudResources = @( - @{ - Proxy = 'FakeStringValue' - IpAddressOrFQDN = 'FakeStringValue' - } - ) - EnterpriseProxyServersAreAuthoritative = $True - EnterpriseNetworkDomainNames = @('FakeStringValue') - EnterpriseIPRanges = @( - @{ - CidrAddress = 'FakeStringValue' - UpperAddress = 'FakeStringValue' - LowerAddress = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.iPv4CidrRange' - } - ) - NeutralDomainResources = @('FakeStringValue') - } - '@odata.type' = '#microsoft.graph.windows10NetworkBoundaryConfiguration' - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - supportsScopeTags = $True - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPkcsCertificatePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPkcsCertificatePolicyWindows10.Tests.ps1 index 0f1013b55d..9679bfd52d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPkcsCertificatePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPkcsCertificatePolicyWindows10.Tests.ps1 @@ -40,6 +40,42 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + subjectAlternativeNameType = "none" + certificationAuthorityName = "FakeStringValue" + renewalThresholdPercentage = 25 + subjectAlternativeNameFormatString = "FakeStringValue" + certificateValidityPeriodScale = "days" + keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" + certificationAuthority = "FakeStringValue" + certificateValidityPeriodValue = 25 + certificateTemplateName = "FakeStringValue" + '@odata.type' = "#microsoft.graph.windows10PkcsCertificateProfile" + subjectNameFormatString = "FakeStringValue" + subjectNameFormat = "commonName" + certificateStore = "user" + extendedKeyUsages = @( + @{ + objectIdentifier = "FakeStringValue" + name = "FakeStringValue" + } + ) + customSubjectAlternativeNames = @( + @{ + sanType = "none" + name = "FakeStringValue" + } + ) + } + description = "FakeStringValue" + displayName = "FakeStringValue" + id = "FakeStringValue" + + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -135,42 +171,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - subjectAlternativeNameType = "none" - certificationAuthorityName = "FakeStringValue" - renewalThresholdPercentage = 25 - subjectAlternativeNameFormatString = "FakeStringValue" - certificateValidityPeriodScale = "days" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - certificationAuthority = "FakeStringValue" - certificateValidityPeriodValue = 25 - certificateTemplateName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windows10PkcsCertificateProfile" - subjectNameFormatString = "FakeStringValue" - subjectNameFormat = "commonName" - certificateStore = "user" - extendedKeyUsages = @( - @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - ) - customSubjectAlternativeNames = @( - @{ - sanType = "none" - name = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } It 'Should return Values from the Get method' { @@ -219,42 +219,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - subjectAlternativeNameType = "none" - certificationAuthorityName = "FakeStringValue" - renewalThresholdPercentage = 25 - subjectAlternativeNameFormatString = "FakeStringValue" - certificateValidityPeriodScale = "days" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - certificationAuthority = "FakeStringValue" - certificateValidityPeriodValue = 25 - certificateTemplateName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windows10PkcsCertificateProfile" - subjectNameFormatString = "FakeStringValue" - subjectNameFormat = "commonName" - certificateStore = "user" - extendedKeyUsages = @( - @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - ) - customSubjectAlternativeNames = @( - @{ - sanType = "none" - name = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } @@ -269,7 +233,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { CertificateStore = "user" CertificateTemplateName = "FakeStringValue" certificateValidityPeriodScale = "days" - certificateValidityPeriodValue = 25 + certificateValidityPeriodValue = 7 # Updated property CertificationAuthority = "FakeStringValue" CertificationAuthorityName = "FakeStringValue" customSubjectAlternativeNames = [CimInstance[]]@( @@ -296,41 +260,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - subjectAlternativeNameType = "none" - certificationAuthorityName = "FakeStringValue" - renewalThresholdPercentage = 7 - subjectAlternativeNameFormatString = "FakeStringValue" - certificateValidityPeriodScale = "days" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - certificationAuthority = "FakeStringValue" - certificateValidityPeriodValue = 7 - certificateTemplateName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windows10PkcsCertificateProfile" - subjectNameFormatString = "FakeStringValue" - subjectNameFormat = "commonName" - certificateStore = "user" - extendedKeyUsages = @( - @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - ) - customSubjectAlternativeNames = @( - @{ - sanType = "none" - name = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -354,43 +283,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - subjectAlternativeNameType = "none" - certificationAuthorityName = "FakeStringValue" - renewalThresholdPercentage = 25 - subjectAlternativeNameFormatString = "FakeStringValue" - certificateValidityPeriodScale = "days" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - certificationAuthority = "FakeStringValue" - certificateValidityPeriodValue = 25 - certificateTemplateName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windows10PkcsCertificateProfile" - subjectNameFormatString = "FakeStringValue" - subjectNameFormat = "commonName" - certificateStore = "user" - extendedKeyUsages = @( - @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - ) - customSubjectAlternativeNames = @( - @{ - sanType = "none" - name = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPlatformScriptMacOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPlatformScriptMacOS.Tests.ps1 index 70a949d4f6..2d28e25af1 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPlatformScriptMacOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPlatformScriptMacOS.Tests.ps1 @@ -49,6 +49,22 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceShellScript -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = "#microsoft.graph.DeviceShellScript" + } + BlockExecutionNotifications = $True + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + FileName = "FakeStringValue" + Id = "FakeStringValue" + RoleScopeTagIds = @("FakeStringValue") + RunAsAccount = "system" + ScriptContent = [byte[]]::new(5) + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -105,22 +121,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceShellScript -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.DeviceShellScript" - } - BlockExecutionNotifications = $True - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - FileName = "FakeStringValue" - Id = "FakeStringValue" - RoleScopeTagIds = @("FakeStringValue") - RunAsAccount = "system" - ScriptContent = [byte[]]::new(5) - } - } } It 'Should return Values from the Get method' { @@ -150,23 +150,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceShellScript -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.DeviceShellScript" - } - BlockExecutionNotifications = $True - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - FileName = "FakeStringValue" - Id = "FakeStringValue" - LastModifiedDateTime = "2023-01-01T00:00:00.0000000+01:00" - RoleScopeTagIds = @("FakeStringValue") - RunAsAccount = "system" - ScriptContent = [byte[]]::new(5) - } - } } @@ -184,26 +167,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { FileName = "FakeStringValue" Id = "FakeStringValue" RoleScopeTagIds = @("FakeStringValue") - RunAsAccount = "system" + RunAsAccount = "user" # Updated property ScriptContent = "AAAAAAA=" Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceShellScript -MockWith { - return @{ - CreatedDateTime = "2023-01-01T00:00:00.0000000+01:00" - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - FileName = "FakeStringValue" - Id = "FakeStringValue" - LastModifiedDateTime = "2023-01-01T00:00:00.0000000+01:00" - RetryCount = 7 - RoleScopeTagIds = @("FakeStringValue") - RunAsAccount = "system" - ScriptContent = [byte[]]::new(5) - } - } } It 'Should return Values from the Get method' { @@ -227,23 +195,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceShellScript -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.DeviceShellScript" - } - BlockExecutionNotifications = $True - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - FileName = "FakeStringValue" - Id = "FakeStringValue" - RoleScopeTagIds = @("FakeStringValue") - RunAsAccount = "system" - ScriptContent = [byte[]]::new(5) - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPlatformScriptWindows.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPlatformScriptWindows.Tests.ps1 index 817b028911..1a715d1a97 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPlatformScriptWindows.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPlatformScriptWindows.Tests.ps1 @@ -49,6 +49,23 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementScript -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = "#microsoft.graph.DeviceManagementScript" + } + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + EnforceSignatureCheck = $True + FileName = "FakeStringValue" + Id = "FakeStringValue" + RoleScopeTagIds = @("FakeStringValue") + RunAs32Bit = $True + RunAsAccount = "system" + ScriptContent = [byte[]]::new(5) + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -107,23 +124,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementScript -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.DeviceManagementScript" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - EnforceSignatureCheck = $True - FileName = "FakeStringValue" - Id = "FakeStringValue" - RoleScopeTagIds = @("FakeStringValue") - RunAs32Bit = $True - RunAsAccount = "system" - ScriptContent = [byte[]]::new(5) - } - } } It 'Should return Values from the Get method' { @@ -154,23 +154,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementScript -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.DeviceManagementScript" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - EnforceSignatureCheck = $True - FileName = "FakeStringValue" - Id = "FakeStringValue" - RoleScopeTagIds = @("FakeStringValue") - RunAs32Bit = $True - RunAsAccount = "system" - ScriptContent = [byte[]]::new(5) - } - } } @@ -189,23 +172,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Id = "FakeStringValue" RoleScopeTagIds = @("FakeStringValue") RunAs32Bit = $True - RunAsAccount = "system" + RunAsAccount = "user" # Updated property ScriptContent = "AAAAAAA=" Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementScript -MockWith { - return @{ - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - FileName = "FakeStringValue" - Id = "FakeStringValue" - RoleScopeTagIds = @("FakeStringValue") - RunAsAccount = "system" - ScriptContent = [byte[]]::new(5) - } - } } It 'Should return Values from the Get method' { @@ -229,26 +200,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementScript -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.DeviceManagementScript" - } - CreatedDateTime = "2023-01-01T00:00:00.0000000+01:00" - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - EnforceSignatureCheck = $True - FileName = "FakeStringValue" - Id = "FakeStringValue" - LastModifiedDateTime = "2023-01-01T00:00:00.0000000+01:00" - RoleScopeTagIds = @("FakeStringValue") - RunAs32Bit = $True - RunAsAccount = "system" - ScriptContent = [byte[]]::new(5) - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidOpenSourceProject.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidOpenSourceProject.Tests.ps1 index 656deff570..832c25b337 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidOpenSourceProject.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidOpenSourceProject.Tests.ps1 @@ -24,7 +24,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $secpasswd = ConvertTo-SecureString (New-Guid | Out-String) -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin@mydomain.com', $secpasswd) - Mock -CommandName Confirm-M365DSCDependencies -MockWith { } @@ -43,6 +42,31 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + ScreenCaptureBlocked = $True + PasswordMinimumLength = 25 + BluetoothBlocked = $True + '@odata.type' = '#microsoft.graph.aospDeviceOwnerDeviceConfiguration' + AppsBlockInstallFromUnknownSources = $True + FactoryResetBlocked = $True + CameraBlocked = $True + PasswordRequiredType = 'deviceDefault' + PasswordMinutesOfInactivityBeforeScreenTimeout = 25 + StorageBlockUsbFileTransfer = $True + WifiBlockEditConfigurations = $True + PasswordSignInFailureCountBeforeFactoryReset = 25 + SecurityAllowDebuggingFeatures = $True + StorageBlockExternalMedia = $True + BluetoothBlockConfiguration = $True + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + } + } + Mock -CommandName New-M365DSCConnection -MockWith { return 'Credentials' } @@ -76,7 +100,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { StorageBlockExternalMedia = $True StorageBlockUsbFileTransfer = $True WifiBlockEditConfigurations = $True - Ensure = 'Present' Credential = $Credential } @@ -117,37 +140,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { StorageBlockExternalMedia = $True StorageBlockUsbFileTransfer = $True WifiBlockEditConfigurations = $True - Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ScreenCaptureBlocked = $True - PasswordMinimumLength = 25 - BluetoothBlocked = $True - '@odata.type' = '#microsoft.graph.' - AppsBlockInstallFromUnknownSources = $True - FactoryResetBlocked = $True - CameraBlocked = $True - PasswordRequiredType = 'deviceDefault' - PasswordMinutesOfInactivityBeforeScreenTimeout = 25 - StorageBlockUsbFileTransfer = $True - WifiBlockEditConfigurations = $True - PasswordSignInFailureCountBeforeFactoryReset = 25 - SecurityAllowDebuggingFeatures = $True - StorageBlockExternalMedia = $True - BluetoothBlockConfiguration = $True - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -183,36 +178,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { StorageBlockExternalMedia = $True StorageBlockUsbFileTransfer = $True WifiBlockEditConfigurations = $True - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ScreenCaptureBlocked = $True - PasswordMinimumLength = 25 - BluetoothBlocked = $True - '@odata.type' = '#microsoft.graph.' - AppsBlockInstallFromUnknownSources = $True - FactoryResetBlocked = $True - CameraBlocked = $True - PasswordRequiredType = 'deviceDefault' - PasswordMinutesOfInactivityBeforeScreenTimeout = 25 - StorageBlockUsbFileTransfer = $True - WifiBlockEditConfigurations = $True - PasswordSignInFailureCountBeforeFactoryReset = 25 - SecurityAllowDebuggingFeatures = $True - StorageBlockExternalMedia = $True - BluetoothBlockConfiguration = $True - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return true from the Test method' { @@ -231,7 +199,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = 'FakeStringValue' FactoryResetBlocked = $True Id = 'FakeStringValue' - PasswordMinimumLength = 25 + PasswordMinimumLength = 7 # Updated property PasswordMinutesOfInactivityBeforeScreenTimeout = 25 PasswordRequiredType = 'deviceDefault' PasswordSignInFailureCountBeforeFactoryReset = 25 @@ -240,27 +208,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { StorageBlockExternalMedia = $True StorageBlockUsbFileTransfer = $True WifiBlockEditConfigurations = $True - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - PasswordMinimumLength = 7 - PasswordRequiredType = 'deviceDefault' - PasswordSignInFailureCountBeforeFactoryReset = 7 - PasswordMinutesOfInactivityBeforeScreenTimeout = 7 - '@odata.type' = '#microsoft.graph.' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -284,33 +234,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ScreenCaptureBlocked = $True - PasswordMinimumLength = 25 - BluetoothBlocked = $True - '@odata.type' = '#microsoft.graph.aospDeviceOwnerDeviceConfiguration' - AppsBlockInstallFromUnknownSources = $True - FactoryResetBlocked = $True - CameraBlocked = $True - PasswordRequiredType = 'deviceDefault' - PasswordMinutesOfInactivityBeforeScreenTimeout = 25 - StorageBlockUsbFileTransfer = $True - WifiBlockEditConfigurations = $True - PasswordSignInFailureCountBeforeFactoryReset = 25 - SecurityAllowDebuggingFeatures = $True - StorageBlockExternalMedia = $True - BluetoothBlockConfiguration = $True - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidWorkProfile.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidWorkProfile.Tests.ps1 index aaf7ff48ff..b066a7a224 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidWorkProfile.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyAndroidWorkProfile.Tests.ps1 @@ -41,6 +41,51 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + id = '12345-12345-12345-12345-12345' + displayName = 'Android Work Profile - Device Restrictions - Standard' + description = 'Android device configuration policy' + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.androidWorkProfileGeneralDeviceConfiguration' + passwordBlockFingerprintUnlock = $False + passwordBlockTrustAgents = $False + passwordExpirationDays = 10 + passwordMinimumLength = 8 + passwordMinutesOfInactivityBeforeScreenTimeout = 3 + passwordPreviousPasswordBlockCount = 3 + passwordSignInFailureCountBeforeFactoryReset = 10 + passwordRequiredType = 'deviceDefault' + workProfileDataSharingType = 'deviceDefault' + workProfileBlockNotificationsWhileDeviceLocked = $False + workProfileBlockAddingAccounts = $False + workProfileBluetoothEnableContactSharing = $False + workProfileBlockScreenCapture = $False + workProfileBlockCrossProfileCallerId = $False + workProfileBlockCamera = $False + workProfileBlockCrossProfileContactsSearch = $False + workProfileBlockCrossProfileCopyPaste = $False + workProfileDefaultAppPermissionPolicy = 'deviceDefault' + workProfilePasswordBlockFingerprintUnlock = $False + workProfilePasswordBlockTrustAgents = $False + workProfilePasswordExpirationDays = 90 + workProfilePasswordMinimumLength = 4 + workProfilePasswordMinNumericCharacters = 3 + workProfilePasswordMinNonLetterCharacters = 3 + workProfilePasswordMinLetterCharacters = 3 + workProfilePasswordMinLowerCaseCharacters = 3 + workProfilePasswordMinUpperCaseCharacters = 3 + workProfilePasswordMinSymbolCharacters = 3 + workProfilePasswordMinutesOfInactivityBeforeScreenTimeout = 3 + workProfilePasswordPreviousPasswordBlockCount = 3 + workProfilePasswordSignInFailureCountBeforeFactoryReset = 3 + workProfilePasswordRequiredType = 'deviceDefault' + workProfileRequirePassword = $False + securityRequireVerifyApps = $False + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { return @() } @@ -126,7 +171,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { passwordExpirationDays = 10 passwordMinimumLength = 8 passwordMinutesOfInactivityBeforeScreenTimeout = 3 - passwordPreviousPasswordBlockCount = 3 + passwordPreviousPasswordBlockCount = 2 # Updated property passwordSignInFailureCountBeforeFactoryReset = 10 passwordRequiredType = 'deviceDefault' workProfileDataSharingType = 'deviceDefault' @@ -158,51 +203,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - id = '12345-12345-12345-12345-12345' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileGeneralDeviceConfiguration' - } - description = 'Android device configuration policy' - displayName = 'Android Work Profile - Device Restrictions - Standard' - passwordBlockFingerprintUnlock = $False - passwordBlockTrustAgents = $True; #drift - passwordExpirationDays = 10 - passwordMinimumLength = 8 - passwordMinutesOfInactivityBeforeScreenTimeout = 3 - passwordPreviousPasswordBlockCount = 3 - passwordSignInFailureCountBeforeFactoryReset = 10 - passwordRequiredType = 'deviceDefault' - workProfileDataSharingType = 'deviceDefault' - workProfileBlockNotificationsWhileDeviceLocked = $False - workProfileBlockAddingAccounts = $False - workProfileBluetoothEnableContactSharing = $False - workProfileBlockScreenCapture = $False - workProfileBlockCrossProfileCallerId = $False - workProfileBlockCamera = $False - workProfileBlockCrossProfileContactsSearch = $False - workProfileBlockCrossProfileCopyPaste = $False - workProfileDefaultAppPermissionPolicy = 'deviceDefault' - workProfilePasswordBlockFingerprintUnlock = $False - workProfilePasswordBlockTrustAgents = $False - workProfilePasswordExpirationDays = 90 - workProfilePasswordMinimumLength = 4 - workProfilePasswordMinNumericCharacters = 3 - workProfilePasswordMinNonLetterCharacters = 3 - workProfilePasswordMinLetterCharacters = 3 - workProfilePasswordMinLowerCaseCharacters = 3 - workProfilePasswordMinUpperCaseCharacters = 3 - workProfilePasswordMinSymbolCharacters = 3 - workProfilePasswordMinutesOfInactivityBeforeScreenTimeout = 3 - workProfilePasswordPreviousPasswordBlockCount = 3 - workProfilePasswordSignInFailureCountBeforeFactoryReset = 3 - workProfilePasswordRequiredType = 'deviceDefault' - workProfileRequirePassword = $False - securityRequireVerifyApps = $False - } - } } It 'Should return Present from the Get method' { @@ -221,7 +221,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'When the policy already exists and IS in the Desired State' -Fixture { BeforeAll { - $TestParams = @{ description = 'Android device configuration policy' displayName = 'Android Work Profile - Device Restrictions - Standard' @@ -262,51 +261,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - id = '12345-12345-12345-12345-12345' - displayName = 'Android Work Profile - Device Restrictions - Standard' - description = 'Android device configuration policy' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileGeneralDeviceConfiguration' - passwordBlockFingerprintUnlock = $False - passwordBlockTrustAgents = $False - passwordExpirationDays = 10 - passwordMinimumLength = 8 - passwordMinutesOfInactivityBeforeScreenTimeout = 3 - passwordPreviousPasswordBlockCount = 3 - passwordSignInFailureCountBeforeFactoryReset = 10 - passwordRequiredType = 'deviceDefault' - workProfileDataSharingType = 'deviceDefault' - workProfileBlockNotificationsWhileDeviceLocked = $False - workProfileBlockAddingAccounts = $False - workProfileBluetoothEnableContactSharing = $False - workProfileBlockScreenCapture = $False - workProfileBlockCrossProfileCallerId = $False - workProfileBlockCamera = $False - workProfileBlockCrossProfileContactsSearch = $False - workProfileBlockCrossProfileCopyPaste = $False - workProfileDefaultAppPermissionPolicy = 'deviceDefault' - workProfilePasswordBlockFingerprintUnlock = $False - workProfilePasswordBlockTrustAgents = $False - workProfilePasswordExpirationDays = 90 - workProfilePasswordMinimumLength = 4 - workProfilePasswordMinNumericCharacters = 3 - workProfilePasswordMinNonLetterCharacters = 3 - workProfilePasswordMinLetterCharacters = 3 - workProfilePasswordMinLowerCaseCharacters = 3 - workProfilePasswordMinUpperCaseCharacters = 3 - workProfilePasswordMinSymbolCharacters = 3 - workProfilePasswordMinutesOfInactivityBeforeScreenTimeout = 3 - workProfilePasswordPreviousPasswordBlockCount = 3 - workProfilePasswordSignInFailureCountBeforeFactoryReset = 3 - workProfilePasswordRequiredType = 'deviceDefault' - workProfileRequirePassword = $False - securityRequireVerifyApps = $False - } - } - } } It 'Should return true from the Test method' { @@ -321,51 +275,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - id = '12345-12345-12345-12345-12345' - displayName = 'Android Work Profile - Device Restrictions - Standard' - description = 'Android device configuration policy' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileGeneralDeviceConfiguration' - passwordBlockFingerprintUnlock = $False - passwordBlockTrustAgents = $False - passwordExpirationDays = 10 - passwordMinimumLength = 8 - passwordMinutesOfInactivityBeforeScreenTimeout = 3 - passwordPreviousPasswordBlockCount = 3 - passwordSignInFailureCountBeforeFactoryReset = 10 - passwordRequiredType = 'deviceDefault' - workProfileDataSharingType = 'deviceDefault' - workProfileBlockNotificationsWhileDeviceLocked = $False - workProfileBlockAddingAccounts = $False - workProfileBluetoothEnableContactSharing = $False - workProfileBlockScreenCapture = $False - workProfileBlockCrossProfileCallerId = $False - workProfileBlockCamera = $False - workProfileBlockCrossProfileContactsSearch = $False - workProfileBlockCrossProfileCopyPaste = $False - workProfileDefaultAppPermissionPolicy = 'deviceDefault' - workProfilePasswordBlockFingerprintUnlock = $False - workProfilePasswordBlockTrustAgents = $False - workProfilePasswordExpirationDays = 90 - workProfilePasswordMinimumLength = 4 - workProfilePasswordMinNumericCharacters = 3 - workProfilePasswordMinNonLetterCharacters = 3 - workProfilePasswordMinLetterCharacters = 3 - workProfilePasswordMinLowerCaseCharacters = 3 - workProfilePasswordMinUpperCaseCharacters = 3 - workProfilePasswordMinSymbolCharacters = 3 - workProfilePasswordMinutesOfInactivityBeforeScreenTimeout = 3 - workProfilePasswordPreviousPasswordBlockCount = 3 - workProfilePasswordSignInFailureCountBeforeFactoryReset = 3 - workProfilePasswordRequiredType = 'deviceDefault' - workProfileRequirePassword = $False - securityRequireVerifyApps = $False - } - } - } } It 'Should return Present from the Get method' { @@ -389,51 +298,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - id = '12345-12345-12345-12345-12345' - displayName = 'Android Work Profile - Device Restrictions - Standard' - description = 'Android device configuration policy' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileGeneralDeviceConfiguration' - passwordBlockFingerprintUnlock = $False - passwordBlockTrustAgents = $False - passwordExpirationDays = 10 - passwordMinimumLength = 8 - passwordMinutesOfInactivityBeforeScreenTimeout = 3 - passwordPreviousPasswordBlockCount = 3 - passwordSignInFailureCountBeforeFactoryReset = 10 - passwordRequiredType = 'deviceDefault' - workProfileDataSharingType = 'deviceDefault' - workProfileBlockNotificationsWhileDeviceLocked = $False - workProfileBlockAddingAccounts = $False - workProfileBluetoothEnableContactSharing = $False - workProfileBlockScreenCapture = $False - workProfileBlockCrossProfileCallerId = $False - workProfileBlockCamera = $False - workProfileBlockCrossProfileContactsSearch = $False - workProfileBlockCrossProfileCopyPaste = $False - workProfileDefaultAppPermissionPolicy = 'deviceDefault' - workProfilePasswordBlockFingerprintUnlock = $False - workProfilePasswordBlockTrustAgents = $False - workProfilePasswordExpirationDays = 90 - workProfilePasswordMinimumLength = 4 - workProfilePasswordMinNumericCharacters = 3 - workProfilePasswordMinNonLetterCharacters = 3 - workProfilePasswordMinLetterCharacters = 3 - workProfilePasswordMinLowerCaseCharacters = 3 - workProfilePasswordMinUpperCaseCharacters = 3 - workProfilePasswordMinSymbolCharacters = 3 - workProfilePasswordMinutesOfInactivityBeforeScreenTimeout = 3 - workProfilePasswordPreviousPasswordBlockCount = 3 - workProfilePasswordSignInFailureCountBeforeFactoryReset = 3 - workProfilePasswordRequiredType = 'deviceDefault' - workProfileRequirePassword = $False - securityRequireVerifyApps = $False - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyMacOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyMacOS.Tests.ps1 index 9112538c24..32db0e78cf 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyMacOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyMacOS.Tests.ps1 @@ -46,6 +46,73 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName New-M365DSCConnection -MockWith { return 'Credentials' } + + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.macosGeneralDeviceConfiguration' + TouchIdTimeoutInHours = 25 + AirDropBlocked = $True + ClassroomAppForceUnpromptedScreenObservation = $True + KeychainBlockCloudSync = $True + AppleWatchBlockAutoUnlock = $True + ScreenCaptureBlocked = $True + MultiplayerGamingBlocked = $True + WallpaperModificationBlocked = $True + CameraBlocked = $True + ICloudBlockActivityContinuation = $True + SpotlightBlockInternetResults = $True + SafariBlockAutofill = $True + PasswordBlockAutoFill = $True + PasswordRequiredType = 'deviceDefault' + PasswordMaximumAttemptCount = 25 + ClassroomForceAutomaticallyJoinClasses = $True + ICloudPrivateRelayBlocked = $True + PasswordBlockModification = $True + ICloudBlockCalendar = $True + ICloudBlockAddressBook = $True + SoftwareUpdatesEnforcedDelayInDays = 25 + ICloudBlockReminders = $True + PasswordBlockSimple = $True + PasswordBlockAirDropSharing = $True + ICloudBlockBookmarks = $True + PasswordRequired = $True + KeyboardBlockDictation = $True + SoftwareUpdateMajorOSDeferredInstallDelayInDays = 25 + ContentCachingBlocked = $True + ICloudDesktopAndDocumentsBlocked = $True + UpdateDelayPolicy = 'delayMajorOsUpdateVisibility' + PasswordPreviousPasswordBlockCount = 25 + AddingGameCenterFriendsBlocked = $True + PasswordMinimumLength = 25 + EraseContentAndSettingsBlocked = $True + ICloudBlockNotes = $True + ICloudBlockPhotoLibrary = $True + ICloudBlockMail = $True + PasswordMinutesOfInactivityBeforeScreenTimeout = 25 + PasswordExpirationDays = 25 + PasswordBlockFingerprintUnlock = $True + PasswordBlockProximityRequests = $True + SoftwareUpdateNonOSDeferredInstallDelayInDays = 25 + ITunesBlockMusicService = $True + DefinitionLookupBlocked = $True + ClassroomForceRequestPermissionToLeaveClasses = $True + ClassroomAppBlockRemoteScreenObservation = $True + SoftwareUpdateMinorOSDeferredInstallDelayInDays = 25 + ITunesBlockFileSharing = $True + GameCenterBlocked = $True + ICloudBlockDocumentSync = $True + PasswordMinimumCharacterSetCount = 25 + PasswordMinutesOfInactivityBeforeLock = 25 + ClassroomForceUnpromptedAppAndDeviceLock = $True + PasswordMinutesUntilFailedLoginReset = 25 + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + } + } + Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } # Mock Write-M365DSCHost to hide output during the tests @@ -117,7 +184,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PasswordMinutesOfInactivityBeforeLock = 25 ClassroomForceUnpromptedAppAndDeviceLock = $True PasswordMinutesUntilFailedLoginReset = 25 - Ensure = 'Present' Credential = $Credential } @@ -200,75 +266,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PasswordMinutesOfInactivityBeforeLock = 25 ClassroomForceUnpromptedAppAndDeviceLock = $True PasswordMinutesUntilFailedLoginReset = 25 - Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{'@odata.type' = '#microsoft.graph.macosGeneralDeviceConfiguration' } - TouchIdTimeoutInHours = 25 - Description = 'FakeStringValue' - AirDropBlocked = $True - ClassroomAppForceUnpromptedScreenObservation = $True - KeychainBlockCloudSync = $True - DisplayName = 'FakeStringValue' - AppleWatchBlockAutoUnlock = $True - ScreenCaptureBlocked = $True - MultiplayerGamingBlocked = $True - WallpaperModificationBlocked = $True - CameraBlocked = $True - ICloudBlockActivityContinuation = $True - SpotlightBlockInternetResults = $True - SafariBlockAutofill = $True - PasswordBlockAutoFill = $True - PasswordRequiredType = 'deviceDefault' - PasswordMaximumAttemptCount = 25 - ClassroomForceAutomaticallyJoinClasses = $True - ICloudPrivateRelayBlocked = $True - PasswordBlockModification = $True - ICloudBlockCalendar = $True - ICloudBlockAddressBook = $True - SoftwareUpdatesEnforcedDelayInDays = 25 - ICloudBlockReminders = $True - PasswordBlockSimple = $True - PasswordBlockAirDropSharing = $True - ICloudBlockBookmarks = $True - PasswordRequired = $True - KeyboardBlockDictation = $True - SoftwareUpdateMajorOSDeferredInstallDelayInDays = 25 - ContentCachingBlocked = $True - ICloudDesktopAndDocumentsBlocked = $True - UpdateDelayPolicy = 'delayMajorOsUpdateVisibility' - PasswordPreviousPasswordBlockCount = 25 - AddingGameCenterFriendsBlocked = $True - Id = 'FakeStringValue' - PasswordMinimumLength = 25 - EraseContentAndSettingsBlocked = $True - ICloudBlockNotes = $True - ICloudBlockPhotoLibrary = $True - ICloudBlockMail = $True - PasswordMinutesOfInactivityBeforeScreenTimeout = 25 - PasswordExpirationDays = 25 - PasswordBlockFingerprintUnlock = $True - PasswordBlockProximityRequests = $True - SoftwareUpdateNonOSDeferredInstallDelayInDays = 25 - ITunesBlockMusicService = $True - DefinitionLookupBlocked = $True - ClassroomForceRequestPermissionToLeaveClasses = $True - ClassroomAppBlockRemoteScreenObservation = $True - SoftwareUpdateMinorOSDeferredInstallDelayInDays = 25 - ITunesBlockFileSharing = $True - GameCenterBlocked = $True - ICloudBlockDocumentSync = $True - PasswordMinimumCharacterSetCount = 25 - PasswordMinutesOfInactivityBeforeLock = 25 - ClassroomForceUnpromptedAppAndDeviceLock = $True - PasswordMinutesUntilFailedLoginReset = 25 - - } - } } It 'Should return Values from the Get method' { @@ -346,83 +346,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PasswordMinutesOfInactivityBeforeLock = 25 ClassroomForceUnpromptedAppAndDeviceLock = $True PasswordMinutesUntilFailedLoginReset = 25 - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - Id = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - Credential = $Credential - Ensure = 'Present' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosGeneralDeviceConfiguration' - TouchIdTimeoutInHours = 25 - AirDropBlocked = $True - ClassroomAppForceUnpromptedScreenObservation = $True - KeychainBlockCloudSync = $True - AppleWatchBlockAutoUnlock = $True - ScreenCaptureBlocked = $True - MultiplayerGamingBlocked = $True - WallpaperModificationBlocked = $True - CameraBlocked = $True - ICloudBlockActivityContinuation = $True - SpotlightBlockInternetResults = $True - SafariBlockAutofill = $True - PasswordBlockAutoFill = $True - PasswordRequiredType = 'deviceDefault' - PasswordMaximumAttemptCount = 25 - ClassroomForceAutomaticallyJoinClasses = $True - ICloudPrivateRelayBlocked = $True - PasswordBlockModification = $True - ICloudBlockCalendar = $True - ICloudBlockAddressBook = $True - SoftwareUpdatesEnforcedDelayInDays = 25 - ICloudBlockReminders = $True - PasswordBlockSimple = $True - PasswordBlockAirDropSharing = $True - ICloudBlockBookmarks = $True - PasswordRequired = $True - KeyboardBlockDictation = $True - SoftwareUpdateMajorOSDeferredInstallDelayInDays = 25 - ContentCachingBlocked = $True - ICloudDesktopAndDocumentsBlocked = $True - UpdateDelayPolicy = 'delayMajorOsUpdateVisibility' - PasswordPreviousPasswordBlockCount = 25 - AddingGameCenterFriendsBlocked = $True - PasswordMinimumLength = 25 - EraseContentAndSettingsBlocked = $True - ICloudBlockNotes = $True - ICloudBlockPhotoLibrary = $True - ICloudBlockMail = $True - PasswordMinutesOfInactivityBeforeScreenTimeout = 25 - PasswordExpirationDays = 25 - PasswordBlockFingerprintUnlock = $True - PasswordBlockProximityRequests = $True - SoftwareUpdateNonOSDeferredInstallDelayInDays = 25 - ITunesBlockMusicService = $True - DefinitionLookupBlocked = $True - ClassroomForceRequestPermissionToLeaveClasses = $True - ClassroomAppBlockRemoteScreenObservation = $True - SoftwareUpdateMinorOSDeferredInstallDelayInDays = 25 - ITunesBlockFileSharing = $True - GameCenterBlocked = $True - ICloudBlockDocumentSync = $True - PasswordMinimumCharacterSetCount = 25 - PasswordMinutesOfInactivityBeforeLock = 25 - ClassroomForceUnpromptedAppAndDeviceLock = $True - PasswordMinutesUntilFailedLoginReset = 25 - } - } - } } - #It "Should return Values from the Get method" { - #Get-TargetResource @testParams - #} + It 'Should return Values from the Get method' { + (Get-TargetResource @testParams).Ensure | Should -Be 'Present' + } It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true @@ -432,7 +363,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'The IntuneDeviceConfigurationPolicyMacOS exists and values are NOT in the desired state' -Fixture { BeforeAll { $testParams = @{ - TouchIdTimeoutInHours = 25 + TouchIdTimeoutInHours = 7 # Updated property Description = 'FakeStringValue' AirDropBlocked = $True ClassroomAppForceUnpromptedScreenObservation = $True @@ -490,77 +421,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PasswordMinutesOfInactivityBeforeLock = 25 ClassroomForceUnpromptedAppAndDeviceLock = $True PasswordMinutesUntilFailedLoginReset = 25 - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - Id = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosGeneralDeviceConfiguration' - } - TouchIdTimeoutInHours = 7 - AirDropBlocked = $False - ClassroomAppForceUnpromptedScreenObservation = $False - KeychainBlockCloudSync = $False - AppleWatchBlockAutoUnlock = $False - ScreenCaptureBlocked = $False - MultiplayerGamingBlocked = $False - WallpaperModificationBlocked = $False - CameraBlocked = $False - ICloudBlockActivityContinuation = $False - SpotlightBlockInternetResults = $False - SafariBlockAutofill = $False - PasswordBlockAutoFill = $False - PasswordRequiredType = 'deviceDefault' - PasswordMaximumAttemptCount = 7 - ClassroomForceAutomaticallyJoinClasses = $False - ICloudPrivateRelayBlocked = $False - PasswordBlockModification = $False - ICloudBlockCalendar = $False - ICloudBlockAddressBook = $False - SoftwareUpdatesEnforcedDelayInDays = 7 - ICloudBlockReminders = $False - PasswordBlockSimple = $False - PasswordBlockAirDropSharing = $False - ICloudBlockBookmarks = $False - PasswordRequired = $False - KeyboardBlockDictation = $False - SoftwareUpdateMajorOSDeferredInstallDelayInDays = 7 - ContentCachingBlocked = $False - ICloudDesktopAndDocumentsBlocked = $False - UpdateDelayPolicy = 'delayMajorOsUpdateVisibility' - PasswordPreviousPasswordBlockCount = 7 - AddingGameCenterFriendsBlocked = $False - PasswordMinimumLength = 7 - EraseContentAndSettingsBlocked = $False - ICloudBlockNotes = $False - ICloudBlockPhotoLibrary = $False - ICloudBlockMail = $False - PasswordMinutesOfInactivityBeforeScreenTimeout = 7 - PasswordExpirationDays = 7 - PasswordBlockFingerprintUnlock = $False - PasswordBlockProximityRequests = $False - SoftwareUpdateNonOSDeferredInstallDelayInDays = 7 - ITunesBlockMusicService = $False - DefinitionLookupBlocked = $False - ClassroomForceRequestPermissionToLeaveClasses = $False - ClassroomAppBlockRemoteScreenObservation = $False - SoftwareUpdateMinorOSDeferredInstallDelayInDays = 7 - ITunesBlockFileSharing = $False - GameCenterBlocked = $False - ICloudBlockDocumentSync = $False - PasswordMinimumCharacterSetCount = 7 - PasswordMinutesOfInactivityBeforeLock = 7 - ClassroomForceUnpromptedAppAndDeviceLock = $False - PasswordMinutesUntilFailedLoginReset = 7 - - } - } } It 'Should return Values from the Get method' { @@ -584,72 +447,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{'@odata.type' = '#microsoft.graph.macosGeneralDeviceConfiguration' } - TouchIdTimeoutInHours = 25 - Description = 'FakeStringValue' - AirDropBlocked = $True - ClassroomAppForceUnpromptedScreenObservation = $True - KeychainBlockCloudSync = $True - DisplayName = 'FakeStringValue' - AppleWatchBlockAutoUnlock = $True - ScreenCaptureBlocked = $True - MultiplayerGamingBlocked = $True - WallpaperModificationBlocked = $True - CameraBlocked = $True - ICloudBlockActivityContinuation = $True - SpotlightBlockInternetResults = $True - SafariBlockAutofill = $True - PasswordBlockAutoFill = $True - PasswordRequiredType = 'deviceDefault' - PasswordMaximumAttemptCount = 25 - ClassroomForceAutomaticallyJoinClasses = $True - ICloudPrivateRelayBlocked = $True - PasswordBlockModification = $True - ICloudBlockCalendar = $True - ICloudBlockAddressBook = $True - SoftwareUpdatesEnforcedDelayInDays = 25 - ICloudBlockReminders = $True - PasswordBlockSimple = $True - PasswordBlockAirDropSharing = $True - ICloudBlockBookmarks = $True - PasswordRequired = $True - KeyboardBlockDictation = $True - SoftwareUpdateMajorOSDeferredInstallDelayInDays = 25 - ContentCachingBlocked = $True - ICloudDesktopAndDocumentsBlocked = $True - UpdateDelayPolicy = 'delayMajorOsUpdateVisibility' - PasswordPreviousPasswordBlockCount = 25 - AddingGameCenterFriendsBlocked = $True - Id = 'FakeStringValue' - PasswordMinimumLength = 25 - EraseContentAndSettingsBlocked = $True - ICloudBlockNotes = $True - ICloudBlockPhotoLibrary = $True - ICloudBlockMail = $True - PasswordMinutesOfInactivityBeforeScreenTimeout = 25 - PasswordExpirationDays = 25 - PasswordBlockFingerprintUnlock = $True - PasswordBlockProximityRequests = $True - SoftwareUpdateNonOSDeferredInstallDelayInDays = 25 - ITunesBlockMusicService = $True - DefinitionLookupBlocked = $True - ClassroomForceRequestPermissionToLeaveClasses = $True - ClassroomAppBlockRemoteScreenObservation = $True - SoftwareUpdateMinorOSDeferredInstallDelayInDays = 25 - ITunesBlockFileSharing = $True - GameCenterBlocked = $True - ICloudBlockDocumentSync = $True - PasswordMinimumCharacterSetCount = 25 - PasswordMinutesOfInactivityBeforeLock = 25 - ClassroomForceUnpromptedAppAndDeviceLock = $True - PasswordMinutesUntilFailedLoginReset = 25 - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyWindows10.Tests.ps1 index ce29e5e6f7..5f6b8fec7b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyWindows10.Tests.ps1 @@ -334,7 +334,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { storageRequireMobileDeviceEncryption = $True storageRestrictAppDataToSystemVolume = $True storageRestrictAppInstallToSystemVolume = $True - supportsScopeTags = $True systemTelemetryProxyServer = 'FakeStringValue' taskManagerBlockEndTask = $True tenantLockdownRequireNetworkDuringOutOfBoxExperience = $True @@ -663,7 +662,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { storageRequireMobileDeviceEncryption = $True storageRestrictAppDataToSystemVolume = $True storageRestrictAppInstallToSystemVolume = $True - supportsScopeTags = $True systemTelemetryProxyServer = 'FakeStringValue' taskManagerBlockEndTask = $True tenantLockdownRequireNetworkDuringOutOfBoxExperience = $True @@ -1008,8 +1006,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { description = 'FakeStringValue' displayName = 'FakeStringValue' id = 'FakeStringValue' - supportsScopeTags = $True - } } } @@ -1305,7 +1301,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { storageRequireMobileDeviceEncryption = $True storageRestrictAppDataToSystemVolume = $True storageRestrictAppInstallToSystemVolume = $True - supportsScopeTags = $True systemTelemetryProxyServer = 'FakeStringValue' taskManagerBlockEndTask = $True tenantLockdownRequireNetworkDuringOutOfBoxExperience = $True @@ -1650,8 +1645,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { description = 'FakeStringValue' displayName = 'FakeStringValue' id = 'FakeStringValue' - supportsScopeTags = $True - } } } @@ -1940,7 +1933,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { storageRequireMobileDeviceEncryption = $True storageRestrictAppDataToSystemVolume = $True storageRestrictAppInstallToSystemVolume = $True - supportsScopeTags = $True systemTelemetryProxyServer = 'FakeStringValue' taskManagerBlockEndTask = $True tenantLockdownRequireNetworkDuringOutOfBoxExperience = $True @@ -2439,8 +2431,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { description = 'FakeStringValue' displayName = 'FakeStringValue' id = 'FakeStringValue' - supportsScopeTags = $True - } } } diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyiOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyiOS.Tests.ps1 index fd77b47ae0..f570a5c86a 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyiOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationPolicyiOS.Tests.ps1 @@ -48,6 +48,261 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + FaceTimeBlocked = $True + KioskModeAllowSleepButton = $True + MediaContentRatingCanada = @{ + movieRating = 'allAllowed' + tvRating = 'allAllowed' + } + UnpairedExternalBootToRecoveryAllowed = $True + ICloudBlockPhotoStreamSync = $True + KeyboardBlockPredictive = $True + SafariBlockPopups = $True + GameCenterBlocked = $True + PasscodeBlockSimple = $True + ITunesBlocked = $True + PasscodeMinimumCharacterSetCount = 25 + AppleWatchForceWristDetection = $True + PasscodeExpirationDays = 25 + EnterpriseAppBlockTrustModification = $True + AirPlayForcePairingPasswordForOutgoingRequests = $True + KeyboardBlockAutoCorrect = $True + ITunesBlockExplicitContent = $True + IBooksStoreBlockErotica = $True + KioskModeAllowRingerSwitch = $True + DocumentsBlockUnmanagedDocumentsInManagedApps = $True + MessagesBlocked = $True + DeviceBlockEnableRestrictions = $True + AppStoreBlocked = $True + SpotlightBlockInternetResults = $True + KioskModeAppType = 'notConfigured' + KioskModeAllowVolumeButtons = $True + VoiceDialingBlocked = $True + PasscodeMinimumLength = 25 + ICloudBlockSharedPhotoStream = $True + ActivationLockAllowWhenSupervised = $True + CellularBlockVoiceRoaming = $True + MediaContentRatingIreland = @{ + movieRating = 'allAllowed' + tvRating = 'allAllowed' + } + PkiBlockOTAUpdates = $True + KeyboardBlockDictation = $True + PasscodeBlockModification = $True + AutoUnlockBlocked = $True + PasswordBlockProximityRequests = $True + MediaContentRatingAustralia = @{ + movieRating = 'allAllowed' + tvRating = 'allAllowed' + } + ITunesBlockMusicService = $True + DiagnosticDataBlockSubmissionModification = $True + EnterpriseAppBlockTrust = $True + ManagedPasteboardRequired = $True + ProximityBlockSetupToNewDevice = $True + PasscodeMinutesOfInactivityBeforeScreenTimeout = 25 + ITunesBlockRadio = $True + CellularBlockGlobalBackgroundFetchWhileRoaming = $True + SiriBlocked = $True + MediaContentRatingJapan = @{ + movieRating = 'allAllowed' + tvRating = 'allAllowed' + } + FindMyFriendsInFindMyAppBlocked = $True + CellularBlockPerAppDataModification = $True + ClassroomForceAutomaticallyJoinClasses = $True + SiriBlockUserGeneratedContent = $True + MediaContentRatingApps = 'allAllowed' + SafariCookieSettings = 'browserDefault' + DeviceBlockNameModification = $True + WifiPowerOnForced = $True + ContactsAllowManagedToUnmanagedWrite = $True + AirPrintBlockCredentialsStorage = $True + '@odata.type' = '#microsoft.graph.iosGeneralDeviceConfiguration' + KioskModeAllowAssistiveTouchSettings = $True + PasscodeRequiredType = 'deviceDefault' + PasscodePreviousPasscodeBlockCount = 25 + AutoFillForceAuthentication = $True + CompliantAppListType = 'none' + ICloudBlockBackup = $True + KioskModeAllowAutoLock = $True + LockScreenBlockControlCenter = $True + EsimBlockModification = $True + AppleNewsBlocked = $True + CellularBlockPersonalHotspot = $True + KioskModeBuiltInAppId = 'FakeStringValue' + AirPrintForceTrustedTLS = $True + CameraBlocked = $True + SiriRequireProfanityFilter = $True + PasscodeBlockFingerprintUnlock = $True + DateAndTimeForceSetAutomatically = $True + KioskModeAllowAssistiveSpeak = $True + AccountBlockModification = $True + BlockSystemAppRemoval = $True + DocumentsBlockManagedDocumentsInUnmanagedApps = $True + FindMyFriendsBlocked = $True + ICloudBlockManagedAppsSync = $True + LockScreenBlockTodayView = $True + BluetoothBlockModification = $True + KioskModeManagedAppId = 'FakeStringValue' + SoftwareUpdatesForceDelayed = $True + ConfigurationProfileBlockChanges = $True + WiFiConnectOnlyToConfiguredNetworks = $True + MediaContentRatingNewZealand = @{ + movieRating = 'allAllowed' + tvRating = 'allAllowed' + } + KioskModeRequireMonoAudio = $True + AppStoreRequirePassword = $True + ICloudBlockDocumentSync = $True + CellularBlockDataRoaming = $True + ICloudRequireEncryptedBackup = $True + ApplePersonalizedAdsBlocked = $True + KioskModeBlockAutoLock = $True + ClassroomAppBlockRemoteScreenObservation = $True + PasscodeBlockFingerprintModification = $True + FindMyDeviceInFindMyAppBlocked = $True + IBooksStoreBlocked = $True + KioskModeRequireVoiceOver = $True + KioskModeAllowVoiceOverSettings = $True + AirDropForceUnmanagedDropTarget = $True + SafariBlockAutofill = $True + PasscodeSignInFailureCountBeforeWipe = 25 + ContinuousPathKeyboardBlocked = $True + KeychainBlockCloudSync = $True + VpnBlockCreation = $True + KioskModeAllowVoiceControlModification = $True + MediaContentRatingUnitedStates = @{ + movieRating = 'allAllowed' + tvRating = 'allAllowed' + } + KioskModeBlockVolumeButtons = $True + HostPairingBlocked = $True + AppClipsBlocked = $True + PasscodeRequired = $True + AppStoreBlockInAppPurchases = $True + LockScreenBlockNotificationView = $True + KioskModeBlockSleepButton = $True + OnDeviceOnlyDictationForced = $True + NetworkUsageRules = @( + @{ + cellularDataBlocked = $True + cellularDataBlockWhenRoaming = $True + } + ) + ICloudBlockActivityContinuation = $True + SoftwareUpdatesEnforcedDelayInDays = 25 + AppsSingleAppModeList = @( + @{ + name = 'FakeStringValue' + appId = 'FakeStringValue' + appStoreUrl = 'FakeStringValue' + '@odata.type' = '#microsoft.graph.appleAppListItem' + publisher = 'FakeStringValue' + } + ) + ICloudBlockPhotoLibrary = $True + PrivacyForceLimitAdTracking = $True + MediaContentRatingGermany = @{ + movieRating = 'allAllowed' + tvRating = 'allAllowed' + } + KeyboardBlockShortcuts = $True + OnDeviceOnlyTranslationForced = $True + FilesUsbDriveAccessBlocked = $True + AppStoreBlockAutomaticDownloads = $True + KioskModeRequireColorInversion = $True + SharedDeviceBlockTemporarySessions = $True + GamingBlockGameCenterFriends = $True + EnterpriseBookBlockBackup = $True + EnterpriseBookBlockMetadataSync = $True + AirDropBlocked = $True + KioskModeBlockRingerSwitch = $True + KioskModeEnableVoiceControl = $True + MediaContentRatingUnitedKingdom = @{ + movieRating = 'allAllowed' + tvRating = 'allAllowed' + } + CellularBlockPlanModification = $True + AirPrintBlocked = $True + KioskModeAllowZoomSettings = $True + AppRemovalBlocked = $True + ICloudPrivateRelayBlocked = $True + PodcastsBlocked = $True + WallpaperBlockModification = $True + ClassroomForceRequestPermissionToLeaveClasses = $True + AppsVisibilityList = @( + @{ + name = 'FakeStringValue' + appId = 'FakeStringValue' + appStoreUrl = 'FakeStringValue' + '@odata.type' = '#microsoft.graph.appleAppListItem' + publisher = 'FakeStringValue' + } + ) + SiriBlockedWhenLocked = $True + MediaContentRatingFrance = @{ + movieRating = 'allAllowed' + tvRating = 'allAllowed' + } + DefinitionLookupBlocked = $True + SafariBlockJavaScript = $True + AppsVisibilityListType = 'none' + AppleWatchBlockPairing = $True + KioskModeAppStoreUrl = 'FakeStringValue' + NfcBlocked = $True + LockScreenBlockPassbook = $True + PasswordBlockAutoFill = $True + CompliantAppsList = @( + @{ + name = 'FakeStringValue' + appId = 'FakeStringValue' + appStoreUrl = 'FakeStringValue' + '@odata.type' = '#microsoft.graph.appleAppListItem' + publisher = 'FakeStringValue' + } + ) + AirPrintBlockiBeaconDiscovery = $True + ScreenCaptureBlocked = $True + KioskModeAllowTouchscreen = $True + ContactsAllowUnmanagedToManagedRead = $True + KioskModeBlockTouchscreen = $True + UsbRestrictedModeBlocked = $True + DeviceBlockEraseContentAndSettings = $True + PasswordBlockAirDropSharing = $True + CellularBlockPersonalHotspotModification = $True + NotificationsBlockSettingsModification = $True + SafariBlocked = $True + CertificatesBlockUntrustedTlsCertificates = $True + FilesNetworkDriveAccessBlocked = $True + KeyboardBlockSpellCheck = $True + ClassroomAppForceUnpromptedScreenObservation = $True + ClassroomForceUnpromptedAppAndDeviceLock = $True + KioskModeAllowScreenRotation = $True + KioskModeAllowColorInversionSettings = $True + PasscodeMinutesOfInactivityBeforeLock = 25 + DiagnosticDataBlockSubmission = $True + GamingBlockMultiplayer = $True + SafariRequireFraudWarning = $True + KioskModeRequireAssistiveTouch = $True + AppStoreBlockUIAppInstallation = $True + KioskModeBlockScreenRotation = $True + WiFiConnectToAllowedNetworksOnlyForced = $True + KioskModeRequireZoom = $True + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + } + } + + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { + return @() + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -314,10 +569,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { return $null } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { - return @() - } } It 'Should return Values from the Get method' { (Get-TargetResource @testParams).Ensure | Should -Be 'Absent' @@ -585,267 +836,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - FaceTimeBlocked = $True - KioskModeAllowSleepButton = $True - MediaContentRatingCanada = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - UnpairedExternalBootToRecoveryAllowed = $True - ICloudBlockPhotoStreamSync = $True - KeyboardBlockPredictive = $True - SafariBlockPopups = $True - GameCenterBlocked = $True - PasscodeBlockSimple = $True - ITunesBlocked = $True - PasscodeMinimumCharacterSetCount = 25 - AppleWatchForceWristDetection = $True - PasscodeExpirationDays = 25 - EnterpriseAppBlockTrustModification = $True - AirPlayForcePairingPasswordForOutgoingRequests = $True - KeyboardBlockAutoCorrect = $True - ITunesBlockExplicitContent = $True - IBooksStoreBlockErotica = $True - KioskModeAllowRingerSwitch = $True - DocumentsBlockUnmanagedDocumentsInManagedApps = $True - MessagesBlocked = $True - DeviceBlockEnableRestrictions = $True - AppStoreBlocked = $True - SpotlightBlockInternetResults = $True - KioskModeAppType = 'notConfigured' - KioskModeAllowVolumeButtons = $True - VoiceDialingBlocked = $True - PasscodeMinimumLength = 25 - ICloudBlockSharedPhotoStream = $True - ActivationLockAllowWhenSupervised = $True - CellularBlockVoiceRoaming = $True - MediaContentRatingIreland = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - PkiBlockOTAUpdates = $True - KeyboardBlockDictation = $True - PasscodeBlockModification = $True - AutoUnlockBlocked = $True - PasswordBlockProximityRequests = $True - MediaContentRatingAustralia = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - ITunesBlockMusicService = $True - DiagnosticDataBlockSubmissionModification = $True - EnterpriseAppBlockTrust = $True - ManagedPasteboardRequired = $True - ProximityBlockSetupToNewDevice = $True - PasscodeMinutesOfInactivityBeforeScreenTimeout = 25 - ITunesBlockRadio = $True - CellularBlockGlobalBackgroundFetchWhileRoaming = $True - SiriBlocked = $True - MediaContentRatingJapan = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - FindMyFriendsInFindMyAppBlocked = $True - CellularBlockPerAppDataModification = $True - ClassroomForceAutomaticallyJoinClasses = $True - SiriBlockUserGeneratedContent = $True - MediaContentRatingApps = 'allAllowed' - SafariCookieSettings = 'browserDefault' - DeviceBlockNameModification = $True - WifiPowerOnForced = $True - ContactsAllowManagedToUnmanagedWrite = $True - AirPrintBlockCredentialsStorage = $True - '@odata.type' = '#microsoft.graph.iosGeneralDeviceConfiguration' - KioskModeAllowAssistiveTouchSettings = $True - PasscodeRequiredType = 'deviceDefault' - PasscodePreviousPasscodeBlockCount = 25 - AutoFillForceAuthentication = $True - CompliantAppListType = 'none' - ICloudBlockBackup = $True - KioskModeAllowAutoLock = $True - LockScreenBlockControlCenter = $True - EsimBlockModification = $True - AppleNewsBlocked = $True - CellularBlockPersonalHotspot = $True - KioskModeBuiltInAppId = 'FakeStringValue' - AirPrintForceTrustedTLS = $True - CameraBlocked = $True - SiriRequireProfanityFilter = $True - PasscodeBlockFingerprintUnlock = $True - DateAndTimeForceSetAutomatically = $True - KioskModeAllowAssistiveSpeak = $True - AccountBlockModification = $True - BlockSystemAppRemoval = $True - DocumentsBlockManagedDocumentsInUnmanagedApps = $True - FindMyFriendsBlocked = $True - ICloudBlockManagedAppsSync = $True - LockScreenBlockTodayView = $True - BluetoothBlockModification = $True - KioskModeManagedAppId = 'FakeStringValue' - SoftwareUpdatesForceDelayed = $True - ConfigurationProfileBlockChanges = $True - WiFiConnectOnlyToConfiguredNetworks = $True - MediaContentRatingNewZealand = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KioskModeRequireMonoAudio = $True - AppStoreRequirePassword = $True - ICloudBlockDocumentSync = $True - CellularBlockDataRoaming = $True - ICloudRequireEncryptedBackup = $True - ApplePersonalizedAdsBlocked = $True - KioskModeBlockAutoLock = $True - ClassroomAppBlockRemoteScreenObservation = $True - PasscodeBlockFingerprintModification = $True - FindMyDeviceInFindMyAppBlocked = $True - IBooksStoreBlocked = $True - KioskModeRequireVoiceOver = $True - KioskModeAllowVoiceOverSettings = $True - AirDropForceUnmanagedDropTarget = $True - SafariBlockAutofill = $True - PasscodeSignInFailureCountBeforeWipe = 25 - ContinuousPathKeyboardBlocked = $True - KeychainBlockCloudSync = $True - VpnBlockCreation = $True - KioskModeAllowVoiceControlModification = $True - MediaContentRatingUnitedStates = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KioskModeBlockVolumeButtons = $True - HostPairingBlocked = $True - AppClipsBlocked = $True - PasscodeRequired = $True - AppStoreBlockInAppPurchases = $True - LockScreenBlockNotificationView = $True - KioskModeBlockSleepButton = $True - OnDeviceOnlyDictationForced = $True - NetworkUsageRules = @( - @{ - cellularDataBlocked = $True - cellularDataBlockWhenRoaming = $True - - } - ) - ICloudBlockActivityContinuation = $True - SoftwareUpdatesEnforcedDelayInDays = 25 - AppsSingleAppModeList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - ICloudBlockPhotoLibrary = $True - PrivacyForceLimitAdTracking = $True - MediaContentRatingGermany = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KeyboardBlockShortcuts = $True - OnDeviceOnlyTranslationForced = $True - FilesUsbDriveAccessBlocked = $True - AppStoreBlockAutomaticDownloads = $True - KioskModeRequireColorInversion = $True - SharedDeviceBlockTemporarySessions = $True - GamingBlockGameCenterFriends = $True - EnterpriseBookBlockBackup = $True - EnterpriseBookBlockMetadataSync = $True - AirDropBlocked = $True - KioskModeBlockRingerSwitch = $True - KioskModeEnableVoiceControl = $True - MediaContentRatingUnitedKingdom = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - CellularBlockPlanModification = $True - AirPrintBlocked = $True - KioskModeAllowZoomSettings = $True - AppRemovalBlocked = $True - ICloudPrivateRelayBlocked = $True - PodcastsBlocked = $True - WallpaperBlockModification = $True - ClassroomForceRequestPermissionToLeaveClasses = $True - AppsVisibilityList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - SiriBlockedWhenLocked = $True - MediaContentRatingFrance = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - DefinitionLookupBlocked = $True - SafariBlockJavaScript = $True - AppsVisibilityListType = 'none' - AppleWatchBlockPairing = $True - KioskModeAppStoreUrl = 'FakeStringValue' - NfcBlocked = $True - LockScreenBlockPassbook = $True - PasswordBlockAutoFill = $True - CompliantAppsList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - AirPrintBlockiBeaconDiscovery = $True - ScreenCaptureBlocked = $True - KioskModeAllowTouchscreen = $True - ContactsAllowUnmanagedToManagedRead = $True - KioskModeBlockTouchscreen = $True - UsbRestrictedModeBlocked = $True - DeviceBlockEraseContentAndSettings = $True - PasswordBlockAirDropSharing = $True - CellularBlockPersonalHotspotModification = $True - NotificationsBlockSettingsModification = $True - SafariBlocked = $True - CertificatesBlockUntrustedTlsCertificates = $True - FilesNetworkDriveAccessBlocked = $True - KeyboardBlockSpellCheck = $True - ClassroomAppForceUnpromptedScreenObservation = $True - ClassroomForceUnpromptedAppAndDeviceLock = $True - KioskModeAllowScreenRotation = $True - KioskModeAllowColorInversionSettings = $True - PasscodeMinutesOfInactivityBeforeLock = 25 - DiagnosticDataBlockSubmission = $True - GamingBlockMultiplayer = $True - SafariRequireFraudWarning = $True - KioskModeRequireAssistiveTouch = $True - AppStoreBlockUIAppInstallation = $True - KioskModeBlockScreenRotation = $True - WiFiConnectToAllowedNetworksOnlyForced = $True - KioskModeRequireZoom = $True - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { - return @() - } } It 'Should return Values from the Get method' { @@ -1115,267 +1105,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - FaceTimeBlocked = $True - KioskModeAllowSleepButton = $True - MediaContentRatingCanada = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - UnpairedExternalBootToRecoveryAllowed = $True - ICloudBlockPhotoStreamSync = $True - KeyboardBlockPredictive = $True - SafariBlockPopups = $True - GameCenterBlocked = $True - PasscodeBlockSimple = $True - ITunesBlocked = $True - PasscodeMinimumCharacterSetCount = 25 - AppleWatchForceWristDetection = $True - PasscodeExpirationDays = 25 - EnterpriseAppBlockTrustModification = $True - AirPlayForcePairingPasswordForOutgoingRequests = $True - KeyboardBlockAutoCorrect = $True - ITunesBlockExplicitContent = $True - IBooksStoreBlockErotica = $True - KioskModeAllowRingerSwitch = $True - DocumentsBlockUnmanagedDocumentsInManagedApps = $True - MessagesBlocked = $True - DeviceBlockEnableRestrictions = $True - AppStoreBlocked = $True - SpotlightBlockInternetResults = $True - KioskModeAppType = 'notConfigured' - KioskModeAllowVolumeButtons = $True - VoiceDialingBlocked = $True - PasscodeMinimumLength = 25 - ICloudBlockSharedPhotoStream = $True - ActivationLockAllowWhenSupervised = $True - CellularBlockVoiceRoaming = $True - MediaContentRatingIreland = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - PkiBlockOTAUpdates = $True - KeyboardBlockDictation = $True - PasscodeBlockModification = $True - AutoUnlockBlocked = $True - PasswordBlockProximityRequests = $True - MediaContentRatingAustralia = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - ITunesBlockMusicService = $True - DiagnosticDataBlockSubmissionModification = $True - EnterpriseAppBlockTrust = $True - ManagedPasteboardRequired = $True - ProximityBlockSetupToNewDevice = $True - PasscodeMinutesOfInactivityBeforeScreenTimeout = 25 - ITunesBlockRadio = $True - CellularBlockGlobalBackgroundFetchWhileRoaming = $True - SiriBlocked = $True - MediaContentRatingJapan = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - FindMyFriendsInFindMyAppBlocked = $True - CellularBlockPerAppDataModification = $True - ClassroomForceAutomaticallyJoinClasses = $True - SiriBlockUserGeneratedContent = $True - MediaContentRatingApps = 'allAllowed' - SafariCookieSettings = 'browserDefault' - DeviceBlockNameModification = $True - WifiPowerOnForced = $True - ContactsAllowManagedToUnmanagedWrite = $True - AirPrintBlockCredentialsStorage = $True - '@odata.type' = '#microsoft.graph.iosGeneralDeviceConfiguration' - KioskModeAllowAssistiveTouchSettings = $True - PasscodeRequiredType = 'deviceDefault' - PasscodePreviousPasscodeBlockCount = 25 - AutoFillForceAuthentication = $True - CompliantAppListType = 'none' - ICloudBlockBackup = $True - KioskModeAllowAutoLock = $True - LockScreenBlockControlCenter = $True - EsimBlockModification = $True - AppleNewsBlocked = $True - CellularBlockPersonalHotspot = $True - KioskModeBuiltInAppId = 'FakeStringValue' - AirPrintForceTrustedTLS = $True - CameraBlocked = $True - SiriRequireProfanityFilter = $True - PasscodeBlockFingerprintUnlock = $True - DateAndTimeForceSetAutomatically = $True - KioskModeAllowAssistiveSpeak = $True - AccountBlockModification = $True - BlockSystemAppRemoval = $True - DocumentsBlockManagedDocumentsInUnmanagedApps = $True - FindMyFriendsBlocked = $True - ICloudBlockManagedAppsSync = $True - LockScreenBlockTodayView = $True - BluetoothBlockModification = $True - KioskModeManagedAppId = 'FakeStringValue' - SoftwareUpdatesForceDelayed = $True - ConfigurationProfileBlockChanges = $True - WiFiConnectOnlyToConfiguredNetworks = $True - MediaContentRatingNewZealand = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KioskModeRequireMonoAudio = $True - AppStoreRequirePassword = $True - ICloudBlockDocumentSync = $True - CellularBlockDataRoaming = $True - ICloudRequireEncryptedBackup = $True - ApplePersonalizedAdsBlocked = $True - KioskModeBlockAutoLock = $True - ClassroomAppBlockRemoteScreenObservation = $True - PasscodeBlockFingerprintModification = $True - FindMyDeviceInFindMyAppBlocked = $True - IBooksStoreBlocked = $True - KioskModeRequireVoiceOver = $True - KioskModeAllowVoiceOverSettings = $True - AirDropForceUnmanagedDropTarget = $True - SafariBlockAutofill = $True - PasscodeSignInFailureCountBeforeWipe = 25 - ContinuousPathKeyboardBlocked = $True - KeychainBlockCloudSync = $True - VpnBlockCreation = $True - KioskModeAllowVoiceControlModification = $True - MediaContentRatingUnitedStates = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KioskModeBlockVolumeButtons = $True - HostPairingBlocked = $True - AppClipsBlocked = $True - PasscodeRequired = $True - AppStoreBlockInAppPurchases = $True - LockScreenBlockNotificationView = $True - KioskModeBlockSleepButton = $True - OnDeviceOnlyDictationForced = $True - NetworkUsageRules = @( - @{ - cellularDataBlocked = $True - cellularDataBlockWhenRoaming = $True - - } - ) - ICloudBlockActivityContinuation = $True - SoftwareUpdatesEnforcedDelayInDays = 25 - AppsSingleAppModeList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - ICloudBlockPhotoLibrary = $True - PrivacyForceLimitAdTracking = $True - MediaContentRatingGermany = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KeyboardBlockShortcuts = $True - OnDeviceOnlyTranslationForced = $True - FilesUsbDriveAccessBlocked = $True - AppStoreBlockAutomaticDownloads = $True - KioskModeRequireColorInversion = $True - SharedDeviceBlockTemporarySessions = $True - GamingBlockGameCenterFriends = $True - EnterpriseBookBlockBackup = $True - EnterpriseBookBlockMetadataSync = $True - AirDropBlocked = $True - KioskModeBlockRingerSwitch = $True - KioskModeEnableVoiceControl = $True - MediaContentRatingUnitedKingdom = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - CellularBlockPlanModification = $True - AirPrintBlocked = $True - KioskModeAllowZoomSettings = $True - AppRemovalBlocked = $True - ICloudPrivateRelayBlocked = $True - PodcastsBlocked = $True - WallpaperBlockModification = $True - ClassroomForceRequestPermissionToLeaveClasses = $True - AppsVisibilityList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - SiriBlockedWhenLocked = $True - MediaContentRatingFrance = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - DefinitionLookupBlocked = $True - SafariBlockJavaScript = $True - AppsVisibilityListType = 'none' - AppleWatchBlockPairing = $True - KioskModeAppStoreUrl = 'FakeStringValue' - NfcBlocked = $True - LockScreenBlockPassbook = $True - PasswordBlockAutoFill = $True - CompliantAppsList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - AirPrintBlockiBeaconDiscovery = $True - ScreenCaptureBlocked = $True - KioskModeAllowTouchscreen = $True - ContactsAllowUnmanagedToManagedRead = $True - KioskModeBlockTouchscreen = $True - UsbRestrictedModeBlocked = $True - DeviceBlockEraseContentAndSettings = $True - PasswordBlockAirDropSharing = $True - CellularBlockPersonalHotspotModification = $True - NotificationsBlockSettingsModification = $True - SafariBlocked = $True - CertificatesBlockUntrustedTlsCertificates = $True - FilesNetworkDriveAccessBlocked = $True - KeyboardBlockSpellCheck = $True - ClassroomAppForceUnpromptedScreenObservation = $True - ClassroomForceUnpromptedAppAndDeviceLock = $True - KioskModeAllowScreenRotation = $True - KioskModeAllowColorInversionSettings = $True - PasscodeMinutesOfInactivityBeforeLock = 25 - DiagnosticDataBlockSubmission = $True - GamingBlockMultiplayer = $True - SafariRequireFraudWarning = $True - KioskModeRequireAssistiveTouch = $True - AppStoreBlockUIAppInstallation = $True - KioskModeBlockScreenRotation = $True - WiFiConnectToAllowedNetworksOnlyForced = $True - KioskModeRequireZoom = $True - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { - return @() - } } @@ -1387,7 +1116,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'The IntuneDeviceConfigurationPolicyIOS exists and values are NOT in the desired state' -Fixture { BeforeAll { $testParams = @{ - AccountBlockModification = $True + AccountBlockModification = $False # Updated property ActivationLockAllowWhenSupervised = $True AirDropBlocked = $True AirDropForceUnmanagedDropTarget = $True @@ -1638,113 +1367,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - MediaContentRatingCanada = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - PasscodeMinutesOfInactivityBeforeLock = 7 - PasscodeMinimumLength = 7 - MediaContentRatingIreland = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - PasscodeMinutesOfInactivityBeforeScreenTimeout = 7 - NetworkUsageRules = @( - @{ - cellularDataBlocked = $True - cellularDataBlockWhenRoaming = $True - - } - ) - PasscodePreviousPasscodeBlockCount = 7 - MediaContentRatingNewZealand = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KioskModeManagedAppId = 'FakeStringValue' - MediaContentRatingApps = 'allAllowed' - PasscodeMinimumCharacterSetCount = 7 - MediaContentRatingUnitedStates = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - SafariCookieSettings = 'browserDefault' - CompliantAppListType = 'none' - AppsSingleAppModeList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - MediaContentRatingFrance = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - MediaContentRatingAustralia = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - MediaContentRatingGermany = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - PasscodeSignInFailureCountBeforeWipe = 7 - KioskModeAppStoreUrl = 'FakeStringValue' - AppsVisibilityListType = 'none' - KioskModeAppType = 'notConfigured' - AppsVisibilityList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - MediaContentRatingJapan = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - SoftwareUpdatesEnforcedDelayInDays = 7 - PasscodeExpirationDays = 7 - CompliantAppsList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - '@odata.type' = '#microsoft.graph.iosGeneralDeviceConfiguration' - KioskModeBuiltInAppId = 'FakeStringValue' - MediaContentRatingUnitedKingdom = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - PasscodeRequiredType = 'deviceDefault' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { - return @() - } } It 'Should return Values from the Get method' { @@ -1768,268 +1390,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - FaceTimeBlocked = $True - KioskModeAllowSleepButton = $True - MediaContentRatingCanada = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - UnpairedExternalBootToRecoveryAllowed = $True - ICloudBlockPhotoStreamSync = $True - KeyboardBlockPredictive = $True - SafariBlockPopups = $True - GameCenterBlocked = $True - PasscodeBlockSimple = $True - ITunesBlocked = $True - PasscodeMinimumCharacterSetCount = 25 - AppleWatchForceWristDetection = $True - PasscodeExpirationDays = 25 - EnterpriseAppBlockTrustModification = $True - AirPlayForcePairingPasswordForOutgoingRequests = $True - KeyboardBlockAutoCorrect = $True - ITunesBlockExplicitContent = $True - IBooksStoreBlockErotica = $True - KioskModeAllowRingerSwitch = $True - DocumentsBlockUnmanagedDocumentsInManagedApps = $True - MessagesBlocked = $True - DeviceBlockEnableRestrictions = $True - AppStoreBlocked = $True - SpotlightBlockInternetResults = $True - KioskModeAppType = 'notConfigured' - KioskModeAllowVolumeButtons = $True - VoiceDialingBlocked = $True - PasscodeMinimumLength = 25 - ICloudBlockSharedPhotoStream = $True - ActivationLockAllowWhenSupervised = $True - CellularBlockVoiceRoaming = $True - MediaContentRatingIreland = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - PkiBlockOTAUpdates = $True - KeyboardBlockDictation = $True - PasscodeBlockModification = $True - AutoUnlockBlocked = $True - PasswordBlockProximityRequests = $True - MediaContentRatingAustralia = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - ITunesBlockMusicService = $True - DiagnosticDataBlockSubmissionModification = $True - EnterpriseAppBlockTrust = $True - ManagedPasteboardRequired = $True - ProximityBlockSetupToNewDevice = $True - PasscodeMinutesOfInactivityBeforeScreenTimeout = 25 - ITunesBlockRadio = $True - CellularBlockGlobalBackgroundFetchWhileRoaming = $True - SiriBlocked = $True - MediaContentRatingJapan = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - FindMyFriendsInFindMyAppBlocked = $True - CellularBlockPerAppDataModification = $True - ClassroomForceAutomaticallyJoinClasses = $True - SiriBlockUserGeneratedContent = $True - MediaContentRatingApps = 'allAllowed' - SafariCookieSettings = 'browserDefault' - DeviceBlockNameModification = $True - WifiPowerOnForced = $True - ContactsAllowManagedToUnmanagedWrite = $True - AirPrintBlockCredentialsStorage = $True - '@odata.type' = '#microsoft.graph.iosGeneralDeviceConfiguration' - KioskModeAllowAssistiveTouchSettings = $True - PasscodeRequiredType = 'deviceDefault' - PasscodePreviousPasscodeBlockCount = 25 - AutoFillForceAuthentication = $True - CompliantAppListType = 'none' - ICloudBlockBackup = $True - KioskModeAllowAutoLock = $True - LockScreenBlockControlCenter = $True - EsimBlockModification = $True - AppleNewsBlocked = $True - CellularBlockPersonalHotspot = $True - KioskModeBuiltInAppId = 'FakeStringValue' - AirPrintForceTrustedTLS = $True - CameraBlocked = $True - SiriRequireProfanityFilter = $True - PasscodeBlockFingerprintUnlock = $True - DateAndTimeForceSetAutomatically = $True - KioskModeAllowAssistiveSpeak = $True - AccountBlockModification = $True - BlockSystemAppRemoval = $True - DocumentsBlockManagedDocumentsInUnmanagedApps = $True - FindMyFriendsBlocked = $True - ICloudBlockManagedAppsSync = $True - LockScreenBlockTodayView = $True - BluetoothBlockModification = $True - KioskModeManagedAppId = 'FakeStringValue' - SoftwareUpdatesForceDelayed = $True - ConfigurationProfileBlockChanges = $True - WiFiConnectOnlyToConfiguredNetworks = $True - MediaContentRatingNewZealand = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KioskModeRequireMonoAudio = $True - AppStoreRequirePassword = $True - ICloudBlockDocumentSync = $True - CellularBlockDataRoaming = $True - ICloudRequireEncryptedBackup = $True - ApplePersonalizedAdsBlocked = $True - KioskModeBlockAutoLock = $True - ClassroomAppBlockRemoteScreenObservation = $True - PasscodeBlockFingerprintModification = $True - FindMyDeviceInFindMyAppBlocked = $True - IBooksStoreBlocked = $True - KioskModeRequireVoiceOver = $True - KioskModeAllowVoiceOverSettings = $True - AirDropForceUnmanagedDropTarget = $True - SafariBlockAutofill = $True - PasscodeSignInFailureCountBeforeWipe = 25 - ContinuousPathKeyboardBlocked = $True - KeychainBlockCloudSync = $True - VpnBlockCreation = $True - KioskModeAllowVoiceControlModification = $True - MediaContentRatingUnitedStates = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KioskModeBlockVolumeButtons = $True - HostPairingBlocked = $True - AppClipsBlocked = $True - PasscodeRequired = $True - AppStoreBlockInAppPurchases = $True - LockScreenBlockNotificationView = $True - KioskModeBlockSleepButton = $True - OnDeviceOnlyDictationForced = $True - NetworkUsageRules = @( - @{ - cellularDataBlocked = $True - cellularDataBlockWhenRoaming = $True - - } - ) - ICloudBlockActivityContinuation = $True - SoftwareUpdatesEnforcedDelayInDays = 25 - AppsSingleAppModeList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - ICloudBlockPhotoLibrary = $True - PrivacyForceLimitAdTracking = $True - MediaContentRatingGermany = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - KeyboardBlockShortcuts = $True - OnDeviceOnlyTranslationForced = $True - FilesUsbDriveAccessBlocked = $True - AppStoreBlockAutomaticDownloads = $True - KioskModeRequireColorInversion = $True - SharedDeviceBlockTemporarySessions = $True - GamingBlockGameCenterFriends = $True - EnterpriseBookBlockBackup = $True - EnterpriseBookBlockMetadataSync = $True - AirDropBlocked = $True - KioskModeBlockRingerSwitch = $True - KioskModeEnableVoiceControl = $True - MediaContentRatingUnitedKingdom = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - CellularBlockPlanModification = $True - AirPrintBlocked = $True - KioskModeAllowZoomSettings = $True - AppRemovalBlocked = $True - ICloudPrivateRelayBlocked = $True - PodcastsBlocked = $True - WallpaperBlockModification = $True - ClassroomForceRequestPermissionToLeaveClasses = $True - AppsVisibilityList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - SiriBlockedWhenLocked = $True - MediaContentRatingFrance = @{ - movieRating = 'allAllowed' - tvRating = 'allAllowed' - } - DefinitionLookupBlocked = $True - SafariBlockJavaScript = $True - AppsVisibilityListType = 'none' - AppleWatchBlockPairing = $True - KioskModeAppStoreUrl = 'FakeStringValue' - NfcBlocked = $True - LockScreenBlockPassbook = $True - PasswordBlockAutoFill = $True - CompliantAppsList = @( - @{ - name = 'FakeStringValue' - appId = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.appleAppListItem' - publisher = 'FakeStringValue' - - } - ) - AirPrintBlockiBeaconDiscovery = $True - ScreenCaptureBlocked = $True - KioskModeAllowTouchscreen = $True - ContactsAllowUnmanagedToManagedRead = $True - KioskModeBlockTouchscreen = $True - UsbRestrictedModeBlocked = $True - DeviceBlockEraseContentAndSettings = $True - PasswordBlockAirDropSharing = $True - CellularBlockPersonalHotspotModification = $True - NotificationsBlockSettingsModification = $True - SafariBlocked = $True - CertificatesBlockUntrustedTlsCertificates = $True - FilesNetworkDriveAccessBlocked = $True - KeyboardBlockSpellCheck = $True - ClassroomAppForceUnpromptedScreenObservation = $True - ClassroomForceUnpromptedAppAndDeviceLock = $True - KioskModeAllowScreenRotation = $True - KioskModeAllowColorInversionSettings = $True - PasscodeMinutesOfInactivityBeforeLock = 25 - DiagnosticDataBlockSubmission = $True - GamingBlockMultiplayer = $True - SafariRequireFraudWarning = $True - KioskModeRequireAssistiveTouch = $True - AppStoreBlockUIAppInstallation = $True - KioskModeBlockScreenRotation = $True - WiFiConnectToAllowedNetworksOnlyForced = $True - KioskModeRequireZoom = $True - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { - return @() - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSCEPCertificatePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSCEPCertificatePolicyWindows10.Tests.ps1 index 39ade7f5d7..a3d31723d0 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSCEPCertificatePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSCEPCertificatePolicyWindows10.Tests.ps1 @@ -66,6 +66,43 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + subjectAlternativeNameType = "none" + keyUsage = "keyEncipherment" + subjectAlternativeNameFormatString = "FakeStringValue" + certificateValidityPeriodScale = "days" + keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" + '@odata.type' = "#microsoft.graph.windows81SCEPCertificateProfile" + scepServerUrls = @("FakeStringValue") + renewalThresholdPercentage = 25 + certificateValidityPeriodValue = 25 + hashAlgorithm = "sha1" + keySize = "size1024" + subjectNameFormatString = "FakeStringValue" + subjectNameFormat = "commonName" + certificateStore = "user" + extendedKeyUsages = @( + @{ + objectIdentifier = "FakeStringValue" + name = "FakeStringValue" + } + ) + customSubjectAlternativeNames = @( + @{ + sanType = "none" + name = "FakeStringValue" + } + ) + } + description = "FakeStringValue" + displayName = "FakeStringValue" + id = "FakeStringValue" + + } + } + Mock -CommandName Update-DeviceConfigurationPolicyRootCertificateId -MockWith { } } @@ -173,43 +210,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - subjectAlternativeNameType = "none" - keyUsage = "keyEncipherment" - subjectAlternativeNameFormatString = "FakeStringValue" - certificateValidityPeriodScale = "days" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - '@odata.type' = "#microsoft.graph.windows81SCEPCertificateProfile" - scepServerUrls = @("FakeStringValue") - renewalThresholdPercentage = 25 - certificateValidityPeriodValue = 25 - hashAlgorithm = "sha1" - keySize = "size1024" - subjectNameFormatString = "FakeStringValue" - subjectNameFormat = "commonName" - certificateStore = "user" - extendedKeyUsages = @( - @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - ) - customSubjectAlternativeNames = @( - @{ - sanType = "none" - name = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } It 'Should return Values from the Get method' { @@ -261,43 +261,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - subjectAlternativeNameType = "none" - keyUsage = "keyEncipherment" - subjectAlternativeNameFormatString = "FakeStringValue" - certificateValidityPeriodScale = "days" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - '@odata.type' = "#microsoft.graph.windows81SCEPCertificateProfile" - scepServerUrls = @("FakeStringValue") - renewalThresholdPercentage = 25 - certificateValidityPeriodValue = 25 - hashAlgorithm = "sha1" - keySize = "size1024" - subjectNameFormatString = "FakeStringValue" - subjectNameFormat = "commonName" - certificateStore = "user" - extendedKeyUsages = @( - @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - ) - customSubjectAlternativeNames = @( - @{ - sanType = "none" - name = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } @@ -333,7 +296,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { KeySize = "size1024" keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" KeyUsage = @("keyEncipherment") - renewalThresholdPercentage = 25 + renewalThresholdPercentage = 7 # Updated property ScepServerUrls = @("FakeStringValue") SubjectAlternativeNameFormatString = "FakeStringValue" subjectAlternativeNameType = "none" @@ -345,42 +308,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Credential = $Credential; } - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - subjectAlternativeNameType = "none" - keyUsage = "keyEncipherment" - subjectAlternativeNameFormatString = "FakeStringValue" - certificateValidityPeriodScale = "days" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - '@odata.type' = "#microsoft.graph.windows81SCEPCertificateProfile" - scepServerUrls = @("FakeStringValue") - renewalThresholdPercentage = 7 - certificateValidityPeriodValue = 7 - hashAlgorithm = "sha1" - keySize = "size1024" - subjectNameFormatString = "FakeStringValue" - subjectNameFormat = "commonName" - certificateStore = "user" - extendedKeyUsages = @( - @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - ) - customSubjectAlternativeNames = @( - @{ - sanType = "none" - name = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - } - } - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -ParameterFilter { $DeviceConfigurationId -eq $RootCertificateId } -MockWith { $AdditionalProperties = @{} $AdditionalProperties.'@odata.type' = "#microsoft.graph.windows81TrustedRootCertificate" @@ -414,44 +341,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - subjectAlternativeNameType = "none" - keyUsage = "keyEncipherment" - subjectAlternativeNameFormatString = "FakeStringValue" - certificateValidityPeriodScale = "days" - keyStorageProvider = "useTpmKspOtherwiseUseSoftwareKsp" - '@odata.type' = "#microsoft.graph.windows81SCEPCertificateProfile" - scepServerUrls = @("FakeStringValue") - renewalThresholdPercentage = 25 - certificateValidityPeriodValue = 25 - hashAlgorithm = "sha1" - keySize = "size1024" - subjectNameFormatString = "FakeStringValue" - subjectNameFormat = "commonName" - certificateStore = "user" - extendedKeyUsages = @( - @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - ) - customSubjectAlternativeNames = @( - @{ - sanType = "none" - name = "FakeStringValue" - } - ) - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSecureAssessmentPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSecureAssessmentPolicyWindows10.Tests.ps1 index 60e3277721..e867a708d3 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSecureAssessmentPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSecureAssessmentPolicyWindows10.Tests.ps1 @@ -41,6 +41,25 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + configurationAccountType = "azureADAccount" + '@odata.type' = "#microsoft.graph.windows10SecureAssessmentConfiguration" + allowTextSuggestion = $True + launchUri = "FakeStringValue" + assessmentAppUserModelId = "FakeStringValue" + allowScreenCapture = $True + localGuestAccountName = "FakeStringValue" + configurationAccount = "FakeStringValue" + allowPrinting = $True + } + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + Id = "FakeStringValue" + + } + } # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -103,26 +122,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - configurationAccountType = "azureADAccount" - '@odata.type' = "#microsoft.graph.windows10SecureAssessmentConfiguration" - allowTextSuggestion = $True - launchUri = "FakeStringValue" - assessmentAppUserModelId = "FakeStringValue" - allowScreenCapture = $True - localGuestAccountName = "FakeStringValue" - configurationAccount = "FakeStringValue" - allowPrinting = $True - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } It 'Should return Values from the Get method' { @@ -155,26 +154,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - configurationAccountType = "azureADAccount" - '@odata.type' = "#microsoft.graph.windows10SecureAssessmentConfiguration" - allowTextSuggestion = $True - launchUri = "FakeStringValue" - assessmentAppUserModelId = "FakeStringValue" - allowScreenCapture = $True - localGuestAccountName = "FakeStringValue" - configurationAccount = "FakeStringValue" - allowPrinting = $True - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } @@ -196,26 +175,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = "FakeStringValue" Id = "FakeStringValue" LaunchUri = "FakeStringValue" - LocalGuestAccountName = "FakeStringValue" + LocalGuestAccountName = "AnotherAccount" # Updated property Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - configurationAccountType = "azureADAccount" - '@odata.type' = "#microsoft.graph.windows10SecureAssessmentConfiguration" - launchUri = "FakeStringValue" - localGuestAccountName = "FakeStringValue" - configurationAccount = "FakeStringValue" - assessmentAppUserModelId = "FakeStringValue" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -239,27 +202,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - configurationAccountType = "azureADAccount" - '@odata.type' = "#microsoft.graph.windows10SecureAssessmentConfiguration" - allowTextSuggestion = $True - launchUri = "FakeStringValue" - assessmentAppUserModelId = "FakeStringValue" - allowScreenCapture = $True - localGuestAccountName = "FakeStringValue" - configurationAccount = "FakeStringValue" - allowPrinting = $True - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSharedMultiDevicePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSharedMultiDevicePolicyWindows10.Tests.ps1 index c7a56e0183..573749f314 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSharedMultiDevicePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationSharedMultiDevicePolicyWindows10.Tests.ps1 @@ -39,6 +39,40 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName New-M365DSCConnection -MockWith { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + kioskAppDisplayName = "FakeStringValue" + fastFirstSignIn = "notConfigured" + disableEduPolicies = $True + disableAccountManager = $True + accountManagerPolicy = @{ + inactiveThresholdDays = 25 + cacheAccountsAboveDiskFreePercentage = 25 + accountDeletionPolicy = "immediate" + removeAccountsBelowDiskFreePercentage = 25 + } + signInOnResume = "notConfigured" + setAccountManager = "notConfigured" + disableSignInOnResume = $True + localStorage = "notConfigured" + setEduPolicies = "notConfigured" + maintenanceStartTime = "00:00:00" + allowedAccounts = "notConfigured" + setPowerPolicies = "notConfigured" + '@odata.type' = "#microsoft.graph.sharedPCConfiguration" + allowLocalStorage = $True + kioskAppUserModelId = "FakeStringValue" + idleTimeBeforeSleepInSeconds = 25 + disablePowerPolicies = $True + enabled = $True + } + description = "FakeStringValue" + displayName = "FakeStringValue" + id = "FakeStringValue" + + } + } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } # Mock Write-M365DSCHost to hide output during the tests @@ -49,7 +83,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { } - } # Test contexts Context -Name "The IntuneDeviceConfigurationSharedMultiDevicePolicyWindows10 should exist but it DOES NOT" -Fixture { @@ -133,41 +166,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - kioskAppDisplayName = "FakeStringValue" - fastFirstSignIn = "notConfigured" - disableEduPolicies = $True - disableAccountManager = $True - accountManagerPolicy = @{ - inactiveThresholdDays = 25 - cacheAccountsAboveDiskFreePercentage = 25 - accountDeletionPolicy = "immediate" - removeAccountsBelowDiskFreePercentage = 25 - } - signInOnResume = "notConfigured" - setAccountManager = "notConfigured" - disableSignInOnResume = $True - localStorage = "notConfigured" - setEduPolicies = "notConfigured" - maintenanceStartTime = "00:00:00" - allowedAccounts = "notConfigured" - setPowerPolicies = "notConfigured" - '@odata.type' = "#microsoft.graph.sharedPCConfiguration" - allowLocalStorage = $True - kioskAppUserModelId = "FakeStringValue" - idleTimeBeforeSleepInSeconds = 25 - disablePowerPolicies = $True - enabled = $True - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } It 'Should return Values from the Get method' { @@ -215,44 +213,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - kioskAppDisplayName = "FakeStringValue" - fastFirstSignIn = "notConfigured" - disableEduPolicies = $True - disableAccountManager = $True - accountManagerPolicy = @{ - inactiveThresholdDays = 25 - cacheAccountsAboveDiskFreePercentage = 25 - accountDeletionPolicy = "immediate" - removeAccountsBelowDiskFreePercentage = 25 - } - signInOnResume = "notConfigured" - setAccountManager = "notConfigured" - disableSignInOnResume = $True - localStorage = "notConfigured" - setEduPolicies = "notConfigured" - maintenanceStartTime = "00:00:00" - allowedAccounts = "notConfigured" - setPowerPolicies = "notConfigured" - '@odata.type' = "#microsoft.graph.sharedPCConfiguration" - allowLocalStorage = $True - kioskAppUserModelId = "FakeStringValue" - idleTimeBeforeSleepInSeconds = 25 - disablePowerPolicies = $True - enabled = $True - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -262,7 +224,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { BeforeAll { $testParams = @{ accountManagerPolicy = (New-CimInstance -ClassName MSFT_MicrosoftGraphsharedPCAccountManagerPolicy -Property @{ - inactiveThresholdDays = 25 + inactiveThresholdDays = 7 # Updated property cacheAccountsAboveDiskFreePercentage = 25 accountDeletionPolicy = "immediate" removeAccountsBelowDiskFreePercentage = 25 @@ -290,34 +252,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - maintenanceStartTime = "00:00:00" - idleTimeBeforeSleepInSeconds = 7 - signInOnResume = "notConfigured" - '@odata.type' = "#microsoft.graph.sharedPCConfiguration" - setPowerPolicies = "notConfigured" - allowedAccounts = "notConfigured" - kioskAppUserModelId = "FakeStringValue" - setEduPolicies = "notConfigured" - accountManagerPolicy = @{ - inactiveThresholdDays = 7 - cacheAccountsAboveDiskFreePercentage = 7 - accountDeletionPolicy = "immediate" - removeAccountsBelowDiskFreePercentage = 7 - } - kioskAppDisplayName = "FakeStringValue" - fastFirstSignIn = "notConfigured" - localStorage = "notConfigured" - setAccountManager = "notConfigured" - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -341,42 +275,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - kioskAppDisplayName = "FakeStringValue" - fastFirstSignIn = "notConfigured" - disableEduPolicies = $True - disableAccountManager = $True - accountManagerPolicy = @{ - inactiveThresholdDays = 25 - cacheAccountsAboveDiskFreePercentage = 25 - accountDeletionPolicy = "immediate" - removeAccountsBelowDiskFreePercentage = 25 - } - signInOnResume = "notConfigured" - setAccountManager = "notConfigured" - disableSignInOnResume = $True - localStorage = "notConfigured" - setEduPolicies = "notConfigured" - maintenanceStartTime = "00:00:00" - allowedAccounts = "notConfigured" - setPowerPolicies = "notConfigured" - '@odata.type' = "#microsoft.graph.sharedPCConfiguration" - allowLocalStorage = $True - kioskAppUserModelId = "FakeStringValue" - idleTimeBeforeSleepInSeconds = 25 - disablePowerPolicies = $True - enabled = $True - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationTrustedCertificatePolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationTrustedCertificatePolicyWindows10.Tests.ps1 index 9a0cecc348..39eff9a3e5 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationTrustedCertificatePolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationTrustedCertificatePolicyWindows10.Tests.ps1 @@ -41,6 +41,19 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + destinationStore = "computerCertStoreRoot" + certFileName = "FakeStringValue" + '@odata.type' = "#microsoft.graph.windows81TrustedRootCertificate" + } + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + Id = "FakeStringValue" + + } + } # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -91,20 +104,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - destinationStore = "computerCertStoreRoot" - certFileName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windows81TrustedRootCertificate" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } It 'Should return Values from the Get method' { @@ -131,23 +130,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - destinationStore = "computerCertStoreRoot" - certFileName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windows81TrustedRootCertificate" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -158,25 +142,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ CertFileName = "FakeStringValue" Description = "FakeStringValue" - DestinationStore = "computerCertStoreRoot" + DestinationStore = "userCertStoreIntermediate" # Updated property DisplayName = "FakeStringValue" Id = "FakeStringValue" Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - destinationStore = "computerCertStoreRoot" - certFileName = "CertFileName Drift" - '@odata.type' = "#microsoft.graph.windows81TrustedRootCertificate" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -200,21 +171,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - destinationStore = "computerCertStoreRoot" - certFileName = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windows81TrustedRootCertificate" - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationVpnPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationVpnPolicyWindows10.Tests.ps1 index 1139869677..ac41d1d72b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationVpnPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationVpnPolicyWindows10.Tests.ps1 @@ -39,6 +39,121 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName New-M365DSCConnection -MockWith { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + dnsRules = @( + @{ + servers = @("FakeStringValue") + proxyServerUri = "FakeStringValue" + name = "FakeStringValue" + persistent = $True + autoTrigger = $True + } + ) + authenticationMethod = "certificate" + proxyServer = @{ + bypassProxyServerForLocalAddress = $True + '@odata.type' = "#microsoft.graph.windows10VpnProxyServer" + address = "FakeStringValue" + automaticConfigurationScriptUrl = "FakeStringValue" + automaticallyDetectProxySettings = $True + port = 25 + } + rememberUserCredentials = $True + enableDnsRegistration = $True + associatedApps = @( + @{ + identifier = "FakeStringValue" + appType = "desktop" + } + ) + routes = @( + @{ + prefixSize = 25 + destinationPrefix = "FakeStringValue" + } + ) + trustedNetworkDomains = @("FakeStringValue") + enableDeviceTunnel = $True + singleSignOnIssuerHash = "FakeStringValue" + singleSignOnEku = @{ + objectIdentifier = "FakeStringValue" + name = "FakeStringValue" + } + microsoftTunnelSiteId = "FakeStringValue" + enableSingleSignOnWithAlternateCertificate = $True + onlyAssociatedAppsCanUseConnection = $True + dnsSuffixes = @("FakeStringValue") + profileTarget = "user" + enableAlwaysOn = $True + servers = @( + @{ + isDefaultServer = $True + description = "FakeStringValue" + address = "FakeStringValue" + } + ) + connectionType = "pulseSecure" + connectionName = "FakeStringValue" + cryptographySuite = @{ + cipherTransformConstants = "aes256" + encryptionMethod = "aes256" + pfsGroup = "pfs1" + dhGroup = "group1" + integrityCheckMethod = "sha2_256" + authenticationTransformConstants = "md5_96" + } + trafficRules = @( + @{ + remotePortRanges = @( + @{ + lowerNumber = 25 + upperNumber = 25 + } + ) + name = "FakeStringValue" + appId = "FakeStringValue" + localPortRanges = @( + @{ + lowerNumber = 25 + upperNumber = 25 + } + ) + appType = "none" + localAddressRanges = @( + @{ + cidrAddress = "FakeStringValue" + upperAddress = "FakeStringValue" + lowerAddress = "FakeStringValue" + '@odata.type' = "#microsoft.graph.iPv4CidrRange" + } + ) + remoteAddressRanges = @( + @{ + cidrAddress = "FakeStringValue" + upperAddress = "FakeStringValue" + lowerAddress = "FakeStringValue" + '@odata.type' = "#microsoft.graph.iPv4CidrRange" + } + ) + claims = "FakeStringValue" + protocols = 25 + routingPolicyType = "none" + vpnTrafficDirection = "outbound" + } + ) + windowsInformationProtectionDomain = "FakeStringValue" + enableConditionalAccess = $True + '@odata.type' = "#microsoft.graph.windows10VpnConfiguration" + enableSplitTunneling = $True + } + description = "FakeStringValue" + displayName = "FakeStringValue" + id = "FakeStringValue" + + } + } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } # Mock Write-M365DSCHost to hide output during the tests @@ -295,122 +410,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - dnsRules = @( - @{ - servers = @("FakeStringValue") - proxyServerUri = "FakeStringValue" - name = "FakeStringValue" - persistent = $True - autoTrigger = $True - } - ) - authenticationMethod = "certificate" - proxyServer = @{ - bypassProxyServerForLocalAddress = $True - '@odata.type' = "#microsoft.graph.windows10VpnProxyServer" - address = "FakeStringValue" - automaticConfigurationScriptUrl = "FakeStringValue" - automaticallyDetectProxySettings = $True - port = 25 - } - rememberUserCredentials = $True - enableDnsRegistration = $True - associatedApps = @( - @{ - identifier = "FakeStringValue" - appType = "desktop" - } - ) - routes = @( - @{ - prefixSize = 25 - destinationPrefix = "FakeStringValue" - } - ) - trustedNetworkDomains = @("FakeStringValue") - enableDeviceTunnel = $True - singleSignOnIssuerHash = "FakeStringValue" - singleSignOnEku = @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - microsoftTunnelSiteId = "FakeStringValue" - enableSingleSignOnWithAlternateCertificate = $True - onlyAssociatedAppsCanUseConnection = $True - dnsSuffixes = @("FakeStringValue") - profileTarget = "user" - enableAlwaysOn = $True - servers = @( - @{ - isDefaultServer = $True - description = "FakeStringValue" - address = "FakeStringValue" - } - ) - connectionType = "pulseSecure" - connectionName = "FakeStringValue" - cryptographySuite = @{ - cipherTransformConstants = "aes256" - encryptionMethod = "aes256" - pfsGroup = "pfs1" - dhGroup = "group1" - integrityCheckMethod = "sha2_256" - authenticationTransformConstants = "md5_96" - } - trafficRules = @( - @{ - remotePortRanges = @( - @{ - lowerNumber = 25 - upperNumber = 25 - } - ) - name = "FakeStringValue" - appId = "FakeStringValue" - localPortRanges = @( - @{ - lowerNumber = 25 - upperNumber = 25 - } - ) - appType = "none" - localAddressRanges = @( - @{ - cidrAddress = "FakeStringValue" - upperAddress = "FakeStringValue" - lowerAddress = "FakeStringValue" - '@odata.type' = "#microsoft.graph.iPv4CidrRange" - } - ) - remoteAddressRanges = @( - @{ - cidrAddress = "FakeStringValue" - upperAddress = "FakeStringValue" - lowerAddress = "FakeStringValue" - '@odata.type' = "#microsoft.graph.iPv4CidrRange" - } - ) - claims = "FakeStringValue" - protocols = 25 - routingPolicyType = "none" - vpnTrafficDirection = "outbound" - } - ) - windowsInformationProtectionDomain = "FakeStringValue" - enableConditionalAccess = $True - '@odata.type' = "#microsoft.graph.windows10VpnConfiguration" - enableSplitTunneling = $True - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } It 'Should return Values from the Get method' { @@ -539,122 +538,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - dnsRules = @( - @{ - servers = @("FakeStringValue") - proxyServerUri = "FakeStringValue" - name = "FakeStringValue" - persistent = $True - autoTrigger = $True - } - ) - authenticationMethod = "certificate" - proxyServer = @{ - bypassProxyServerForLocalAddress = $True - '@odata.type' = "#microsoft.graph.windows10VpnProxyServer" - address = "FakeStringValue" - automaticConfigurationScriptUrl = "FakeStringValue" - automaticallyDetectProxySettings = $True - port = 25 - } - rememberUserCredentials = $True - enableDnsRegistration = $True - associatedApps = @( - @{ - identifier = "FakeStringValue" - appType = "desktop" - } - ) - routes = @( - @{ - prefixSize = 25 - destinationPrefix = "FakeStringValue" - } - ) - trustedNetworkDomains = @("FakeStringValue") - enableDeviceTunnel = $True - singleSignOnIssuerHash = "FakeStringValue" - singleSignOnEku = @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - microsoftTunnelSiteId = "FakeStringValue" - enableSingleSignOnWithAlternateCertificate = $True - onlyAssociatedAppsCanUseConnection = $True - dnsSuffixes = @("FakeStringValue") - profileTarget = "user" - enableAlwaysOn = $True - servers = @( - @{ - isDefaultServer = $True - description = "FakeStringValue" - address = "FakeStringValue" - } - ) - connectionType = "pulseSecure" - connectionName = "FakeStringValue" - cryptographySuite = @{ - cipherTransformConstants = "aes256" - encryptionMethod = "aes256" - pfsGroup = "pfs1" - dhGroup = "group1" - integrityCheckMethod = "sha2_256" - authenticationTransformConstants = "md5_96" - } - trafficRules = @( - @{ - remotePortRanges = @( - @{ - lowerNumber = 25 - upperNumber = 25 - } - ) - name = "FakeStringValue" - appId = "FakeStringValue" - localPortRanges = @( - @{ - lowerNumber = 25 - upperNumber = 25 - } - ) - appType = "none" - localAddressRanges = @( - @{ - cidrAddress = "FakeStringValue" - upperAddress = "FakeStringValue" - lowerAddress = "FakeStringValue" - '@odata.type' = "#microsoft.graph.iPv4CidrRange" - } - ) - remoteAddressRanges = @( - @{ - cidrAddress = "FakeStringValue" - upperAddress = "FakeStringValue" - lowerAddress = "FakeStringValue" - '@odata.type' = "#microsoft.graph.iPv4CidrRange" - } - ) - claims = "FakeStringValue" - protocols = 25 - routingPolicyType = "none" - vpnTrafficDirection = "outbound" - } - ) - windowsInformationProtectionDomain = "FakeStringValue" - enableConditionalAccess = $True - '@odata.type' = "#microsoft.graph.windows10VpnConfiguration" - enableSplitTunneling = $True - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } @@ -676,8 +559,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { connectionName = "FakeStringValue" connectionType = "pulseSecure" cryptographySuite = (New-CimInstance -ClassName MSFT_MicrosoftGraphcryptographySuite -Property @{ - cipherTransformConstants = "aes256" - encryptionMethod = "aes256" + cipherTransformConstants = "aes512" # Updated property + encryptionMethod = "aes512" # Updated property pfsGroup = "pfs1" dhGroup = "group1" integrityCheckMethod = "sha2_256" @@ -776,108 +659,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - dnsRules = @( - @{ - servers = @("FakeStringValue") - name = "FakeStringValue" - proxyServerUri = "FakeStringValue" - } - ) - singleSignOnEku = @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - singleSignOnIssuerHash = "FakeStringValue" - associatedApps = @( - @{ - identifier = "FakeStringValue" - appType = "desktop" - } - ) - trustedNetworkDomains = @("FakeStringValue") - routes = @( - @{ - prefixSize = 7 - destinationPrefix = "FakeStringValue" - } - ) - microsoftTunnelSiteId = "FakeStringValue" - connectionName = "FakeStringValue" - dnsSuffixes = @("FakeStringValue") - profileTarget = "user" - authenticationMethod = "certificate" - servers = @( - @{ - description = "FakeStringValue" - address = "FakeStringValue" - } - ) - connectionType = "pulseSecure" - trafficRules = @( - @{ - remotePortRanges = @( - @{ - lowerNumber = 7 - upperNumber = 7 - } - ) - name = "FakeStringValue" - appId = "FakeStringValue" - localPortRanges = @( - @{ - lowerNumber = 7 - upperNumber = 7 - } - ) - appType = "none" - localAddressRanges = @( - @{ - cidrAddress = "FakeStringValue" - upperAddress = "FakeStringValue" - lowerAddress = "FakeStringValue" - '@odata.type' = "#microsoft.graph.iPv4CidrRange" - } - ) - remoteAddressRanges = @( - @{ - cidrAddress = "FakeStringValue" - upperAddress = "FakeStringValue" - lowerAddress = "FakeStringValue" - '@odata.type' = "#microsoft.graph.iPv4CidrRange" - } - ) - claims = "FakeStringValue" - protocols = 7 - routingPolicyType = "none" - vpnTrafficDirection = "outbound" - } - ) - windowsInformationProtectionDomain = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windows10VpnConfiguration" - proxyServer = @{ - port = 7 - automaticConfigurationScriptUrl = "FakeStringValue" - address = "FakeStringValue" - '@odata.type' = "#microsoft.graph.windows10VpnProxyServer" - } - cryptographySuite = @{ - cipherTransformConstants = "aes256" - encryptionMethod = "aes256" - pfsGroup = "pfs1" - dhGroup = "group1" - integrityCheckMethod = "sha2_256" - authenticationTransformConstants = "md5_96" - } - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -901,123 +682,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - dnsRules = @( - @{ - servers = @("FakeStringValue") - proxyServerUri = "FakeStringValue" - name = "FakeStringValue" - persistent = $True - autoTrigger = $True - } - ) - authenticationMethod = "certificate" - proxyServer = @{ - bypassProxyServerForLocalAddress = $True - '@odata.type' = "#microsoft.graph.windows10VpnProxyServer" - address = "FakeStringValue" - automaticConfigurationScriptUrl = "FakeStringValue" - automaticallyDetectProxySettings = $True - port = 25 - } - rememberUserCredentials = $True - enableDnsRegistration = $True - associatedApps = @( - @{ - identifier = "FakeStringValue" - appType = "desktop" - } - ) - routes = @( - @{ - prefixSize = 25 - destinationPrefix = "FakeStringValue" - } - ) - trustedNetworkDomains = @("FakeStringValue") - enableDeviceTunnel = $True - singleSignOnIssuerHash = "FakeStringValue" - singleSignOnEku = @{ - objectIdentifier = "FakeStringValue" - name = "FakeStringValue" - } - microsoftTunnelSiteId = "FakeStringValue" - enableSingleSignOnWithAlternateCertificate = $True - onlyAssociatedAppsCanUseConnection = $True - dnsSuffixes = @("FakeStringValue") - profileTarget = "user" - enableAlwaysOn = $True - servers = @( - @{ - isDefaultServer = $True - description = "FakeStringValue" - address = "FakeStringValue" - } - ) - connectionType = "pulseSecure" - connectionName = "FakeStringValue" - cryptographySuite = @{ - cipherTransformConstants = "aes256" - encryptionMethod = "aes256" - pfsGroup = "pfs1" - dhGroup = "group1" - integrityCheckMethod = "sha2_256" - authenticationTransformConstants = "md5_96" - } - trafficRules = @( - @{ - remotePortRanges = @( - @{ - lowerNumber = 25 - upperNumber = 25 - } - ) - name = "FakeStringValue" - appId = "FakeStringValue" - localPortRanges = @( - @{ - lowerNumber = 25 - upperNumber = 25 - } - ) - appType = "none" - localAddressRanges = @( - @{ - cidrAddress = "FakeStringValue" - upperAddress = "FakeStringValue" - lowerAddress = "FakeStringValue" - '@odata.type' = "#microsoft.graph.iPv4CidrRange" - } - ) - remoteAddressRanges = @( - @{ - cidrAddress = "FakeStringValue" - upperAddress = "FakeStringValue" - lowerAddress = "FakeStringValue" - '@odata.type' = "#microsoft.graph.iPv4CidrRange" - } - ) - claims = "FakeStringValue" - protocols = 25 - routingPolicyType = "none" - vpnTrafficDirection = "outbound" - } - ) - windowsInformationProtectionDomain = "FakeStringValue" - enableConditionalAccess = $True - '@odata.type' = "#microsoft.graph.windows10VpnConfiguration" - enableSplitTunneling = $True - } - description = "FakeStringValue" - displayName = "FakeStringValue" - id = "FakeStringValue" - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationWindowsTeamPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationWindowsTeamPolicyWindows10.Tests.ps1 index afe344d49e..0269630343 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationWindowsTeamPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationWindowsTeamPolicyWindows10.Tests.ps1 @@ -45,6 +45,36 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName New-M365DSCConnection -MockWith { return "Credentials" } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + settingsDefaultVolume = 25 + welcomeScreenMeetingInformation = "userDefined" + settingsScreenTimeoutInMinutes = 25 + settingsBlockMyMeetingsAndFiles = $True + '@odata.type' = "#microsoft.graph.windows10TeamGeneralConfiguration" + maintenanceWindowDurationInHours = 25 + azureOperationalInsightsBlockTelemetry = $True + miracastChannel = "userDefined" + welcomeScreenBackgroundImageUrl = "FakeStringValue" + settingsBlockSessionResume = $True + settingsSessionTimeoutInMinutes = 25 + azureOperationalInsightsWorkspaceKey = "FakeStringValue" + welcomeScreenBlockAutomaticWakeUp = $True + miracastRequirePin = $True + maintenanceWindowStartTime = "00:00:00" + settingsBlockSigninSuggestions = $True + maintenanceWindowBlocked = $True + miracastBlocked = $True + settingsSleepTimeoutInMinutes = 25 + azureOperationalInsightsWorkspaceId = "FakeStringValue" + connectAppBlockAutoLaunch = $True + } + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + Id = "FakeStringValue" + } + } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } # Mock Write-M365DSCHost to hide output during the tests @@ -81,7 +111,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SettingsScreenTimeoutInMinutes = 25 SettingsSessionTimeoutInMinutes = 25 SettingsSleepTimeoutInMinutes = 25 - SupportsScopeTags = $True WelcomeScreenBackgroundImageUrl = "FakeStringValue" WelcomeScreenBlockAutomaticWakeUp = $True WelcomeScreenMeetingInformation = "userDefined" @@ -128,46 +157,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SettingsScreenTimeoutInMinutes = 25 SettingsSessionTimeoutInMinutes = 25 SettingsSleepTimeoutInMinutes = 25 - SupportsScopeTags = $True WelcomeScreenBackgroundImageUrl = "FakeStringValue" WelcomeScreenBlockAutomaticWakeUp = $True WelcomeScreenMeetingInformation = "userDefined" Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - settingsDefaultVolume = 25 - welcomeScreenMeetingInformation = "userDefined" - settingsScreenTimeoutInMinutes = 25 - settingsBlockMyMeetingsAndFiles = $True - '@odata.type' = "#microsoft.graph.windows10TeamGeneralConfiguration" - maintenanceWindowDurationInHours = 25 - azureOperationalInsightsBlockTelemetry = $True - miracastChannel = "userDefined" - welcomeScreenBackgroundImageUrl = "FakeStringValue" - settingsBlockSessionResume = $True - settingsSessionTimeoutInMinutes = 25 - azureOperationalInsightsWorkspaceKey = "FakeStringValue" - welcomeScreenBlockAutomaticWakeUp = $True - miracastRequirePin = $True - maintenanceWindowStartTime = "00:00:00" - settingsBlockSigninSuggestions = $True - maintenanceWindowBlocked = $True - miracastBlocked = $True - settingsSleepTimeoutInMinutes = 25 - azureOperationalInsightsWorkspaceId = "FakeStringValue" - connectAppBlockAutoLaunch = $True - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - SupportsScopeTags = $True - - } - } } It 'Should return Values from the Get method' { @@ -206,49 +201,14 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SettingsScreenTimeoutInMinutes = 25 SettingsSessionTimeoutInMinutes = 25 SettingsSleepTimeoutInMinutes = 25 - SupportsScopeTags = $True WelcomeScreenBackgroundImageUrl = "FakeStringValue" WelcomeScreenBlockAutomaticWakeUp = $True WelcomeScreenMeetingInformation = "userDefined" Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - settingsDefaultVolume = 25 - welcomeScreenMeetingInformation = "userDefined" - settingsScreenTimeoutInMinutes = 25 - settingsBlockMyMeetingsAndFiles = $True - '@odata.type' = "#microsoft.graph.windows10TeamGeneralConfiguration" - maintenanceWindowDurationInHours = 25 - azureOperationalInsightsBlockTelemetry = $True - miracastChannel = "userDefined" - welcomeScreenBackgroundImageUrl = "FakeStringValue" - settingsBlockSessionResume = $True - settingsSessionTimeoutInMinutes = 25 - azureOperationalInsightsWorkspaceKey = "FakeStringValue" - welcomeScreenBlockAutomaticWakeUp = $True - miracastRequirePin = $True - maintenanceWindowStartTime = "00:00:00" - settingsBlockSigninSuggestions = $True - maintenanceWindowBlocked = $True - miracastBlocked = $True - settingsSleepTimeoutInMinutes = 25 - azureOperationalInsightsWorkspaceId = "FakeStringValue" - connectAppBlockAutoLaunch = $True - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - SupportsScopeTags = $True - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -273,39 +233,16 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SettingsBlockMyMeetingsAndFiles = $True SettingsBlockSessionResume = $True SettingsBlockSigninSuggestions = $True - SettingsDefaultVolume = 25 + SettingsDefaultVolume = 7 # Updated property SettingsScreenTimeoutInMinutes = 25 SettingsSessionTimeoutInMinutes = 25 SettingsSleepTimeoutInMinutes = 25 - SupportsScopeTags = $True WelcomeScreenBackgroundImageUrl = "FakeStringValue" WelcomeScreenBlockAutomaticWakeUp = $True WelcomeScreenMeetingInformation = "userDefined" Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - maintenanceWindowDurationInHours = 7 - settingsScreenTimeoutInMinutes = 7 - welcomeScreenMeetingInformation = "userDefined" - settingsDefaultVolume = 7 - azureOperationalInsightsWorkspaceId = "FakeStringValue" - miracastChannel = "userDefined" - azureOperationalInsightsWorkspaceKey = "FakeStringValue" - settingsSessionTimeoutInMinutes = 7 - maintenanceWindowStartTime = "00:00:00" - '@odata.type' = "#microsoft.graph.windows10TeamGeneralConfiguration" - welcomeScreenBackgroundImageUrl = "FakeStringValue" - settingsSleepTimeoutInMinutes = 7 - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - } - } } It 'Should return Values from the Get method' { @@ -329,40 +266,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - settingsDefaultVolume = 25 - welcomeScreenMeetingInformation = "userDefined" - settingsScreenTimeoutInMinutes = 25 - settingsBlockMyMeetingsAndFiles = $True - '@odata.type' = "#microsoft.graph.windows10TeamGeneralConfiguration" - maintenanceWindowDurationInHours = 25 - azureOperationalInsightsBlockTelemetry = $True - miracastChannel = "userDefined" - welcomeScreenBackgroundImageUrl = "FakeStringValue" - settingsBlockSessionResume = $True - settingsSessionTimeoutInMinutes = 25 - azureOperationalInsightsWorkspaceKey = "FakeStringValue" - welcomeScreenBlockAutomaticWakeUp = $True - miracastRequirePin = $True - maintenanceWindowStartTime = "00:00:00" - settingsBlockSigninSuggestions = $True - maintenanceWindowBlocked = $True - miracastBlocked = $True - settingsSleepTimeoutInMinutes = 25 - azureOperationalInsightsWorkspaceId = "FakeStringValue" - connectAppBlockAutoLaunch = $True - } - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - Id = "FakeStringValue" - SupportsScopeTags = $True - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationWiredNetworkPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationWiredNetworkPolicyWindows10.Tests.ps1 index 2f57621990..88a4e1fff0 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationWiredNetworkPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceConfigurationWiredNetworkPolicyWindows10.Tests.ps1 @@ -47,24 +47,69 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } - $Script:exportedInstances =$null + $Script:exportedInstance = $null $Script:ExportMode = $false Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { } - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + outerIdentityPrivacyTemporaryValue = 'FakeStringValue' + eapType = 'eapTls' + forceFIPSCompliance = $True + '@odata.type' = '#microsoft.graph.windowsWiredNetworkConfiguration' + secondaryAuthenticationMethod = 'certificate' + cacheCredentials = $True + innerAuthenticationProtocolForEAPTTLS = 'unencryptedPassword' + requireCryptographicBinding = $True + authenticationType = 'none' + trustedServerCertificateNames = @('FakeStringValue') + enforce8021X = $True + authenticationRetryDelayPeriodInSeconds = 25 + performServerValidation = $True + authenticationBlockPeriodInMinutes = 25 + maximumEAPOLStartMessages = 25 + disableUserPromptForServerValidation = $True + authenticationPeriodInSeconds = 25 + eapolStartPeriodInSeconds = 25 + authenticationMethod = 'certificate' + maximumAuthenticationFailures = 25 + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + } } - Mock -CommandName Update-DeviceConfigurationPolicyCertificateId -MockWith { - } + Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { + return @(@{ + Id = 'a485d322-13cd-43ef-beda-733f656f48ea' + DisplayName = 'RootCertificate' + }) + } -ParameterFilter { $CertificateName -eq 'rootCertificatesForServerValidation' } - Mock -CommandName Remove-DeviceConfigurationPolicyCertificateId -MockWith { - } + Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { + return @{ + Id = '0b9aef2f-1671-4260-8eb9-3ab3138e176a' + DisplayName = 'ClientCertificate' + } + } -ParameterFilter { $CertificateName -eq 'secondaryIdentityCertificateForClientAuthentication' } Mock -CommandName Get-IntuneDeviceConfigurationCertificateId -MockWith { + return 'a485d322-13cd-43ef-beda-733f656f48ea' + } -ParameterFilter { $CertificateDisplayName -eq 'RootCertificate' } + + Mock -CommandName Get-IntuneDeviceConfigurationCertificateId -MockWith { + return '0b9aef2f-1671-4260-8eb9-3ab3138e176a' + } -ParameterFilter { $CertificateDisplayName -eq 'ClientCertificate' } + + Mock -CommandName Update-DeviceConfigurationPolicyCertificateId -MockWith { } + Mock -CommandName Remove-DeviceConfigurationPolicyCertificateId -MockWith { + } } # Test contexts Context -Name 'The IntuneDeviceConfigurationWiredNetworkPolicyWindows10 should exist but it DOES NOT' -Fixture { @@ -103,27 +148,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { return $null } - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @(@{ - Id = 'a485d322-13cd-43ef-beda-733f656f48ea' - DisplayName = 'RootCertificate' - }) - } -ParameterFilter { $CertificateName -eq 'rootCertificatesForServerValidation' } - - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @{ - Id = '0b9aef2f-1671-4260-8eb9-3ab3138e176a' - DisplayName = 'ClientCertificate' - } - } -ParameterFilter { $CertificateName -eq 'secondaryIdentityCertificateForClientAuthentication' } - - Mock -CommandName Get-IntuneDeviceConfigurationCertificateId -MockWith { - return 'a485d322-13cd-43ef-beda-733f656f48ea' - } -ParameterFilter { $DisplayName -eq 'RootCertificate' } - - Mock -CommandName Get-IntuneDeviceConfigurationCertificateId -MockWith { - return '0b9aef2f-1671-4260-8eb9-3ab3138e176a' - } -ParameterFilter { $DisplayName -eq 'ClientCertificate' } } It 'Should return Values from the Get method' { (Get-TargetResource @testParams).Ensure | Should -Be 'Absent' @@ -169,58 +193,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SecondaryIdentityCertificateForClientAuthenticationId = '0b9aef2f-1671-4260-8eb9-3ab3138e176a' SecondaryIdentityCertificateForClientAuthenticationDisplayName = 'ClientCertificate' } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - outerIdentityPrivacyTemporaryValue = 'FakeStringValue' - eapType = 'eapTls' - forceFIPSCompliance = $True - '@odata.type' = '#microsoft.graph.windowsWiredNetworkConfiguration' - secondaryAuthenticationMethod = 'certificate' - cacheCredentials = $True - innerAuthenticationProtocolForEAPTTLS = 'unencryptedPassword' - requireCryptographicBinding = $True - authenticationType = 'none' - trustedServerCertificateNames = @('FakeStringValue') - enforce8021X = $True - authenticationRetryDelayPeriodInSeconds = 25 - performServerValidation = $True - authenticationBlockPeriodInMinutes = 25 - maximumEAPOLStartMessages = 25 - disableUserPromptForServerValidation = $True - authenticationPeriodInSeconds = 25 - eapolStartPeriodInSeconds = 25 - authenticationMethod = 'certificate' - maximumAuthenticationFailures = 25 - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } - - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @(@{ - Id = 'a485d322-13cd-43ef-beda-733f656f48ea' - DisplayName = 'RootCertificate' - }) - } -ParameterFilter { $CertificateName -eq 'rootCertificatesForServerValidation' } - - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @{ - Id = '0b9aef2f-1671-4260-8eb9-3ab3138e176a' - DisplayName = 'ClientCertificate' - } - } -ParameterFilter { $CertificateName -eq 'secondaryIdentityCertificateForClientAuthentication' } - - Mock -CommandName Get-IntuneDeviceConfigurationCertificateId -MockWith { - return 'a485d322-13cd-43ef-beda-733f656f48ea' - } -ParameterFilter { $DisplayName -eq 'RootCertificate' } - - Mock -CommandName Get-IntuneDeviceConfigurationCertificateId -MockWith { - return '0b9aef2f-1671-4260-8eb9-3ab3138e176a' - } -ParameterFilter { $DisplayName -eq 'ClientCertificate' } } It 'Should return Values from the Get method' { @@ -266,50 +238,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { RootCertificatesForServerValidationIds = @('a485d322-13cd-43ef-beda-733f656f48ea') SecondaryIdentityCertificateForClientAuthenticationId = '0b9aef2f-1671-4260-8eb9-3ab3138e176a' } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - outerIdentityPrivacyTemporaryValue = 'FakeStringValue' - eapType = 'eapTls' - forceFIPSCompliance = $True - '@odata.type' = '#microsoft.graph.windowsWiredNetworkConfiguration' - secondaryAuthenticationMethod = 'certificate' - cacheCredentials = $True - innerAuthenticationProtocolForEAPTTLS = 'unencryptedPassword' - requireCryptographicBinding = $True - authenticationType = 'none' - trustedServerCertificateNames = @('FakeStringValue') - enforce8021X = $True - authenticationRetryDelayPeriodInSeconds = 25 - performServerValidation = $True - authenticationBlockPeriodInMinutes = 25 - maximumEAPOLStartMessages = 25 - disableUserPromptForServerValidation = $True - authenticationPeriodInSeconds = 25 - eapolStartPeriodInSeconds = 25 - authenticationMethod = 'certificate' - maximumAuthenticationFailures = 25 - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } - - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @(@{ - Id = 'a485d322-13cd-43ef-beda-733f656f48ea' - DisplayName = 'RootCertificate' - }) - } -ParameterFilter { $CertificateName -eq 'rootCertificatesForServerValidation' } - - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @{ - Id = '0b9aef2f-1671-4260-8eb9-3ab3138e176a' - DisplayName = 'ClientCertificate' - } - } -ParameterFilter { $CertificateName -eq 'secondaryIdentityCertificateForClientAuthentication' } } It 'Should return true from the Test method' { @@ -329,7 +257,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Description = 'FakeStringValue' DisableUserPromptForServerValidation = $True DisplayName = 'FakeStringValue' - EapolStartPeriodInSeconds = 25 + EapolStartPeriodInSeconds = 7 # Updated property EapType = 'eapTls' Enforce8021X = $True ForceFIPSCompliance = $True @@ -349,52 +277,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SecondaryIdentityCertificateForClientAuthenticationId = '0b9aef2f-1671-4260-8eb9-3ab3138e176a' SecondaryIdentityCertificateForClientAuthenticationDisplayName = 'ClientCertificate' } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - eapolStartPeriodInSeconds = 7 - authenticationPeriodInSeconds = 7 - trustedServerCertificateNames = @('FakeStringValue') - authenticationBlockPeriodInMinutes = 7 - authenticationRetryDelayPeriodInSeconds = 7 - authenticationMethod = 'certificate' - authenticationType = 'none' - innerAuthenticationProtocolForEAPTTLS = 'unencryptedPassword' - outerIdentityPrivacyTemporaryValue = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.windowsWiredNetworkConfiguration' - maximumEAPOLStartMessages = 7 - eapType = 'eapTls' - secondaryAuthenticationMethod = 'certificate' - maximumAuthenticationFailures = 7 - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } - - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @(@{ - Id = 'a485d322-13cd-43ef-beda-733f656f48ea' - DisplayName = 'RootCertificate' - }) - } -ParameterFilter { $CertificateName -eq 'rootCertificatesForServerValidation' } - - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @{ - Id = '0b9aef2f-1671-4260-8eb9-3ab3138e176a' - DisplayName = 'ClientCertificate' - } - } -ParameterFilter { $CertificateName -eq 'secondaryIdentityCertificateForClientAuthentication' } - - Mock -CommandName Get-IntuneDeviceConfigurationCertificateId -MockWith { - return 'a485d322-13cd-43ef-beda-733f656f48ea' - } -ParameterFilter { $DisplayName -eq 'RootCertificate' } - - Mock -CommandName Get-IntuneDeviceConfigurationCertificateId -MockWith { - return '0b9aef2f-1671-4260-8eb9-3ab3138e176a' - } -ParameterFilter { $DisplayName -eq 'ClientCertificate' } } It 'Should return Values from the Get method' { @@ -418,52 +300,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - outerIdentityPrivacyTemporaryValue = 'FakeStringValue' - eapType = 'eapTls' - forceFIPSCompliance = $True - '@odata.type' = '#microsoft.graph.windowsWiredNetworkConfiguration' - secondaryAuthenticationMethod = 'certificate' - cacheCredentials = $True - innerAuthenticationProtocolForEAPTTLS = 'unencryptedPassword' - requireCryptographicBinding = $True - authenticationType = 'none' - trustedServerCertificateNames = @('FakeStringValue') - enforce8021X = $True - authenticationRetryDelayPeriodInSeconds = 25 - performServerValidation = $True - authenticationBlockPeriodInMinutes = 25 - maximumEAPOLStartMessages = 25 - disableUserPromptForServerValidation = $True - authenticationPeriodInSeconds = 25 - eapolStartPeriodInSeconds = 25 - authenticationMethod = 'certificate' - maximumAuthenticationFailures = 25 - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } - - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @(@{ - Id = 'a485d322-13cd-43ef-beda-733f656f48ea' - DisplayName = 'RootCertificate' - }) - } -ParameterFilter { $CertificateName -eq 'rootCertificatesForServerValidation' } - - Mock -CommandName Get-DeviceConfigurationPolicyCertificate -MockWith { - return @{ - Id = '0b9aef2f-1671-4260-8eb9-3ab3138e176a' - DisplayName = 'ClientCertificate' - } - } -ParameterFilter { $CertificateName -eq 'secondaryIdentityCertificateForClientAuthentication' } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentLimitRestriction.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentLimitRestriction.Tests.ps1 index 4b10dd3945..730159a1c2 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentLimitRestriction.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentLimitRestriction.Tests.ps1 @@ -44,6 +44,18 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.deviceEnrollmentLimitConfiguration' + Limit = 15 + } + Id = '12345-12345-12345-12345-12345_Limit' + Priority = 1 + DisplayName = 'My DSC Restriction' + } + } + Mock -CommandName Invoke-MgGraphRequest -MockWith { } @@ -104,21 +116,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = 'My DSC Restriction' Ensure = 'Present' Credential = $Credential - Limit = 15 + Limit = 12 # Updated property Priority = 1 } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceEnrollmentLimitConfiguration' - Limit = 12 # Drift - } - Priority = 1 - Id = '12345-12345-12345-12345-12345_Limit' - DisplayName = 'My DSC Restriction'; - } - } } It 'Should return Present from the Get method' { @@ -145,18 +145,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Limit = 15 Priority = 1 } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceEnrollmentLimitConfiguration' - Limit = 15 - } - Id = '12345-12345-12345-12345-12345_Limit' - Priority = 1 - DisplayName = 'My DSC Restriction' - } - } } It 'Should return true from the Test method' { @@ -174,18 +162,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Priority = 1 Limit = 15 } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceEnrollmentLimitConfiguration' - Limit = 12 - } - Id = '12345-12345-12345-12345-12345_Limit' - Priority = 1 - DisplayName = 'My DSC Restriction' - } - } } It 'Should return Present from the Get method' { @@ -209,18 +185,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceEnrollmentLimitConfiguration' - Limit = 12 - } - Id = '12345-12345-12345-12345-12345_Limit' - Priority = 1 - DisplayName = 'My DSC Restriction' - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentPlatformRestriction.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentPlatformRestriction.Tests.ps1 index 53d8f74e1a..a88aae733d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentPlatformRestriction.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentPlatformRestriction.Tests.ps1 @@ -42,6 +42,24 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.deviceEnrollmentPlatformRestrictionConfiguration' + PlatformRestriction = @{ + PersonalDeviceEnrollmentBlocked = $False + PlatformBlocked = $False + } + platformType = 'ios' + } + id = '12345-12345-12345-12345-12345_SinglePlatformRestriction' + DeviceEnrollmentConfigurationType = 'singlePlatformRestriction' + Description = '' + DisplayName = 'My DSC Restriction' + Priority = 1 + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfigurationAssignment -MockWith { return @() } @@ -119,24 +137,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { personalDeviceEnrollmentBlocked = $False } -ClientOnly) } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceEnrollmentPlatformRestrictionConfiguration' - PlatformRestriction = @{ - PersonalDeviceEnrollmentBlocked = $False - PlatformBlocked = $False - } - platformType = 'ios' - } - id = '12345-12345-12345-12345-12345_SinglePlatformRestriction' - DeviceEnrollmentConfigurationType = 'singlePlatformRestriction' - Description = '' - DisplayName = 'My DSC Restriction' - Priority = 1 - } - } } It 'Should return true from the Test method' { @@ -156,27 +156,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Priority = 1 IosRestriction = (New-CimInstance -ClassName MSFT_DeviceEnrollmentPlatformRestriction -Property @{ platformBlocked = $False - personalDeviceEnrollmentBlocked = $False + personalDeviceEnrollmentBlocked = $True # Updated property } -ClientOnly) } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceEnrollmentPlatformRestrictionConfiguration' - PlatformRestriction = @{ - PersonalDeviceEnrollmentBlocked = $true; #drift - PlatformBlocked = $False - } - platformType = 'ios' - } - id = '12345-12345-12345-12345-12345_SinglePlatformRestriction' - DeviceEnrollmentConfigurationType = 'singlePlatformRestriction' - Description = '' - DisplayName = 'My DSC Restriction' - Priority = 1 - } - } } It 'Should return false from the Test method' { @@ -199,24 +181,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { personalDeviceEnrollmentBlocked = $False } -ClientOnly) } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceEnrollmentPlatformRestrictionConfiguration' - PlatformRestriction = @{ - PersonalDeviceEnrollmentBlocked = $False - PlatformBlocked = $False - } - platformType = 'ios' - } - id = '12345-12345-12345-12345-12345_SinglePlatformRestriction' - DeviceEnrollmentConfigurationType = 'singlePlatformRestriction' - Description = '' - DisplayName = 'My DSC Restriction' - Priority = 1 - } - } } It 'Should return Present from the Get method' { @@ -240,24 +204,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceEnrollmentPlatformRestrictionConfiguration' - PlatformRestriction = @{ - PersonalDeviceEnrollmentBlocked = $False - PlatformBlocked = $False - } - platformType = 'ios' - } - id = '12345-12345-12345-12345-12345_SinglePlatformRestriction' - DeviceEnrollmentConfigurationType = 'singlePlatformRestriction' - Description = '' - DisplayName = 'My DSC Restriction' - Priority = 1 - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentStatusPageWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentStatusPageWindows10.Tests.ps1 index 09d6ec1316..bc90e410c8 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentStatusPageWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceEnrollmentStatusPageWindows10.Tests.ps1 @@ -56,6 +56,29 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return @() } + Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { + return @{ + Id = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Description = 'FakeStringValue' + AdditionalProperties = @{ + trackInstallProgressForAutopilotOnly = $True + '@odata.type' = '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration' + disableUserStatusTrackingAfterFirstUser = $True + installQualityUpdates = $True + showInstallationProgress = $True + selectedMobileAppIds = @('FakeGuidValue') + blockDeviceSetupRetryByUser = $True + allowDeviceUseOnInstallFailure = $True + customErrorMessage = 'FakeStringValue' + allowNonBlockingAppInstallation = $True + allowLogCollectionOnInstallFailure = $True + allowDeviceResetOnInstallFailure = $True + installProgressTimeoutInMinutes = 25 + } + } + } + Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith {} Mock Update-DeviceEnrollmentConfigurationPriority {} @@ -135,29 +158,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - Id = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - trackInstallProgressForAutopilotOnly = $True - '@odata.type' = '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration' - disableUserStatusTrackingAfterFirstUser = $True - installQualityUpdates = $True - showInstallationProgress = $True - selectedMobileAppIds = @('FakeGuidValue') - blockDeviceSetupRetryByUser = $True - allowDeviceUseOnInstallFailure = $True - customErrorMessage = 'FakeStringValue' - allowNonBlockingAppInstallation = $True - allowLogCollectionOnInstallFailure = $True - allowDeviceResetOnInstallFailure = $True - installProgressTimeoutInMinutes = 25 - } - } - } } It 'Should return Values from the Get method' { @@ -195,30 +195,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - Id = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - trackInstallProgressForAutopilotOnly = $True - '@odata.type' = '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration' - disableUserStatusTrackingAfterFirstUser = $True - installQualityUpdates = $True - showInstallationProgress = $True - selectedMobileAppIds = @('FakeGuidValue') - blockDeviceSetupRetryByUser = $True - allowDeviceUseOnInstallFailure = $True - customErrorMessage = 'FakeStringValue' - allowNonBlockingAppInstallation = $True - allowLogCollectionOnInstallFailure = $True - allowDeviceResetOnInstallFailure = $True - installProgressTimeoutInMinutes = 25 - } - Priority = 25 - } - } } It 'Should return true from the Test method' { @@ -247,30 +223,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - Id = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - trackInstallProgressForAutopilotOnly = $True - '@odata.type' = '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration' - disableUserStatusTrackingAfterFirstUser = $True - installQualityUpdates = $True - showInstallationProgress = $True - selectedMobileAppIds = @('FakeGuidValue') - blockDeviceSetupRetryByUser = $True - allowDeviceUseOnInstallFailure = $True - customErrorMessage = 'FakeStringValue' - allowNonBlockingAppInstallation = $True - allowLogCollectionOnInstallFailure = $True - allowDeviceResetOnInstallFailure = $True - installProgressTimeoutInMinutes = 25 - } - Priority = 25 - } - } } @@ -285,7 +237,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Id = 'FakeStringValue' DisplayName = 'FakeStringValue' Description = 'FakeStringValue' - AllowDeviceResetOnInstallFailure = $True + AllowDeviceResetOnInstallFailure = $False # Updated property AllowDeviceUseOnInstallFailure = $True AllowLogCollectionOnInstallFailure = $True AllowNonBlockingAppInstallation = $True @@ -300,22 +252,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - Id = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - installProgressTimeoutInMinutes = 7 - customErrorMessage = 'FakeStringValue' - trackInstallProgressForAutopilotOnly = $False - selectedMobileAppIds = @('FakeGuidValue') - showInstallationProgress = $False - } - Priority = 7 - } - } } It 'Should return Values from the Get method' { @@ -347,28 +283,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisableUserStatusTrackingAfterFirstUser = $True InstallProgressTimeoutInMinutes = 25 InstallQualityUpdates = $True - SelectedMobileAppNames = @('FakeStringValue') + SelectedMobileAppNames = @('NewApp') # Updated property ShowInstallationProgress = $True TrackInstallProgressForAutopilotOnly = $True Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - Id = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - installProgressTimeoutInMinutes = 7 - customErrorMessage = 'FakeStringValue' - trackInstallProgressForAutopilotOnly = $False - selectedMobileAppIds = @('FakeGuidValue') - showInstallationProgress = $False - } - Priority = 7 - } - } } It 'Should return Values from the Get method' { @@ -392,30 +312,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceEnrollmentConfiguration -MockWith { - return @{ - Id = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - trackInstallProgressForAutopilotOnly = $True - '@odata.type' = '#microsoft.graph.windows10EnrollmentCompletionPageConfiguration' - disableUserStatusTrackingAfterFirstUser = $True - installQualityUpdates = $True - showInstallationProgress = $True - selectedMobileAppIds = @('FakeGuidValue') - blockDeviceSetupRetryByUser = $True - allowDeviceUseOnInstallFailure = $True - customErrorMessage = 'FakeStringValue' - allowNonBlockingAppInstallation = $True - allowLogCollectionOnInstallFailure = $True - allowDeviceResetOnInstallFailure = $True - installProgressTimeoutInMinutes = 25 - } - Priority = 25 - } - } } It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceFeaturesConfigurationPolicyIOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceFeaturesConfigurationPolicyIOS.Tests.ps1 index 0562b7dc8c..c807de89c6 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceFeaturesConfigurationPolicyIOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceFeaturesConfigurationPolicyIOS.Tests.ps1 @@ -39,6 +39,88 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + DisplayName = 'FakeStringValue' + Description = 'FakeStringValue' + Id = 'ab915bca-1234-4b11-8acb-719a771139bc' + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.iosDeviceFeaturesConfiguration' + wallpaperDisplayLocation = 'notConfigured' + airPrintDestinations = @( + @{ + ipAddress = '1.0.0.1' + resourcePath = 'printers/xerox_Phase' + port = 0 + forceTls = $false + } + ) + contentFilterSettings = @{ + '@odata.Type' = '#microsoft.graph.iosWebContentFilterAutoFilter' + allowedUrls = @( + 'https://www.fakeallowed.com' + ) + blockedUrls = @( + 'https://www.fakeblocked.com' + ) + } + homeScreenDockIcons = @( + @{ + '@odata.type' = '#microsoft.graph.iosHomeScreenApp' + displayName = 'Apple Store' + bundleID = 'com.apple.store.Jolly' + isWebClip = $false + } + ) + homeScreenPages = @( + @{ + icons = @( + @{ + '@odata.type' = '#microsoft.graph.iosHomeScreenApp' + displayName = 'App Store' + bundleID = 'com.apple.AppStore' + isWebClip = $false + } + ) + } + ) + notificationSettings = @( + @{ + bundleID = 'app.id' + appName = 'fakeapp' + publisher = 'fakepublisher' + enabled = $true + showInNotificationCenter = $true + showOnLockScreen = $true + alertType = 'banner' + badgesEnabled = $true + soundsEnabled = $true + previewVisibility = 'hideWhenLocked' + } + ) + singleSignOnSettings = @{ + allowedUrls = @('https://www.fakeurl.com') + displayName = 'iOS-DeviceFeatures-ContentSettingsSpecificSites' + kerberosPrincipalName = 'userPrincipalName' + kerberosRealm = 'fakerealm.com' + allowedAppsList = @( + @{ + name = 'Intune Company Portal' + appId = 'com.microsoft.companyportal' + } + ) + } + iosSingleSignOnExtension = @{ + '@odata.type' = '#microsoft.graph.iosCredentialSingleSignOnExtension' + extensionIdentifier = 'com.example.sso.credential' + teamIdentifier = '4HMSJJRMAD' + realm = 'EXAMPLE.COM' + domains = @('example.com') + } + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { return @() @@ -70,9 +152,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ipAddress = '1.0.0.1' } -ClientOnly) ) - AssetTagTemplate = 'FakeStringValue' - ContentFilterSettings = [CimInstance[]]@( + ContentFilterSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosWebContentFilterSpecificWebsitesAccess ` -Property @{ @@ -86,7 +167,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } -ClientOnly) ) LockScreenFootnote = 'FakeStringValue' - HomeScreenDockIcons = [CimInstance[]]@( + HomeScreenDockIcons = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosHomeScreenApp ` -Property @{ @@ -97,7 +178,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ) HomeScreenGridWidth = 5 HomeScreenGridHeight = 6 - HomeScreenPages = [CimInstance[]]@( + HomeScreenPages = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosHomeScreenItem ` -Property @{ @@ -112,7 +193,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ) } -ClientOnly) ) - NotificationSettings = [CimInstance[]]@( + NotificationSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosNotificationSettings ` -Property @{ @@ -128,7 +209,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { appName = 'fakeapp' } -ClientOnly) ) - SingleSignOnSettings = [CimInstance[]]@( + SingleSignOnSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosSingleSignOnSettings ` -Property @{ @@ -228,7 +309,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ipAddress = '1.0.0.1' } -ClientOnly) ) - ContentFilterSettings = [CimInstance[]]@( + ContentFilterSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosWebContentFilterSpecificWebsitesAccess ` -Property @{ @@ -241,7 +322,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ) } -ClientOnly) ) - HomeScreenDockIcons = [CimInstance[]]@( + HomeScreenDockIcons = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosHomeScreenApp ` -Property @{ @@ -250,7 +331,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { isWebClip = $False } -ClientOnly) ) - HomeScreenPages = [CimInstance[]]@( + HomeScreenPages = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosHomeScreenItem ` -Property @{ @@ -265,13 +346,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ) } -ClientOnly) ) - NotificationSettings = [CimInstance[]]@( + NotificationSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosNotificationSettings ` -Property @{ alertType = 'banner' enabled = $True - showOnLockScreen = $True + showOnLockScreen = $False # Updated property badgesEnabled = $True soundsEnabled = $True publisher = 'fakepublisher' @@ -281,7 +362,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { appName = 'fakeapp' } -ClientOnly) ) - SingleSignOnSettings = [CimInstance[]]@( + SingleSignOnSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosSingleSignOnSettings ` -Property @{ @@ -313,93 +394,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue - CHANGED' #changed - Id = 'ab915bca-1234-4b11-8acb-719a771139bc' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosDeviceFeaturesConfiguration' - wallpaperDisplayLocation = 'notConfigured' - airPrintDestinations = @( - @{ - ipAddress = '1.0.0.1' - resourcePath = 'printers/xerox_Phase' - port = 0 - forceTls = $false - } - ) - contentFilterSettings = @{ - '@odata.Type' = '#microsoft.graph.iosWebContentFilterAutoFilter' - allowedUrls = @( - 'https://www.fakeallowed.com' - ) - blockedUrls = @( - 'https://www.fakeblocked.com' - ) - } - homeScreenDockIcons = @( - @{ - '@odata.type' = '#microsoft.graph.iosHomeScreenApp' - displayName = 'Apple Store' - bundleID = 'com.apple.store.Jolly' - isWebClip = $false - } - ) - homeScreenPages = @( - @{ - icons = @( - @{ - '@odata.type' = '#microsoft.graph.iosHomeScreenApp' - displayName = 'App Store' - bundleID = 'com.apple.AppStore' - isWebClip = $false - } - ) - } - ) - notificationSettings = @( - @{ - bundleID = 'app.id' - appName = 'fakeapp' - publisher = 'fakepublisher' - enabled = $true - showInNotificationCenter = $true - showOnLockScreen = $true - alertType = 'banner' - badgesEnabled = $true - soundsEnabled = $true - previewVisibility = 'hideWhenLocked' - } - ) - singleSignOnSettings = @{ - allowedUrls = @('https://www.fakeurl.com') - displayName = 'iOS-DeviceFeatures-ContentSettingsSpecificSites' - kerberosPrincipalName = 'userPrincipalName' - kerberosRealm = 'fakerealm.com' - allowedAppsList = @( - @{ - name = 'Intune Company Portal' - appId = 'com.microsoft.companyportal' - } - ) - } - iosSingleSignOnExtension = @{ - '@odata.type' = '#microsoft.graph.iosCredentialSingleSignOnExtension' - extensionIdentifier = 'com.example.sso.credential' - teamIdentifier = '4HMSJJRMAD' - realm = 'EXAMPLE.COM' - domains = @('example.com') - } - #end additionalproperties - } - } } - } It 'Should return Present from the Get method' { - (Get-TargetResource @testParams).Ensure | Should -Be 'Present' #-Displayname 'FakeStringValue').Ensure | Should -Be 'Present' # + (Get-TargetResource @testParams).Ensure | Should -Be 'Present' } It 'Should return false from the Test method' { @@ -409,7 +407,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { It 'Should update the IntuneDeviceFeaturesConfigurationPolicyIOS from the Set method' { Set-TargetResource @testParams Should -Invoke -CommandName Update-MgBetaDeviceManagementDeviceConfiguration -Exactly 1 - } } @@ -432,7 +429,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ipAddress = '1.0.0.1' } -ClientOnly) ) - ContentFilterSettings = [CimInstance[]]@( + ContentFilterSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosWebContentFilterSpecificWebsitesAccess ` -Property @{ @@ -445,7 +442,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ) } -ClientOnly) ) - HomeScreenDockIcons = [CimInstance[]]@( + HomeScreenDockIcons = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosHomeScreenApp ` -Property @{ @@ -454,7 +451,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { isWebClip = $False } -ClientOnly) ) - HomeScreenPages = [CimInstance[]]@( + HomeScreenPages = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosHomeScreenItem ` -Property @{ @@ -469,7 +466,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ) } -ClientOnly) ) - NotificationSettings = [CimInstance[]]@( + NotificationSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosNotificationSettings ` -Property @{ @@ -485,7 +482,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { appName = 'fakeapp' } -ClientOnly) ) - SingleSignOnSettings = [CimInstance[]]@( + SingleSignOnSettings = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_iosSingleSignOnSettings ` -Property @{ @@ -517,89 +514,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - Id = 'ab915bca-1234-4b11-8acb-719a771139bc' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosDeviceFeaturesConfiguration' - wallpaperDisplayLocation = 'notConfigured' - airPrintDestinations = @( - @{ - ipAddress = '1.0.0.1' - resourcePath = 'printers/xerox_Phase' - port = 0 - forceTls = $false - } - ) - contentFilterSettings = @{ - '@odata.Type' = '#microsoft.graph.iosWebContentFilterAutoFilter' - allowedUrls = @( - 'https://www.fakeallowed.com' - ) - blockedUrls = @( - 'https://www.fakeblocked.com' - ) - } - homeScreenDockIcons = @( - @{ - '@odata.type' = '#microsoft.graph.iosHomeScreenApp' - displayName = 'Apple Store' - bundleID = 'com.apple.store.Jolly' - isWebClip = $false - } - ) - homeScreenPages = @( - @{ - icons = @( - @{ - '@odata.type' = '#microsoft.graph.iosHomeScreenApp' - displayName = 'App Store' - bundleID = 'com.apple.AppStore' - isWebClip = $false - } - ) - } - ) - notificationSettings = @( - @{ - bundleID = 'app.id' - appName = 'fakeapp' - publisher = 'fakepublisher' - enabled = $true - showInNotificationCenter = $true - showOnLockScreen = $true - alertType = 'banner' - badgesEnabled = $true - soundsEnabled = $true - previewVisibility = 'hideWhenLocked' - } - ) - singleSignOnSettings = @{ - allowedUrls = @('https://www.fakeurl.com') - displayName = 'iOS-DeviceFeatures-ContentSettingsSpecificSites' - kerberosPrincipalName = 'userPrincipalName' - kerberosRealm = 'fakerealm.com' - allowedAppsList = @( - @{ - name = 'Intune Company Portal' - appId = 'com.microsoft.companyportal' - } - ) - } - iosSingleSignOnExtension = @{ - '@odata.type' = '#microsoft.graph.iosCredentialSingleSignOnExtension' - extensionIdentifier = 'com.example.sso.credential' - teamIdentifier = '4HMSJJRMAD' - realm = 'EXAMPLE.COM' - domains = @('example.com') - } - #end additionalproperties - } - } - } } It 'Should return true from the Test method' { @@ -619,19 +533,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - Id = 'FakeStringValue' - RoleScopeTagIds = @('0') - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosDeviceFeaturesConfiguration' - wallpaperDisplayLocation = 'notConfigured' - } - } - } } It 'Should return Present from the Get method' { @@ -655,110 +556,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - Id = 'FakeStringValue' - RoleScopeTagIds = @('0') - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosDeviceFeaturesConfiguration' - airPrintDestinations = @( - @{ - ipAddress = '1.0.0.1' - resourcePath = 'printers/xerox_Phase' - port = 0 - forceTls = $false - } - ) - assetTagTemplate = 'Asset #123abc' - lockScreenFootnote = 'If Lost, Return to' - homeScreenGridWidth = 4 - homeScreenGridHeight = 5 - wallpaperDisplayLocation = 'notConfigured' - contentFilterSettings = @{ - '@odata.Type' = '#microsoft.graph.iosWebContentFilterAutoFilter' - allowedUrls = @( - 'https://www.fakeallowed.com' - ) - blockedUrls = @( - 'https://www.fakeblocked.com' - ) - } - homeScreenDockIcons = @( - @{ - '@odata.type' = '#microsoft.graph.iosHomeScreenApp' - displayName = 'Apple Store' - bundleID = 'com.apple.store.Jolly' - isWebClip = $false - } - ) - homeScreenPages = @( - @{ - icons = @( - @{ - '@odata.type' = '#microsoft.graph.iosHomeScreenApp' - displayName = 'App Store' - bundleID = 'com.apple.AppStore' - isWebClip = $false - } - ) - } - ) - notificationSettings = @( - @{ - bundleID = 'app.id' - appName = 'fakeapp' - publisher = 'fakepublisher' - enabled = $true - showInNotificationCenter = $true - showOnLockScreen = $true - alertType = 'banner' - badgesEnabled = $true - soundsEnabled = $true - previewVisibility = 'hideWhenLocked' - } - ) - singleSignOnSettings = @{ - allowedUrls = @('https://www.fakeurl.com') - displayName = 'iOS-DeviceFeatures-ContentSettingsSpecificSites' - kerberosPrincipalName = 'userPrincipalName' - kerberosRealm = 'fakerealm.com' - allowedAppsList = @( - @{ - name = 'Intune Company Portal' - appId = 'com.microsoft.companyportal' - } - ) - } - iosCredentialSingleSignOnExtension = @{ - '@odata.type' = '#microsoft.graph.iosCredentialSingleSignOnExtension' - extensionIdentifier = 'com.example.sso.credential' - teamIdentifier = '4HMSJJRMAD' - domains = @('example.com') - realm = 'EXAMPLE.COM' - configurations = @( - @{ - '@odata.type' = '#microsoft.graph.keyStringValuePair' - key = 'myString' - value = 'myvalue' - } - @{ - '@odata.type' = '#microsoft.graph.keyBooleanValuePair' - key = 'mybool' - value = $true - } - @{ - '@odata.type' = '#microsoft.graph.keyIntegerValuePair' - key = 'myInt' - value = 4 - } - ) - } - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceManagementAndroidDeviceOwnerEnrollmentProfile.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceManagementAndroidDeviceOwnerEnrollmentProfile.Tests.ps1 index 788a717aec..63a22909e4 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceManagementAndroidDeviceOwnerEnrollmentProfile.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceManagementAndroidDeviceOwnerEnrollmentProfile.Tests.ps1 @@ -40,6 +40,23 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementAndroidDeviceOwnerEnrollmentProfile -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementAndroidDeviceOwnerEnrollmentProfile -MockWith { + return @{ + Id = "164655f7-1232-4d56-ae8f-b095196a0309"; + DisplayName = "Android Owner Enrollment Profile" + Description = "Profile for enrolling Android devices" + TokenExpirationDateTime = "2024-12-31T23:59:59Z" + TokenCreationDateTime = "2024-12-31T23:59:59Z" + TokenValue = "your-token-value" + EnrollmentMode = "corporateOwnedWorkProfile" + EnrollmentTokenType = 'TokenType' + QrCodeContent = "your-qr-code-content" + WifiSsid = "your-wifi-ssid" + WifiPassword = "your-wifi-password" + WifiSecurityType = "wpa" + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -94,24 +111,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementAndroidDeviceOwnerEnrollmentProfile -MockWith { - return @{ - Id = "164655f7-1232-4d56-ae8f-b095196a0309"; - DisplayName = "Android Owner Enrollment Profile" - Description = "Profile for enrolling Android" - TokenExpirationDateTime = "2024-12-31T23:59:59Z" - TokenCreationDateTime = "2024-12-31T23:59:59Z" - TokenValue = "your-token-value" - EnrollmentMode = "corporateOwnedWorkProfile" - EnrollmentTokenType = 'TokenType' - QrCodeContent = "your-qr-code-content" - WifiSsid = "your-wifi-ssid" - WifiPassword = "your-wifi-password" - WifiSecurityType = "wpa" - Ensure = 'Present' - } - } } It 'Should return Values from the Get method' { (Get-TargetResource @testParams).Ensure | Should -Be 'Present' @@ -140,24 +139,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementAndroidDeviceOwnerEnrollmentProfile -MockWith { - return @{ - Id = "164655f7-1232-4d56-ae8f-b095196a0309"; - DisplayName = "Android Owner Enrollment Profile" - Description = "Profile for enrolling Android devices" - TokenExpirationDateTime = "2024-12-31T23:59:59Z" - TokenCreationDateTime = "2024-12-31T23:59:59Z" - TokenValue = "your-token-value" - EnrollmentMode = "corporateOwnedWorkProfile" - EnrollmentTokenType = 'TokenType' - QrCodeContent = "your-qr-code-content" - WifiSsid = "your-wifi-ssid" - WifiPassword = "your-wifi-password" - WifiSecurityType = "wpa" - Ensure = 'Present' - } - } } It 'Should return true from the Test method' { @@ -179,24 +160,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementAndroidDeviceOwnerEnrollmentProfile -MockWith { - return @{ - Id = "164655f7-1232-4d56-ae8f-b095196a0309"; - DisplayName = "Android Owner Enrollment Profile" - Description = "Profile for enrolling Android devices" - TokenExpirationDateTime = "2024-12-31T23:59:59Z" - TokenCreationDateTime = "2024-12-31T23:59:59Z" - TokenValue = "your-token-value" - EnrollmentMode = "corporateOwnedWorkProfile" - EnrollmentTokenType = 'TokenType' - QrCodeContent = "your-qr-code-content" - WifiSsid = "your-wifi-ssid" - WifiPassword = "your-wifi-password" - WifiSecurityType = "wpa" - Ensure = 'Present' - } - } } It 'Should return Values from the Get method' { @@ -221,25 +184,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementAndroidDeviceOwnerEnrollmentProfile -MockWith { - return @{ - Id = "164655f7-1232-4d56-ae8f-b095196a0309"; - DisplayName = "Android Owner Enrollment Profile" - Description = "Profile for enrolling Android" - TokenExpirationDateTime = "2024-12-31T23:59:59Z" - TokenCreationDateTime = "2024-12-31T23:59:59Z" - TokenValue = "your-token-value" - EnrollmentMode = "corporateOwnedWorkProfile" - EnrollmentTokenType = 'TokenType' - QrCodeContent = "your-qr-code-content" - WifiSsid = "your-wifi-ssid" - WifiPassword = "your-wifi-password" - WifiSecurityType = "wpa" - Ensure = 'Present' - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceManagementComplianceSettings.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceManagementComplianceSettings.Tests.ps1 index 639913ba3f..38a8445bd3 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceManagementComplianceSettings.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneDeviceManagementComplianceSettings.Tests.ps1 @@ -38,6 +38,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Update-MgBetaDeviceManagement -MockWith { } + Mock -CommandName Invoke-MgGraphRequest -MockWith { + return @{ + deviceComplianceCheckinThresholdDays = 22 + secureByDefault = $true + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -57,13 +64,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { SecureByDefault = $True; Credential = $Credential } - - Mock -CommandName Invoke-MgGraphRequest -MockWith { - return @{ - deviceComplianceCheckinThresholdDays = 22 - secureByDefault = $true - } - } } It 'Should return Yes from the Get method' { @@ -78,18 +78,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The settings are NOT in the desired state." -Fixture { BeforeAll { $testParams = @{ - DeviceComplianceCheckinThresholdDays = 40; #Drift + DeviceComplianceCheckinThresholdDays = 40; # Updated property IsSingleInstance = "Yes"; SecureByDefault = $True; Credential = $Credential } - - Mock -CommandName Invoke-MgGraphRequest -MockWith { - return @{ - deviceComplianceCheckinThresholdDays = 22 - secureByDefault = $true - } - } } It 'Should return Yes from the Get method' { @@ -114,13 +107,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Invoke-MgGraphRequest -MockWith { - return @{ - deviceComplianceCheckinThresholdDays = 22 - secureByDefault = $true - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneMobileAppsMacOSLobApp.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneMobileAppsMacOSLobApp.Tests.ps1 index 71f418c9cf..0490c25b9b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneMobileAppsMacOSLobApp.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneMobileAppsMacOSLobApp.Tests.ps1 @@ -77,6 +77,35 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceAppManagementMobileApp -MockWith { } + Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { + return @{ + Id = "ad027f94-0682-431e-97c1-827d1879fa79" + Categories = @() + Description = "TeamsForBusinessInstaller" + Developer = "Contoso" + DisplayName = "TeamsForBusinessInstaller" + InformationUrl = "" + IsFeatured = $False + Notes = "" + Owner = "" + PrivacyInformationUrl = "" + Publisher = "Contoso" + RoleScopeTagIds = @() + IgnoreVersionDetection = $True + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.macOSLobApp' + minimumSupportedOperatingSystem = @{ + v11_0 = $true + } + } + Ensure = 'Present' + } + } + + Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ + return @() + } + Mock -CommandName Update-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{} # Mock Write-M365DSCHost to hide output during the tests @@ -151,35 +180,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "ad027f94-0682-431e-97c1-827d1879fa79" - Categories = @() - Description = "TeamsForBusinessInstaller" - Developer = "Contoso" - DisplayName = "TeamsForBusinessInstaller" - InformationUrl = "" - IsFeatured = $False - Notes = "" - Owner = "" - PrivacyInformationUrl = "" - Publisher = "Contoso" - RoleScopeTagIds = @() - IgnoreVersionDetection = $True - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.macOSLobApp' - minimumSupportedOperatingSystem = @{ - v11_0 = $true - } - } - Ensure = 'Present' - } - } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ - return $null - } } It '2.1 Should return Values from the Get method' { @@ -216,32 +216,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "8d027f94-0682-431e-97c1-827d1879fa79" - Categories = @() - Description = "TeamsForBusinessInstaller" - Developer = "Contoso" - DisplayName = "TeamsForBusinessInstaller" - InformationUrl = "" - IsFeatured = $False - Notes = "" - Owner = "" - PrivacyInformationUrl = "" - Publisher = "Contoso" - RoleScopeTagIds = @() - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.macOSLobApp' - minimumSupportedOperatingSystem = @{ - v11_0 = $true - } - } - } - } - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ - return $null - } } It '3.0 Should return true from the Test method' { @@ -258,7 +232,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Developer = "Contoso" DisplayName = "TeamsForBusinessInstaller" InformationUrl = "" - IsFeatured = $False + IsFeatured = $True # Updated property MinimumSupportedOperatingSystem = [CimInstance]( New-CimInstance -ClassName MSFT_DeviceManagementMinimumOperatingSystem -Property @{ v11_0 = $true @@ -271,31 +245,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "8d027f94-0682-431e-97c1-827d1879fa79" - Categories = @() - Description = "TeamsForBusinessInstaller" - Developer = "Contoso" - DisplayName = "TeamsForBusinessInstaller drift" - InformationUrl = "" - IsFeatured = $False - Notes = "" - Owner = "" - PrivacyInformationUrl = "" - Publisher = "Contoso" - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.macOSLobApp' - minimumSupportedOperatingSystem = @{ - v11_0 = $true - } - } - } - } - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ - return $null - } } It '4.1 Should return Values from the Get method' { @@ -317,32 +266,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "8d027f94-0682-431e-97c1-827d1879fa79" - Categories = @() - Description = "TeamsForBusinessInstaller" - Developer = "Contoso" - DisplayName = "TeamsForBusinessInstaller drift" - InformationUrl = "" - IsFeatured = $False - Notes = "" - Owner = "" - PrivacyInformationUrl = "" - Publisher = "Contoso" - RoleScopeTagIds = @() - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.macOSLobApp' - minimumSupportedOperatingSystem = @{ - v11_0 = $true - } - } - } - } - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ - return $null - } } It '5.0 Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneMobileAppsWindowsOfficeSuiteApp.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneMobileAppsWindowsOfficeSuiteApp.Tests.ps1 index 6c84866a82..aeb3eed9ef 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneMobileAppsWindowsOfficeSuiteApp.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneMobileAppsWindowsOfficeSuiteApp.Tests.ps1 @@ -52,6 +52,43 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Remove-MgBetaDeviceAppManagementMobileApp -MockWith { } + Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ + return @() + } + + Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { + return @{ + Id = "8d027f94-0682-431e-97c1-827d1879fa79" + Categories = @() + Description = "Microsoft 365 Apps for Windows 10 and later" + DisplayName = "Microsoft 365 Apps for Windows 10 and later" + InformationUrl = "" + IsFeatured = $False + Notes = "" + PrivacyInformationUrl = "" + RoleScopeTagIds = @() + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.officeSuiteApp' + excludedApps = @{ + teams = $false + sharePointDesigner = $true + powerPoint = $false + outlook = $false + groove = $true + word = $false + lync = $true + oneNote = $false + oneDrive = $false + publisher = $false + bing = $false + visio = $false + access = $false + infoPath = $true + excel = $false + } + } + } + } Mock -CommandName Update-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{} @@ -146,42 +183,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "ad027f94-0682-431e-97c1-827d1879fa79" - Categories = @() - Description = "Microsoft 365 Apps for Windows 10 and laterr" - DisplayName = "Microsoft 365 Apps for Windows 10 and later" - InformationUrl = "" - IsFeatured = $False - Notes = "" - PrivacyInformationUrl = "" - RoleScopeTagIds = @() - ExcludedApps = (New-CimInstance -ClassName MSFT_DeviceManagementMobileAppExcludedApp -Property @{ - teams = $false - sharePointDesigner = $true - powerPoint = $false - outlook = $false - groove = $true - word = $false - lync = $true - oneNote = $false - oneDrive = $false - publisher = $false - bing = $false - visio = $false - access = $false - infoPath = $true - excel = $false - } -ClientOnly) - Ensure = 'Present' - } - } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ - return $null - } } It '2.1 Should return Values from the Get method' { @@ -199,44 +200,35 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "3. The instance exists and values are already in the desired state" -Fixture { BeforeAll { $testParams = @{ - Id = "8d027f94-0682-431e-97c1-827d1879fa79" + Id = "ad027f94-0682-431e-97c1-827d1879fa79" Categories = @() Description = "Microsoft 365 Apps for Windows 10 and later" DisplayName = "Microsoft 365 Apps for Windows 10 and later" InformationUrl = "" IsFeatured = $False + ExcludedApps = (New-CimInstance -ClassName MSFT_DeviceManagementMobileAppExcludedApp -Property @{ + teams = $false + sharePointDesigner = $true + powerPoint = $false + outlook = $false + groove = $true + word = $false + lync = $true + oneNote = $false + oneDrive = $false + publisher = $false + bing = $false + visio = $false + access = $false + infoPath = $true + excel = $false + } -ClientOnly) Notes = "" PrivacyInformationUrl = "" RoleScopeTagIds = @() Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "8d027f94-0682-431e-97c1-827d1879fa79" - Categories = @() - Description = "Microsoft 365 Apps for Windows 10 and later" - DisplayName = "Microsoft 365 Apps for Windows 10 and later" - InformationUrl = "" - IsFeatured = $False - Notes = "" - PrivacyInformationUrl = "" - RoleScopeTagIds = @() - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.officeSuiteApp' - minimumSupportedOperatingSystem = @{ - v11_0 = $true - } - } - Ensure = 'Present' - } - } - - # Remove Assignments logic for now as we debug this part - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ - return $null - } } It '3.0 Should return true from the Test method' { @@ -255,7 +247,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { IsFeatured = $False ExcludedApps = (New-CimInstance -ClassName MSFT_DeviceManagementMobileAppExcludedApp -Property @{ teams = $false - sharePointDesigner = $true + sharePointDesigner = $false # Updated property powerPoint = $false outlook = $false groove = $true @@ -276,45 +268,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "8d027f94-0682-431e-97c1-827d1879fa79" - Categories = @() - Description = "Microsoft 365 Apps for Windows 10 and later" - DisplayName = "Microsoft 365 Apps for Windows 10 and later drift" - InformationUrl = "" - IsFeatured = $False - Notes = "" - PrivacyInformationUrl = "" - ExcludedApps = (New-CimInstance -ClassName MSFT_DeviceManagementMobileAppExcludedApp -Property @{ - teams = $false - sharePointDesigner = $true - powerPoint = $false - outlook = $false - groove = $true - word = $false - lync = $true - oneNote = $false - oneDrive = $false - publisher = $false - bing = $false - visio = $false - access = $false - infoPath = $true - excel = $false - } -ClientOnly) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.officeSuiteApp' - minimumSupportedOperatingSystem = @{ - v11_0 = $true - } - } - } - } - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ - return $null - } } It '4.1 Should return Values from the Get method' { @@ -336,46 +289,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceAppManagementMobileApp -MockWith { - return @{ - Id = "8d027f94-0682-431e-97c1-827d1879fa79" - Categories = @() - Description = "Microsoft 365 Apps for Windows 10 and later" - DisplayName = "Microsoft 365 Apps for Windows 10 and later drift" - InformationUrl = "" - IsFeatured = $False - Notes = "" - PrivacyInformationUrl = "" - RoleScopeTagIds = @() - ExcludedApps = (New-CimInstance -ClassName MSFT_DeviceManagementMobileAppExcludedApp -Property @{ - teams = $false - sharePointDesigner = $true - powerPoint = $false - outlook = $false - groove = $true - word = $false - lync = $true - oneNote = $false - oneDrive = $false - publisher = $false - bing = $false - visio = $false - access = $false - infoPath = $true - excel = $false - } -ClientOnly) - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.officeSuiteApp' - minimumSupportedOperatingSystem = @{ - v11_0 = $true - } - } - } - } - Mock -CommandName Get-MgBetaDeviceAppManagementMobileAppAssignment -MockWith{ - return $null - } } It '5.0 Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntunePolicySets.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntunePolicySets.Tests.ps1 index 80a6701316..7b17651443 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntunePolicySets.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntunePolicySets.Tests.ps1 @@ -55,6 +55,49 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Write-Warning -MockWith { } + Mock -CommandName Get-MgbetaDeviceAppManagementPolicySet -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = "#microsoft.graph.PolicySet" + } + CreatedDateTime = "2023-01-01T00:00:00.0000000+00:00" + Description = "FakeStringValue" + DisplayName = "FakeStringValue" + ErrorCode = "noError" + GuidedDeploymentTags = @("FakeStringValue") + Id = "FakeStringValue" + LastModifiedDateTime = "2023-01-01T00:00:00.0000000+00:00" + RoleScopeTags = @("FakeStringValue") + Status = "unknown" + Assignments = @( + [pscustomobject]@{ + Target = [pscustomobject]@{ + AdditionalProperties = [pscustomobject]@{ + '@odata.type' = '#microsoft.graph.GroupAssignmentTarget' + groupId = '12345678-1234-1234-1234-1234567890ab' + } + DeviceAndAppManagementAssignmentFilterType = 'none' + DeviceAndAppManagementAssignmentFilterId = $null + + } + } + ) + Items = @( + [pscustomobject]@{ + + AdditionalProperties = [pscustomobject]@{ + '@odata.type' = '#microsoft.graph.managedAppProtectionPolicySetItem' + } + payloadId = 'T_12345678-1234-1234-1234-1234567890ab' + itemType = '#microsoft.graph.androidManagedAppProtection' + displayName = 'FakeStringValue' + guidedDeploymentTags = @('FakeStringValue') + + } + ) + } + } + $Script:exportedInstances =$null $Script:ExportMode = $false @@ -134,49 +177,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgbetaDeviceAppManagementPolicySet -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.PolicySet" - } - CreatedDateTime = "2023-01-01T00:00:00.0000000+00:00" - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - ErrorCode = "noError" - GuidedDeploymentTags = @("FakeStringValue") - Id = "FakeStringValue" - LastModifiedDateTime = "2023-01-01T00:00:00.0000000+00:00" - RoleScopeTags = @("FakeStringValue") - Status = "unknown" - Assignments = @( - [pscustomobject]@{ - Target = [pscustomobject]@{ - AdditionalProperties = [pscustomobject]@{ - '@odata.type' = '#microsoft.graph.GroupAssignmentTarget' - groupId = '12345678-1234-1234-1234-1234567890ab' - } - DeviceAndAppManagementAssignmentFilterType = 'none' - DeviceAndAppManagementAssignmentFilterId = $null - - } - } - ) - Items = @( - [pscustomobject]@{ - - AdditionalProperties = [pscustomobject]@{ - '@odata.type' = '#microsoft.graph.managedAppProtectionPolicySetItem' - } - payloadId = 'T_12345678-1234-1234-1234-1234567890ab' - itemType = '#microsoft.graph.androidManagedAppProtection' - displayName = 'FakeStringValue' - guidedDeploymentTags = @('FakeStringValue') - - } - ) - } - } } It 'Should return Values from the Get method' { @@ -220,50 +220,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgbetaDeviceAppManagementPolicySet -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.PolicySet" - } - CreatedDateTime = "2023-01-01T00:00:00.0000000+00:00" - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - ErrorCode = "noError" - GuidedDeploymentTags = @("FakeStringValue") - Id = "FakeStringValue" - LastModifiedDateTime = "2023-01-01T00:00:00.0000000+00:00" - RoleScopeTags = @("FakeStringValue") - Status = "unknown" - Assignments = @( - [pscustomobject]@{ - Target = [pscustomobject]@{ - AdditionalProperties = [pscustomobject]@{ - '@odata.type' = '#microsoft.graph.GroupAssignmentTarget' - groupId = '12345678-1234-1234-1234-1234567890ab' - } - DeviceAndAppManagementAssignmentFilterType = 'none' - DeviceAndAppManagementAssignmentFilterId = $null - - } - } - ) - Items = @( - [pscustomobject]@{ - - AdditionalProperties = [pscustomobject]@{ - '@odata.type' = '#microsoft.graph.managedAppProtectionPolicySetItem' - } - payloadId = 'T_12345678-1234-1234-1234-1234567890ab' - itemType = '#microsoft.graph.androidManagedAppProtection' - displayName = 'FakeStringValue' - guidedDeploymentTags = @('FakeStringValue') - - } - ) - - } - } } @@ -275,7 +231,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The IntunePolicySets exists and values are NOT in the desired state" -Fixture { BeforeAll { $testParams = @{ - Description = "UPDATED-FakeStringValue" + Description = "UPDATED-FakeStringValue" # Updated property DisplayName = "FakeStringValue" GuidedDeploymentTags = @("FakeStringValue") Id = "FakeStringValue" @@ -299,46 +255,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgbetaDeviceAppManagementPolicySet -MockWith { - return @{ - CreatedDateTime = "2023-01-01T00:00:00.0000000+00:00" - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - ErrorCode = "noError" - GuidedDeploymentTags = @("FakeStringValue") - Id = "FakeStringValue" - LastModifiedDateTime = "2023-01-01T00:00:00.0000000+00:00" - RoleScopeTags = @("FakeStringValue") - Status = "unknown" - Assignments = @( - [pscustomobject]@{ - Target = [pscustomobject]@{ - AdditionalProperties = [pscustomobject]@{ - '@odata.type' = '#microsoft.graph.GroupAssignmentTarget' - groupId = '12345678-1234-1234-1234-1234567890ab' - } - DeviceAndAppManagementAssignmentFilterType = 'none' - DeviceAndAppManagementAssignmentFilterId = $null - - } - } - ) - Items = @( - [pscustomobject]@{ - - AdditionalProperties = [pscustomobject]@{ - '@odata.type' = '#microsoft.graph.managedAppProtectionPolicySetItem' - } - payloadId = 'T_12345678-1234-1234-1234-1234567890ab' - itemType = '#microsoft.graph.androidManagedAppProtection' - displayName = 'FakeStringValue' - guidedDeploymentTags = @('FakeStringValue') - - } - ) - } - } } It 'Should return Values from the Get method' { @@ -362,50 +278,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgbetaDeviceAppManagementPolicySet -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = "#microsoft.graph.PolicySet" - } - CreatedDateTime = "2023-01-01T00:00:00.0000000+00:00" - Description = "FakeStringValue" - DisplayName = "FakeStringValue" - ErrorCode = "noError" - GuidedDeploymentTags = @("FakeStringValue") - Id = "FakeStringValue" - LastModifiedDateTime = "2023-01-01T00:00:00.0000000+00:00" - RoleScopeTags = @("FakeStringValue") - Status = "unknown" - Assignments = @( - [pscustomobject]@{ - Target = [pscustomobject]@{ - AdditionalProperties = [pscustomobject]@{ - '@odata.type' = '#microsoft.graph.GroupAssignmentTarget' - groupId = '12345678-1234-1234-1234-1234567890ab' - } - DeviceAndAppManagementAssignmentFilterType = 'none' - DeviceAndAppManagementAssignmentFilterId = $null - - } - } - ) - Items = @( - [pscustomobject]@{ - - AdditionalProperties = [pscustomobject]@{ - '@odata.type' = '#microsoft.graph.managedAppProtectionPolicySetItem' - } - payloadId = 'T_12345678-1234-1234-1234-1234567890ab' - itemType = '#microsoft.graph.androidManagedAppProtection' - displayName = 'FakeStringValue' - guidedDeploymentTags = @('FakeStringValue') - - } - ) - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleAssignment.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleAssignment.Tests.ps1 index 842c99be56..5b79247153 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleAssignment.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleAssignment.Tests.ps1 @@ -49,13 +49,28 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementRoleAssignment -MockWith { + return @{ + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + Members = @('FakeStringValue') + resourceScopes = @('FakeStringValue') + ScopeType = 'resourceScope' + } + } Mock -CommandName Get-MgDeviceManagementRoleDefinition -MockWith { return @() } - Mock -CommandName Get-MgDeviceManagementRoleDefinitionRoleAssignment -MockWith { return @() } + Mock -CommandName Get-MgGroup -MockWith { + return @{ + Displayname = 'FakeStringValue' + Id = 'FakeStringValue' + } + } # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -102,27 +117,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ScopeType = 'resourceScope' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleAssignment -MockWith { - return @{ - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - ScopeType = 'resourceScope' - } - } - Mock -CommandName Get-MgDeviceManagementRoleDefinition -MockWith { - return @() - } - Mock -CommandName Get-MgDeviceManagementRoleDefinitionRoleAssignment -MockWith { - return @() - } - Mock -CommandName Get-MgGroup -MockWith { - return @{ - Displayname = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -151,30 +145,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ScopeType = 'resourceScope' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleAssignment -MockWith { - return @{ - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - Members = @('FakeStringValue') - resourceScopes = @('FakeStringValue') - ScopeType = 'resourceScope' - - } - } - Mock -CommandName Get-MgDeviceManagementRoleDefinition -MockWith { - return @() - } - Mock -CommandName Get-MgDeviceManagementRoleDefinitionRoleAssignment -MockWith { - return @() - } - Mock -CommandName Get-MgGroup -MockWith { - return @{ - Displayname = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } @@ -191,37 +161,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Id = 'FakeStringValue' Ensure = 'Present' RoleDefinition = '7fbbd347-98de-431d-942b-cf5bea92998d' - MembersDisplayNames = @('FakeStringValue') + MembersDisplayNames = @('OtherMember') # Updated property resourceScopesDisplayNames = @('FakeStringValue') ScopeType = 'resourceScope' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleAssignment -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.' - - } - Description = 'StringValue' - DisplayName = 'StringValue' - Id = 'StringValue' - ScopeType = 'resourceScope' - - } - } - Mock -CommandName Get-MgDeviceManagementRoleDefinition -MockWith { - return @() - } - Mock -CommandName Get-MgDeviceManagementRoleDefinitionRoleAssignment -MockWith { - return @() - } - Mock -CommandName Get-MgGroup -MockWith { - return @{ - Displayname = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -245,23 +189,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleAssignment -MockWith { - return @{ - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - ScopeType = 'resourceScope' - } - } - Mock -CommandName Get-MgDeviceManagementRoleDefinition -MockWith { - return @() - } - Mock -CommandName Get-MgDeviceManagementRoleDefinitionRoleAssignment -MockWith { - return @() - } - } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleDefinition.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleDefinition.Tests.ps1 index 92c652e91b..67c96544eb 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleDefinition.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleDefinition.Tests.ps1 @@ -46,6 +46,21 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementRoleDefinition -MockWith { + return @{ + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + IsBuiltIn = $True + RolePermissions = @{ + ResourceActions = @{ + AllowedResourceActions = @('Microsoft.Intune_Organization_Read', 'Microsoft.Intune_Roles_Create', 'Microsoft.Intune_Roles_Read', 'Microsoft.Intune_Roles_Update') + NotAllowedResourceActions = @() + } + } + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -95,21 +110,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleDefinition -MockWith { - return @{ - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - IsBuiltIn = $True - RolePermissions = @{ - ResourceActions = @{ - AllowedResourceActions = @('Microsoft.Intune_Organization_Read', 'Microsoft.Intune_Roles_Create', 'Microsoft.Intune_Roles_Read', 'Microsoft.Intune_Roles_Update') - NotAllowedResourceActions = @() - } - } - } - } } It 'Should return Values from the Get method' { @@ -137,21 +137,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleDefinition -MockWith { - return @{ - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - IsBuiltIn = $True - RolePermissions = @{ - ResourceActions = @{ - AllowedResourceActions = @('Microsoft.Intune_Organization_Read', 'Microsoft.Intune_Roles_Create', 'Microsoft.Intune_Roles_Read', 'Microsoft.Intune_Roles_Update') - NotAllowedResourceActions = @() - } - } - } - } } @@ -167,26 +152,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = 'FakeStringValue' Id = 'FakeStringValue' IsBuiltIn = $True - allowedResourceActions = @('Microsoft.Intune_Roles_Create', 'Microsoft.Intune_Roles_Read', 'Microsoft.Intune_Roles_Update') + allowedResourceActions = @('Microsoft.Intune_Roles_Create', 'Microsoft.Intune_Roles_Read') # Updated property notallowedResourceActions = @() Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleDefinition -MockWith { - return @{ - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - IsBuiltIn = $True - RolePermissions = @{ - ResourceActions = @{ - AllowedResourceActions = @('Microsoft.Intune_Organization_Read', 'Microsoft.Intune_Roles_Create', 'Microsoft.Intune_Roles_Read', 'Microsoft.Intune_Roles_Update') - NotAllowedResourceActions = @() - } - } - } - } } It 'Should return Values from the Get method' { @@ -210,25 +180,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleDefinition -MockWith { - return @{ - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - IsBuiltIn = $True - RolePermissions = @{ - ResourceActions = @{ - AllowedResourceActions = @('Microsoft.Intune_Organization_Read', 'Microsoft.Intune_Roles_Create', 'Microsoft.Intune_Roles_Read', 'Microsoft.Intune_Roles_Update') - NotAllowedResourceActions = @() - } - } - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceAndAppManagementRoleDefinition' - } - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleScopeTag.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleScopeTag.Tests.ps1 index 982c44a16c..8ed0f882c2 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleScopeTag.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneRoleScopeTag.Tests.ps1 @@ -49,6 +49,18 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementRoleScopeTag -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.RoleScopeTag' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + IsBuiltIn = $False + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -96,18 +108,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleScopeTag -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.RoleScopeTag' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - IsBuiltIn = $True - } - } } It 'Should return Values from the Get method' { @@ -133,18 +133,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleScopeTag -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.RoleScopeTag' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - IsBuiltIn = $True - } - } } It 'Should return true from the Test method' { @@ -155,20 +143,12 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'The IntuneRoleScopeTag exists and values are NOT in the desired state' -Fixture { BeforeAll { $testParams = @{ - Description = 'FakeStringValue' + Description = 'OtherFakeStringValue' # Updated property DisplayName = 'FakeStringValue' Id = 'FakeStringValue' Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleScopeTag -MockWith { - return @{ - Description = 'FakeWrongStringValue' - DisplayName = 'FakeWrongStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -192,18 +172,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementRoleScopeTag -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.RoleScopeTag' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - IsBuiltIn = $false - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneSettingCatalogCustomPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneSettingCatalogCustomPolicyWindows10.Tests.ps1 index c3c49542d3..f086945103 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneSettingCatalogCustomPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneSettingCatalogCustomPolicyWindows10.Tests.ps1 @@ -46,6 +46,99 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementConfigurationPolicy -MockWith { + return @{ + Description = 'FakeStringValue' + Id = 'FakeStringValue' + Name = 'FakeStringValue' + Platforms = 'windows10' + Settings = @( + @{ + SettingInstance = @{ + AdditionalProperties = @{ + simpleSettingValue = @{ + value = 'fakeValue' + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' + } + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' + } + SettingDefinitionId = 'stringSettingDefinitionId' + } + } + @{ + SettingInstance = @{ + AdditionalProperties = @{ + simpleSettingValue = @{ + valueState = 'invalid' + value = 'fakeValue' + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' + } + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' + } + SettingDefinitionId = 'secretSettingDefinitionId' + } + } + @{ + SettingInstance = @{ + AdditionalProperties = @{ + simpleSettingValue = @{ + value = 25 + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationIntegerSettingValue' + } + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' + } + SettingDefinitionId = 'integerSettingDefinitionId' + } + } + @{ + SettingInstance = @{ + AdditionalProperties = @{ + choiceSettingValue = @{ + value = 'choiceSettingValue' + children = @() + } + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance' + } + SettingDefinitionId = 'choiceSettingDefinitionId' + } + } + @{ + SettingInstance = @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationGroupSettingInstance' + groupSettingValue = @{ + children = @( + @{ + simpleSettingValue = @{ + value = 'fakeValue' + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' + } + SettingDefinitionId = 'stringSettingDefinitionId' + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' + } + @{ + simpleSettingValue = @{ + valueState = 'invalid' + value = 'fakeValue' + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' + } + SettingDefinitionId = 'secretSettingDefinitionId' + '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' + } + ) + } + } + SettingDefinitionId = 'groupSettingDefinitionId' + } + } + ) + Technologies = 'mdm' + TemplateReference = @{ + TemplateFamily = 'none' + } + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -56,6 +149,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { } + Mock -CommandName Update-IntuneDeviceConfigurationPolicy -MockWith { + } } # Test contexts Context -Name 'The IntuneSettingCatalogCustomPolicyWindows10 should exist but it DOES NOT' -Fixture { @@ -235,99 +330,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementConfigurationPolicy -MockWith { - return @{ - Description = 'FakeStringValue' - Id = 'FakeStringValue' - Name = 'FakeStringValue' - Platforms = 'windows10' - Settings = @( - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - StringValue = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'stringSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - valueState = 'invalid' - StringValue = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'secretSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - IntValue = 25 - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationIntegerSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'integerSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - choiceSettingValue = @{ - value = 'choiceSettingValue' - children = @() - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance' - } - SettingDefinitionId = 'stringSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationGroupSettingValue' - groupSettingValue = @{ - children = @( - @{ - simpleSettingValue = @{ - StringValue = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' - } - SettingDefinitionId = 'stringSettingDefinitionId' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - @{ - simpleSettingValue = @{ - valueState = 'invalid' - StringValue = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' - } - SettingDefinitionId = 'secretSettingDefinitionId' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - ) - } - } - SettingDefinitionId = 'groupSettingDefinitionId' - } - } - ) - Technologies = 'mdm' - TemplateReference = @{ - TemplateFamily = 'none' - } - } - } } It 'Should return Values from the Get method' { @@ -343,6 +345,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Should -Invoke -CommandName Remove-MgBetaDeviceManagementConfigurationPolicy -Exactly 1 } } + Context -Name 'The IntuneSettingCatalogCustomPolicyWindows10 Exists and Values are already in the desired state' -Fixture { BeforeAll { $testParams = @{ @@ -397,7 +400,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { odataType = '#microsoft.graph.deviceManagementConfigurationGroupSettingInstance' SettingDefinitionId = 'groupSettingDefinitionId' groupSettingValue = (New-CimInstance -ClassName MSFT_MicrosoftGraphdeviceManagementConfigurationGroupSettingValue -Property @{ - odataType = '#microsoft.graph.deviceManagementConfigurationGroupSettingValue' + #odataType = '#microsoft.graph.deviceManagementConfigurationGroupSettingValue' children = [CimInstance[]]@( (New-CimInstance -ClassName MSFT_MicrosoftGraphdeviceManagementConfigurationSettingInstance -Property @{ simpleSettingValue = (New-CimInstance -ClassName MSFT_MicrosoftGraphdeviceManagementConfigurationSimpleSettingValue -Property @{ @@ -425,103 +428,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementConfigurationPolicy -MockWith { - return @{ - Description = 'FakeStringValue' - Id = 'FakeStringValue' - Name = 'FakeStringValue' - Platforms = 'windows10' - Settings = @( - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'stringSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - valueState = 'invalid' - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'secretSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - value = 25 - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationIntegerSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'integerSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - choiceSettingValue = @{ - value = 'choiceSettingValue' - children = @() - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance' - } - SettingDefinitionId = 'choiceSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - SettingDefinitionId = 'groupSettingDefinitionId' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationGroupSettingInstance' - groupSettingValue = @{ - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationGroupSettingValue' - children = @( - @{ - simpleSettingValue = @{ - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' - } - SettingDefinitionId = 'stringSettingDefinitionId' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - @{ - simpleSettingValue = @{ - valueState = 'invalid' - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' - } - SettingDefinitionId = 'secretSettingDefinitionId' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - ) - } - } - } - } - ) - Technologies = 'mdm' - TemplateReference = @{ - TemplateFamily = 'none' - } - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -594,7 +502,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { (New-CimInstance -ClassName MSFT_MicrosoftGraphdeviceManagementConfigurationSettingInstance -Property @{ simpleSettingValue = (New-CimInstance -ClassName MSFT_MicrosoftGraphdeviceManagementConfigurationSimpleSettingValue -Property @{ valueState = 'invalid' - StringValue = 'fakeValue' + StringValue = 'updatedValue' # Updated property odataType = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' } -ClientOnly) SettingDefinitionId = 'secretSettingDefinitionId' @@ -609,103 +517,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementConfigurationPolicy -MockWith { - return @{ - Description = 'FakeStringValue' - Id = 'FakeStringValue' - Name = 'FakeStringValue' - Platforms = 'windows10' - Settings = @( - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'stringSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - valueState = 'invalid' - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'secretSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - value = 25 - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationIntegerSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'integerSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - choiceSettingValue = @{ - value = 'choiceSettingValue' - children = @() - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance' - } - SettingDefinitionId = 'choiceSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - SettingDefinitionId = 'groupSettingDefinitionId' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationGroupSettingInstance' - groupSettingValue = @{ - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationGroupSettingValue' - children = @( - @{ - simpleSettingValue = @{ - value = 'fakeValueDrift' #Drift - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' - } - SettingDefinitionId = 'stringSettingDefinitionId' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - @{ - simpleSettingValue = @{ - valueState = 'invalid' - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' - } - SettingDefinitionId = 'secretSettingDefinitionId' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - ) - } - } - } - } - ) - Technologies = 'mdm' - TemplateReference = @{ - TemplateFamily = 'none' - } - } - } - - Mock -CommandName Update-IntuneDeviceConfigurationPolicy -MockWith { - } } It 'Should return Values from the Get method' { @@ -729,101 +540,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementConfigurationPolicy -MockWith { - return @{ - Description = 'FakeStringValue' - Id = 'FakeStringValue' - Name = 'FakeStringValue' - Platforms = 'windows10' - Settings = @( - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'stringSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - valueState = 'invalid' - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'secretSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - simpleSettingValue = @{ - value = 25 - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationIntegerSettingValue' - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - SettingDefinitionId = 'integerSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - AdditionalProperties = @{ - choiceSettingValue = @{ - value = 'choiceSettingValue' - children = @() - } - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance' - } - SettingDefinitionId = 'choiceSettingDefinitionId' - } - } - @{ - SettingInstance = @{ - SettingDefinitionId = 'groupSettingDefinitionId' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationGroupSettingInstance' - groupSettingValue = @{ - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationGroupSettingValue' - children = @( - @{ - simpleSettingValue = @{ - value = 'fakeValueDrift' #Drift - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationStringSettingValue' - } - SettingDefinitionId = 'stringSettingDefinitionId' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - @{ - simpleSettingValue = @{ - valueState = 'invalid' - value = 'fakeValue' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSecretSettingValue' - } - SettingDefinitionId = 'secretSettingDefinitionId' - '@odata.type' = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance' - } - ) - } - } - } - } - ) - Technologies = 'mdm' - TemplateReference = @{ - TemplateFamily = 'none' - } - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneTrustedRootCertificateAndroidWork.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneTrustedRootCertificateAndroidWork.Tests.ps1 index cc50350683..a82e2fcd01 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneTrustedRootCertificateAndroidWork.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneTrustedRootCertificateAndroidWork.Tests.ps1 @@ -39,8 +39,20 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + DisplayName = 'Test IntuneTrustedRootCertificateAndroidWork' + Description = 'Test IntuneTrustedRootCertificateAndroidWork Description' + Id = 'e30954ac-a65e-4dcb-ab79-91d45f3c52b4' + AdditionalProperties = @{ + certFileName = "FakeStringValue" + trustedRootCertificate = "fakestringvalue0" + '@odata.type' = '#microsoft.graph.androidWorkProfileTrustedRootCertificate' + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { return @() } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -89,23 +101,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { DisplayName = 'Test IntuneTrustedRootCertificateAndroidWork' Description = 'Test IntuneTrustedRootCertificateAndroidWork Description' certFileName = "FakeStringValue" - trustedRootCertificate = "fakestringvalue0" + trustedRootCertificate = "OtherCertificate" # Updated property Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'Test IntuneTrustedRootCertificateAndroidWork' - Description = 'Different Value' - Id = 'e30954ac-a65e-4dcb-ab79-91d45f3c52b4' - AdditionalProperties = @{ - certFileName = "FakeStringValue" - trustedRootCertificate = "fakestringvalue0" - '@odata.type' = '#microsoft.graph.androidWorkProfileTrustedRootCertificate' - } - } - } } It 'Should return Present from the Get method' { @@ -119,7 +118,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { It 'Should update the IntuneTrustedRootCertificateAndroidWork from the Set method' { Set-TargetResource @testParams Should -Invoke -CommandName Update-MgBetaDeviceManagementDeviceConfiguration -Exactly 1 - } } @@ -133,19 +131,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'Test IntuneTrustedRootCertificateAndroidWork' - Description = 'Test IntuneTrustedRootCertificateAndroidWork Description' - Id = 'e30954ac-a65e-4dcb-ab79-91d45f3c52b4' - AdditionalProperties = @{ - certFileName = "FakeStringValue" - trustedRootCertificate = "fakestringvalue0" - '@odata.type' = '#microsoft.graph.androidWorkProfileTrustedRootCertificate' - } - } - } } It 'Should return true from the Test method' { @@ -199,19 +184,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'Test IntuneTrustedRootCertificateAndroidWork' - Description = 'Test IntuneTrustedRootCertificateAndroidWork Description' - Id = 'e30954ac-a65e-4dcb-ab79-91d45f3c52b4' - AdditionalProperties = @{ - certFileName = "FakeStringValue" - trustedRootCertificate = "fakestringvalue0" - '@odata.type' = '#microsoft.graph.androidWorkProfileTrustedRootCertificate' - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneVPNConfigurationPolicyAndroidWork.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneVPNConfigurationPolicyAndroidWork.Tests.ps1 index a5cd4a0a46..b082008915 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneVPNConfigurationPolicyAndroidWork.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneVPNConfigurationPolicyAndroidWork.Tests.ps1 @@ -39,8 +39,55 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + Id = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Description = 'FakeStringValue' + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.androidWorkProfileVpnConfiguration' + authenticationMethod = 'usernameAndPassword' + connectionName = 'FakeStringValue' + connectionType = 'ciscoAnyConnect' + proxyServer = @( + @{ + port = 80 + automaticConfigurationScriptUrl = 'https://www.test.com' + address = 'proxy.test.com' + } + ) + servers = @( + @{ + isDefaultServer = $True + description = 'server' + address = 'vpn.test.com' + } + ) + customData = @( + @{ + key = 'FakeStringValue' + value = 'FakeStringValue' + } + ) + customKeyValueData = @( + @{ + name = 'FakeStringValue' + value = 'FakeStringValue' + } + ) + targetedMobileApps = @( + @{ + name = 'FakeStringValue' + publisher = 'FakeStringValue' + appStoreUrl = 'FakeStringValue' + appId = 'FakeStringValue' + } + ) + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { return @() } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -167,7 +214,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { (New-CimInstance ` -ClassName MSFT_CustomData ` -Property @{ - name = 'FakeStringValue' + name = 'UpdatedName' # Updated property value = 'FakeStringValue' } -ClientOnly) ) @@ -184,58 +231,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - Id = 'FakeStringValue' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileVpnConfiguration' - authenticationMethod = 'usernameAndPassword' - connectionName = 'FakeStringValue' - connectionType = 'ciscoAnyConnect' - customData = @( - @{ - key = 'FakeStringValue' - value = 'FakeStringValue' - } - ) - customKeyValueData = @( - @{ - name = 'FakeStringValue' - value = 'FakeStringValue' - } - ) - servers = @( - @{ - isDefaultServer = $True - description = 'server' - address = 'vpn.CHANGED.com' #changed value - } - ) - proxyServer = @( - @{ - port = 80 - automaticConfigurationScriptUrl = 'https://www.test.com' - address = 'proxy.test.com' - } - ) - targetedMobileApps = @( - @{ - name = 'FakeStringValue' - publisher = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - appId = 'FakeStringValue' - } - ) - } - } - } } It 'Should return Present from the Get method' { - (Get-TargetResource @testParams).Ensure | Should -Be 'Present' #-Displayname 'FakeStringValue').Ensure | Should -Be 'Present' # + (Get-TargetResource @testParams).Ensure | Should -Be 'Present' } It 'Should return false from the Test method' { @@ -304,53 +303,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileVpnConfiguration' - authenticationMethod = 'usernameAndPassword' - connectionName = 'FakeStringValue' - connectionType = 'ciscoAnyConnect' - proxyServer = @( - @{ - port = 80 - automaticConfigurationScriptUrl = 'https://www.test.com' - address = 'proxy.test.com' - } - ) - servers = @( - @{ - isDefaultServer = $True - description = 'server' - address = 'vpn.test.com' - } - ) - customData = @( - @{ - key = 'FakeStringValue' - value = 'FakeStringValue' - } - ) - customKeyValueData = @( - @{ - name = 'FakeStringValue' - value = 'FakeStringValue' - } - ) - targetedMobileApps = @( - @{ - name = 'FakeStringValue' - publisher = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - appId = 'FakeStringValue' - } - ) - } - } - } } It 'Should return true from the Test method' { @@ -387,33 +339,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileVpnConfiguration' - authenticationMethod = 'usernameAndPassword' - connectionName = 'FakeStringValue' - connectionType = 'ciscoAnyConnect' - proxyServer = @( - @{ - port = 80 - automaticConfigurationScriptUrl = 'https://www.test.com' - address = 'proxy.test.com' - } - ) - servers = @( - @{ - isDefaultServer = $True - description = 'server' - address = 'vpn.test.com' - } - ) - } - } - } } It 'Should return Present from the Get method' { @@ -437,33 +362,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileVpnConfiguration' - authenticationMethod = 'usernameAndPassword' - connectionName = 'FakeStringValue' - connectionType = 'ciscoAnyConnect' - proxyServer = @( - @{ - port = 80 - automaticConfigurationScriptUrl = 'https://www.test.com' - address = 'proxy.test.com' - } - ) - servers = @( - @{ - isDefaultServer = $True - description = 'server' - address = 'vpn.test.com' - } - ) - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneVPNConfigurationPolicyIOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneVPNConfigurationPolicyIOS.Tests.ps1 index cdf79cc891..f35acf83c3 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneVPNConfigurationPolicyIOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneVPNConfigurationPolicyIOS.Tests.ps1 @@ -39,8 +39,75 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -MockWith { } - Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + Id = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Description = 'FakeStringValue' + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.iosVpnConfiguration' + authenticationMethod = 'usernameAndPassword' + connectionName = 'FakeStringValue' + connectionType = 'ciscoAnyConnectV2' + enableSplitTunneling = $False + enablePerApp = $False + optInToDeviceIdSharing = $True + proxyServer = @( + @{ + port = 80 + automaticConfigurationScriptUrl = 'https://www.test.com' + address = 'proxy.test.com' + } + ) + server = @( + @{ + isDefaultServer = $True + description = 'server' + address = 'vpn.test.com' + } + ) + customData = @( + @{ + key = 'FakeStringValue' + value = 'FakeStringValue' + } + ) + customKeyValueData = @( + @{ + name = 'FakeStringValue' + value = 'FakeStringValue' + } + ) + onDemandRules = @( + @{ + ssids = 'FakeStringValue' + dnsSearchDomains = 'FakeStringValue' + probeUrl = 'FakeStringValue' + action = 'ignore' + domainAction = 'neverConnect' + domains = 'FakeStringValue' + probeRequiredUrl = 'FakeStringValue' + interfaceTypeMatch = 'notConfigured' + dnsServerAddressMatch = 'FakeStringValue' + } + ) + targetedMobileApps = @( + @{ + name = 'FakeStringValue' + publisher = 'FakeStringValue' + appStoreUrl = 'FakeStringValue' + appId = 'FakeStringValue' + } + ) + safariDomains = @{} + associatedDomains = @{} + excludedDomains = @{} + excludeList = @{} + } + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceCompliancePolicyAssignment -MockWith { return @() } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -117,7 +184,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { dnsServerAddressMatch = 'FakeStringValue' } -ClientOnly) ) - targetedMobileApps = [CimInstance[]]@( + targetedMobileApps = [CimInstance[]]@( (New-CimInstance ` -ClassName MSFT_targetedMobileApps ` -Property @{ @@ -166,7 +233,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { (New-CimInstance ` -ClassName MSFT_MicrosoftvpnProxyServer ` -Property @{ - port = 80 + port = 443 # Updated property automaticConfigurationScriptUrl = 'https://www.test.com' address = 'proxy.test.com' } -ClientOnly) @@ -228,76 +295,10 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - Id = 'FakeStringValue' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosVpnConfiguration' - authenticationMethod = 'usernameAndPassword' - connectionName = 'FakeStringValue' - connectionType = 'ciscoAnyConnectV2' - customData = @( - @{ - key = 'FakeStringValue' - value = 'FakeStringValue' - } - ) - customKeyValueData = @( - @{ - name = 'FakeStringValue' - value = 'FakeStringValue' - } - ) - enableSplitTunneling = $False - enablePerApp = $False - disableOnDemandUserOverride = $True - disconnectOnIdle = $True - optInToDeviceIdSharing = $True - onDemandRules = @(` - @{ - ssids = 'FakeStringValue' - dnsSearchDomains = 'FakeStringValue' - probeUrl = 'FakeStringValue' - action = 'ignore' - domainAction = 'neverConnect' - domains = 'FakeStringValue' - probeRequiredUrl = 'FakeStringValue' - interfaceTypeMatch = 'notConfigured' - dnsServerAddressMatch = 'FakeStringValue' - } - ) - server = @( - @{ - isDefaultServer = $True - description = 'server' - address = 'vpn.CHANGED.com' #changed value - } - ) - proxyServer = @( - @{ - port = 80 - automaticConfigurationScriptUrl = 'https://www.test.com' - address = 'proxy.test.com' - } - ) - targetedMobileApps = @( - @{ - name = 'FakeStringValue' - publisher = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - appId = 'FakeStringValue' - } - ) - } - } - } } It 'Should return Present from the Get method' { - (Get-TargetResource @testParams).Ensure | Should -Be 'Present' #-Displayname 'FakeStringValue').Ensure | Should -Be 'Present' # + (Get-TargetResource @testParams).Ensure | Should -Be 'Present' } It 'Should return false from the Test method' { @@ -388,73 +389,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosVpnConfiguration' - authenticationMethod = 'usernameAndPassword' - connectionName = 'FakeStringValue' - connectionType = 'ciscoAnyConnectV2' - enableSplitTunneling = $False - enablePerApp = $False - optInToDeviceIdSharing = $True - proxyServer = @( - @{ - port = 80 - automaticConfigurationScriptUrl = 'https://www.test.com' - address = 'proxy.test.com' - } - ) - server = @( - @{ - isDefaultServer = $True - description = 'server' - address = 'vpn.test.com' - } - ) - customData = @( - @{ - key = 'FakeStringValue' - value = 'FakeStringValue' - } - ) - customKeyValueData = @( - @{ - name = 'FakeStringValue' - value = 'FakeStringValue' - } - ) - onDemandRules = @( - @{ - ssids = 'FakeStringValue' - dnsSearchDomains = 'FakeStringValue' - probeUrl = 'FakeStringValue' - action = 'ignore' - domainAction = 'neverConnect' - domains = 'FakeStringValue' - probeRequiredUrl = 'FakeStringValue' - interfaceTypeMatch = 'notConfigured' - dnsServerAddressMatch = 'FakeStringValue' - } - ) - targetedMobileApps = @( - @{ - name = 'FakeStringValue' - publisher = 'FakeStringValue' - appStoreUrl = 'FakeStringValue' - appId = 'FakeStringValue' - } - ) - safariDomains = @{} - associatedDomains = @{} - excludedDomains = @{} - excludeList = @{} - } - } - } } It 'Should return true from the Test method' { @@ -494,36 +428,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosVpnConfiguration' - authenticationMethod = 'usernameAndPassword' - connectionName = 'FakeStringValue' - connectionType = 'ciscoAnyConnectV2' - enableSplitTunneling = $False - enablePerApp = $False - optInToDeviceIdSharing = $True - proxyServer = @( - @{ - port = 80 - automaticConfigurationScriptUrl = 'https://www.test.com' - address = 'proxy.test.com' - } - ) - server = @( - @{ - isDefaultServer = $True - description = 'server' - address = 'vpn.test.com' - } - ) - } - } - } } It 'Should return Present from the Get method' { @@ -547,36 +451,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosVpnConfiguration' - authenticationMethod = 'usernameAndPassword' - connectionName = 'FakeStringValue' - connectionType = 'ciscoAnyConnectV2' - enableSplitTunneling = $False - enablePerApp = $False - optInToDeviceIdSharing = $True - proxyServer = @( - @{ - port = 80 - automaticConfigurationScriptUrl = 'https://www.test.com' - address = 'proxy.test.com' - } - ) - server = @( - @{ - isDefaultServer = $True - description = 'server' - address = 'vpn.test.com' - } - ) - } - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidEnterpriseDeviceOwner.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidEnterpriseDeviceOwner.Tests.ps1 index 0d4cf9abe5..c55956d65d 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidEnterpriseDeviceOwner.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidEnterpriseDeviceOwner.Tests.ps1 @@ -24,7 +24,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $secpasswd = ConvertTo-SecureString (New-Guid | Out-String) -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin@mydomain.com', $secpasswd) - Mock -CommandName Confirm-M365DSCDependencies -MockWith { } @@ -48,6 +47,30 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + NetworkName = 'FakeStringValue' + '@odata.type' = '#microsoft.graph.androidDeviceOwnerEnterpriseWiFiConfiguration' + PreSharedKey = 'FakeStringValue' + WiFiSecurityType = 'open' + ConnectAutomatically = $True + Ssid = 'FakeStringValue' + ProxyManualAddress = 'FakeStringValue' + ProxySettings = 'none' + ConnectWhenNetworkNameIsHidden = $True + ProxyAutomaticConfigurationUrl = 'FakeStringValue' + PreSharedKeyIsSet = $True + ProxyExclusionList = 'FakeStringValue' + ProxyManualPort = 25 + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -74,7 +97,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ProxySettings = 'none' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } @@ -113,35 +135,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ProxySettings = 'none' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - NetworkName = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.androidDeviceOwnerEnterpriseWiFiConfiguration' - PreSharedKey = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - ProxySettings = 'none' - ConnectWhenNetworkNameIsHidden = $True - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKeyIsSet = $True - ProxyExclusionList = 'FakeStringValue' - ProxyManualPort = 25 - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -175,38 +171,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ProxySettings = 'none' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - NetworkName = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.androidDeviceOwnerEnterpriseWiFiConfiguration' - PreSharedKey = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - ProxySettings = 'none' - ConnectWhenNetworkNameIsHidden = $True - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKeyIsSet = $True - ProxyExclusionList = 'FakeStringValue' - ProxyManualPort = 25 - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -226,36 +195,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { ProxyAutomaticConfigurationUrl = 'FakeStringValue' ProxyExclusionList = 'FakeStringValue' ProxyManualAddress = 'FakeStringValue' - ProxyManualPort = 25 + ProxyManualPort = 8443 # Updated property ProxySettings = 'none' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidDeviceOwnerEnterpriseWiFiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ProxyExclusionList = 'FakeStringValue' - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ProxyManualPort = 7 - ProxySettings = 'none' - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -279,32 +225,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - NetworkName = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.androidDeviceOwnerEnterpriseWiFiConfiguration' - PreSharedKey = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - ProxySettings = 'none' - ConnectWhenNetworkNameIsHidden = $True - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKeyIsSet = $True - ProxyExclusionList = 'FakeStringValue' - ProxyManualPort = 25 - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidEnterpriseWorkProfile.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidEnterpriseWorkProfile.Tests.ps1 index 1c4a274fbe..d02ae9fdce 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidEnterpriseWorkProfile.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidEnterpriseWorkProfile.Tests.ps1 @@ -24,7 +24,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $secpasswd = ConvertTo-SecureString (New-Guid | Out-String) -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin@mydomain.com', $secpasswd) - Mock -CommandName Confirm-M365DSCDependencies -MockWith { } @@ -48,6 +47,23 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.androidWorkProfileWifiConfiguration' + NetworkName = 'FakeStringValue' + WiFiSecurityType = 'open' + ConnectAutomatically = $True + ConnectWhenNetworkNameIsHidden = $True + Ssid = 'FakeStringValue' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -67,7 +83,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NetworkName = 'FakeStringValue' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } @@ -99,28 +114,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NetworkName = 'FakeStringValue' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - ConnectWhenNetworkNameIsHidden = $True - Ssid = 'FakeStringValue' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -136,6 +132,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Should -Invoke -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -Exactly 1 } } + Context -Name 'The IntuneWifiConfigurationPolicyAndroidEnterpriseWorkProfile Exists and Values are already in the desired state' -Fixture { BeforeAll { $testParams = @{ @@ -147,31 +144,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NetworkName = 'FakeStringValue' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - ConnectWhenNetworkNameIsHidden = $True - Ssid = 'FakeStringValue' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -180,7 +157,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'The IntuneWifiConfigurationPolicyAndroidEnterpriseWorkProfile exists and values are NOT in the desired state' -Fixture { BeforeAll { $testParams = @{ - ConnectAutomatically = $True + ConnectAutomatically = $False # Updated property ConnectWhenNetworkNameIsHidden = $True Description = 'FakeStringValue' DisplayName = 'FakeStringValue' @@ -188,26 +165,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NetworkName = 'FakeStringValue' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - Ssid = 'FakeStringValue' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - '@odata.type' = '#microsoft.graph.androidWorkProfileWifiConfiguration' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -230,25 +190,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidWorkProfileWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - ConnectWhenNetworkNameIsHidden = $True - Ssid = 'FakeStringValue' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidForWork.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidForWork.Tests.ps1 index b79f1cb34c..3c78b2d909 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidForWork.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidForWork.Tests.ps1 @@ -24,7 +24,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $secpasswd = ConvertTo-SecureString (New-Guid | Out-String) -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin@mydomain.com', $secpasswd) - Mock -CommandName Confirm-M365DSCDependencies -MockWith { } @@ -48,6 +47,23 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.androidForWorkWifiConfiguration' + NetworkName = 'FakeStringValue' + WiFiSecurityType = 'open' + ConnectAutomatically = $True + ConnectWhenNetworkNameIsHidden = $True + Ssid = 'FakeStringValue' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -67,7 +83,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NetworkName = 'FakeStringValue' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } @@ -99,28 +114,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NetworkName = 'FakeStringValue' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidForWorkWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - ConnectWhenNetworkNameIsHidden = $True - Ssid = 'FakeStringValue' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -147,31 +143,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NetworkName = 'FakeStringValue' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidForWorkWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - ConnectWhenNetworkNameIsHidden = $True - Ssid = 'FakeStringValue' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -180,7 +156,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'The IntuneWifiConfigurationPolicyAndroidForWork exists and values are NOT in the desired state' -Fixture { BeforeAll { $testParams = @{ - ConnectAutomatically = $True + ConnectAutomatically = $False # Updated property ConnectWhenNetworkNameIsHidden = $True Description = 'FakeStringValue' DisplayName = 'FakeStringValue' @@ -188,26 +164,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { NetworkName = 'FakeStringValue' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - Ssid = 'FakeStringValue' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - '@odata.type' = '#microsoft.graph.androidForWorkWifiConfiguration' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -230,25 +189,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.androidForWorkWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - ConnectWhenNetworkNameIsHidden = $True - Ssid = 'FakeStringValue' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidOpenSourceProject.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidOpenSourceProject.Tests.ps1 index f2499a6638..6490a44b31 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidOpenSourceProject.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyAndroidOpenSourceProject.Tests.ps1 @@ -24,7 +24,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $secpasswd = ConvertTo-SecureString (New-Guid | Out-String) -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin@mydomain.com', $secpasswd) - Mock -CommandName Confirm-M365DSCDependencies -MockWith { } @@ -48,6 +47,24 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.aospDeviceOwnerWifiConfiguration' + NetworkName = 'FakeStringValue' + WiFiSecurityType = 'open' + ConnectAutomatically = $True + PreSharedKey = 'FakeStringValue' + ConnectWhenNetworkNameIsHidden = $True + Ssid = 'FakeStringValue' + PreSharedKeyIsSet = $True + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -69,7 +86,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PreSharedKeyIsSet = $True Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } @@ -103,30 +119,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PreSharedKeyIsSet = $True Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.aospDeviceOwnerWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - PreSharedKey = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - Ssid = 'FakeStringValue' - PreSharedKeyIsSet = $True - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -155,33 +150,11 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PreSharedKeyIsSet = $True Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.aospDeviceOwnerWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - PreSharedKey = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - Ssid = 'FakeStringValue' - PreSharedKeyIsSet = $True - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -190,7 +163,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'The IntuneWifiConfigurationPolicyAndroidOpenSourceProject exists and values are NOT in the desired state' -Fixture { BeforeAll { $testParams = @{ - ConnectAutomatically = $True + ConnectAutomatically = $False # Updated property ConnectWhenNetworkNameIsHidden = $True Description = 'FakeStringValue' DisplayName = 'FakeStringValue' @@ -200,27 +173,9 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PreSharedKeyIsSet = $True Ssid = 'FakeStringValue' WiFiSecurityType = 'open' - Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - Ssid = 'FakeStringValue' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - PreSharedKey = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.aospDeviceOwnerWifiConfiguration' - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -243,27 +198,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.aospDeviceOwnerWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - PreSharedKey = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - Ssid = 'FakeStringValue' - PreSharedKeyIsSet = $True - - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyIOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyIOS.Tests.ps1 index 22aebeeef4..9cf70525f8 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyIOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyIOS.Tests.ps1 @@ -24,7 +24,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $secpasswd = ConvertTo-SecureString (New-Guid | Out-String) -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin@mydomain.com', $secpasswd) - Mock -CommandName Confirm-M365DSCDependencies -MockWith { } @@ -48,6 +47,28 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + ProxyManualPort = 25 + '@odata.type' = '#microsoft.graph.iosWifiConfiguration' + NetworkName = 'FakeStringValue' + WiFiSecurityType = 'open' + DisableMacAddressRandomization = $True + ConnectAutomatically = $True + ProxyAutomaticConfigurationUrl = 'FakeStringValue' + PreSharedKey = 'FakeStringValue' + ConnectWhenNetworkNameIsHidden = $True + ProxySettings = 'automatic' + Ssid = 'FakeStringValue' + ProxyManualAddress = 'FakeStringValue' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -113,28 +134,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ProxyManualPort = 25 - '@odata.type' = '#microsoft.graph.iosWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - DisableMacAddressRandomization = $True - ConnectAutomatically = $True - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - ProxySettings = 'automatic' - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -150,6 +149,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Should -Invoke -CommandName Remove-MgBetaDeviceManagementDeviceConfiguration -Exactly 1 } } + Context -Name 'The IntuneWifiConfigurationPolicyIOS Exists and Values are already in the desired state' -Fixture { BeforeAll { $testParams = @{ @@ -170,28 +170,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ProxyManualPort = 25 - '@odata.type' = '#microsoft.graph.iosWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - DisableMacAddressRandomization = $True - ConnectAutomatically = $True - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - ProxySettings = 'automatic' - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return true from the Test method' { @@ -212,32 +190,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PreSharedKey = 'FakeStringValue' ProxyAutomaticConfigurationUrl = 'FakeStringValue' ProxyManualAddress = 'FakeStringValue' - ProxyManualPort = 25 + ProxyManualPort = 8443 # Updated property ProxySettings = 'automatic' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.iosWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ProxyManualPort = 7 - ProxySettings = 'automatic' - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -260,29 +219,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ProxyManualPort = 25 - '@odata.type' = '#microsoft.graph.iosWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - DisableMacAddressRandomization = $True - ConnectAutomatically = $True - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - ProxySettings = 'automatic' - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyMacOS.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyMacOS.Tests.ps1 index 2d83cf2647..e55f4c3d87 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyMacOS.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyMacOS.Tests.ps1 @@ -48,6 +48,27 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + ProxyManualPort = 25 + '@odata.type' = '#microsoft.graph.macosWifiConfiguration' + NetworkName = 'FakeStringValue' + WiFiSecurityType = 'open' + ConnectAutomatically = $True + ProxyAutomaticConfigurationUrl = 'FakeStringValue' + PreSharedKey = 'FakeStringValue' + ConnectWhenNetworkNameIsHidden = $True + ProxySettings = 'automatic' + Ssid = 'FakeStringValue' + ProxyManualAddress = 'FakeStringValue' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -111,27 +132,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ProxyManualPort = 25 - '@odata.type' = '#microsoft.graph.macosWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - ProxySettings = 'automatic' - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -166,30 +166,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ProxyManualPort = 25 - '@odata.type' = '#microsoft.graph.macosWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - ProxySettings = 'automatic' - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -207,32 +185,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PreSharedKey = 'FakeStringValue' ProxyAutomaticConfigurationUrl = 'FakeStringValue' ProxyManualAddress = 'FakeStringValue' - ProxyManualPort = 25 + ProxyManualPort = 8443 # Updated property ProxySettings = 'automatic' Ssid = 'FakeStringValue' WiFiSecurityType = 'open' Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.macosWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ProxyManualPort = 7 - ProxySettings = 'automatic' - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -255,28 +214,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ProxyManualPort = 25 - '@odata.type' = '#microsoft.graph.macosWifiConfiguration' - NetworkName = 'FakeStringValue' - WiFiSecurityType = 'open' - ConnectAutomatically = $True - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - ProxySettings = 'automatic' - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyWindows10.Tests.ps1 index 5f5a40b9b1..5baace7fd2 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWifiConfigurationPolicyWindows10.Tests.ps1 @@ -24,7 +24,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $secpasswd = ConvertTo-SecureString (New-Guid | Out-String) -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential ('tenantadmin@mydomain.com', $secpasswd) - Mock -CommandName Confirm-M365DSCDependencies -MockWith { } @@ -48,6 +47,31 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + ForceFIPSCompliance = $True + NetworkName = 'FakeStringValue' + MeteredConnectionLimit = 'unrestricted' + '@odata.type' = '#microsoft.graph.windowsWifiConfiguration' + PreSharedKey = 'FakeStringValue' + WifiSecurityType = 'open' + ProxyManualPort = 25 + ProxyManualAddress = 'FakeStringValue' + ConnectWhenNetworkNameIsHidden = $True + ProxySetting = 'automatic' + ProxyAutomaticConfigurationUrl = 'FakeStringValue' + ConnectAutomatically = $True + ConnectToPreferredNetwork = $True + Ssid = 'FakeStringValue' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + Id = 'FakeStringValue' + + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -117,31 +141,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ForceFIPSCompliance = $True - NetworkName = 'FakeStringValue' - MeteredConnectionLimit = 'unrestricted' - '@odata.type' = '#microsoft.graph.windowsWifiConfiguration' - PreSharedKey = 'FakeStringValue' - WifiSecurityType = 'open' - ProxyManualPort = 25 - ProxyManualAddress = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - ProxySetting = 'automatic' - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - ConnectAutomatically = $True - ConnectToPreferredNetwork = $True - Ssid = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -179,34 +178,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ForceFIPSCompliance = $True - NetworkName = 'FakeStringValue' - MeteredConnectionLimit = 'unrestricted' - '@odata.type' = '#microsoft.graph.windowsWifiConfiguration' - PreSharedKey = 'FakeStringValue' - WifiSecurityType = 'open' - ProxyManualPort = 25 - ProxyManualAddress = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - ProxySetting = 'automatic' - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - ConnectAutomatically = $True - ConnectToPreferredNetwork = $True - Ssid = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -227,34 +200,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { PreSharedKey = 'FakeStringValue' ProxyAutomaticConfigurationUrl = 'FakeStringValue' ProxyManualAddress = 'FakeStringValue' - ProxyManualPort = 25 + ProxyManualPort = 8443 # Updated property ProxySetting = 'automatic' Ssid = 'FakeStringValue' WifiSecurityType = 'open' Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.windowsWifiConfiguration' - NetworkName = 'FakeStringValue' - MeteredConnectionLimit = 'unrestricted' - WifiSecurityType = 'open' - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - PreSharedKey = 'FakeStringValue' - ProxyManualPort = 7 - Ssid = 'FakeStringValue' - ProxyManualAddress = 'FakeStringValue' - ProxySetting = 'automatic' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } It 'Should return Values from the Get method' { @@ -277,32 +229,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - ForceFIPSCompliance = $True - NetworkName = 'FakeStringValue' - MeteredConnectionLimit = 'unrestricted' - '@odata.type' = '#microsoft.graph.windowsWifiConfiguration' - PreSharedKey = 'FakeStringValue' - WifiSecurityType = 'open' - ProxyManualPort = 25 - ProxyManualAddress = 'FakeStringValue' - ConnectWhenNetworkNameIsHidden = $True - ProxySetting = 'automatic' - ProxyAutomaticConfigurationUrl = 'FakeStringValue' - ConnectAutomatically = $True - ConnectToPreferredNetwork = $True - Ssid = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - Id = 'FakeStringValue' - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsAutopilotDeploymentProfileAzureADHybridJoined.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsAutopilotDeploymentProfileAzureADHybridJoined.Tests.ps1 index d12bf367de..28458f5d29 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsAutopilotDeploymentProfileAzureADHybridJoined.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsAutopilotDeploymentProfileAzureADHybridJoined.Tests.ps1 @@ -46,6 +46,42 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { + return @{ + AdditionalProperties = @{ + hybridAzureADJoinSkipConnectivityCheck = $True + '@odata.type' = '#microsoft.graph.activeDirectoryWindowsAutopilotDeploymentProfile' + } + Description = 'FakeStringValue' + DeviceNameTemplate = 'FakeStringValue' + DeviceType = 'windowsPc' + DisplayName = 'FakeStringValue' + EnableWhiteGlove = $True + EnrollmentStatusScreenSettings = @{ + HideInstallationProgress = $True + BlockDeviceSetupRetryByUser = $True + AllowLogCollectionOnInstallFailure = $True + AllowDeviceUseBeforeProfileAndAppInstallComplete = $True + InstallProgressTimeoutInMinutes = 25 + CustomErrorMessage = 'FakeStringValue' + AllowDeviceUseOnInstallFailure = $True + } + ExtractHardwareHash = $True + Id = 'FakeStringValue' + Language = 'FakeStringValue' + ManagementServiceAppId = 'FakeStringValue' + OutOfBoxExperienceSettings = @{ + HideEULA = $True + HideEscapeLink = $True + HidePrivacySettings = $True + DeviceUsageType = 'singleUser' + SkipKeyboardSelectionPage = $True + UserType = 'administrator' + } + + } + } + Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfileAssignment -MockWith { } @@ -144,42 +180,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { - return @{ - AdditionalProperties = @{ - hybridAzureADJoinSkipConnectivityCheck = $True - '@odata.type' = '#microsoft.graph.activeDirectoryWindowsAutopilotDeploymentProfile' - } - Description = 'FakeStringValue' - DeviceNameTemplate = 'FakeStringValue' - DeviceType = 'windowsPc' - DisplayName = 'FakeStringValue' - EnableWhiteGlove = $True - EnrollmentStatusScreenSettings = @{ - HideInstallationProgress = $True - BlockDeviceSetupRetryByUser = $True - AllowLogCollectionOnInstallFailure = $True - AllowDeviceUseBeforeProfileAndAppInstallComplete = $True - InstallProgressTimeoutInMinutes = 25 - CustomErrorMessage = 'FakeStringValue' - AllowDeviceUseOnInstallFailure = $True - } - ExtractHardwareHash = $True - Id = 'FakeStringValue' - Language = 'FakeStringValue' - ManagementServiceAppId = 'FakeStringValue' - OutOfBoxExperienceSettings = @{ - HideEULA = $True - HideEscapeLink = $True - HidePrivacySettings = $True - DeviceUsageType = 'singleUser' - SkipKeyboardSelectionPage = $True - UserType = 'administrator' - } - - } - } } It 'Should return Values from the Get method' { @@ -228,45 +228,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { - return @{ - AdditionalProperties = @{ - hybridAzureADJoinSkipConnectivityCheck = $True - '@odata.type' = '#microsoft.graph.activeDirectoryWindowsAutopilotDeploymentProfile' - } - Description = 'FakeStringValue' - DeviceNameTemplate = 'FakeStringValue' - DeviceType = 'windowsPc' - DisplayName = 'FakeStringValue' - EnableWhiteGlove = $True - EnrollmentStatusScreenSettings = @{ - HideInstallationProgress = $True - BlockDeviceSetupRetryByUser = $True - AllowLogCollectionOnInstallFailure = $True - AllowDeviceUseBeforeProfileAndAppInstallComplete = $True - InstallProgressTimeoutInMinutes = 25 - CustomErrorMessage = 'FakeStringValue' - AllowDeviceUseOnInstallFailure = $True - } - ExtractHardwareHash = $True - Id = 'FakeStringValue' - Language = 'FakeStringValue' - ManagementServiceAppId = 'FakeStringValue' - OutOfBoxExperienceSettings = @{ - HideEULA = $True - HideEscapeLink = $True - HidePrivacySettings = $True - DeviceUsageType = 'singleUser' - SkipKeyboardSelectionPage = $True - UserType = 'administrator' - } - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -285,7 +248,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { BlockDeviceSetupRetryByUser = $True AllowLogCollectionOnInstallFailure = $True AllowDeviceUseBeforeProfileAndAppInstallComplete = $True - InstallProgressTimeoutInMinutes = 25 + InstallProgressTimeoutInMinutes = 30 # Updated property CustomErrorMessage = 'FakeStringValue' AllowDeviceUseOnInstallFailure = $True } -ClientOnly) @@ -305,26 +268,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { - return @{ - Description = 'FakeStringValue' - DeviceNameTemplate = 'FakeStringValue' - DeviceType = 'windowsPc' - DisplayName = 'FakeStringValue' - EnrollmentStatusScreenSettings = @{ - InstallProgressTimeoutInMinutes = 7 - CustomErrorMessage = 'FakeStringValue' - } - Id = 'FakeStringValue' - Language = 'FakeStringValue' - ManagementServiceAppId = 'FakeStringValue' - OutOfBoxExperienceSettings = @{ - DeviceUsageType = 'singleUser' - UserType = 'administrator' - } - } - } } It 'Should return Values from the Get method' { @@ -348,43 +291,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { - return @{ - AdditionalProperties = @{ - hybridAzureADJoinSkipConnectivityCheck = $True - '@odata.type' = '#microsoft.graph.activeDirectoryWindowsAutopilotDeploymentProfile' - } - Description = 'FakeStringValue' - DeviceNameTemplate = 'FakeStringValue' - DeviceType = 'windowsPc' - DisplayName = 'FakeStringValue' - EnableWhiteGlove = $True - EnrollmentStatusScreenSettings = @{ - HideInstallationProgress = $True - BlockDeviceSetupRetryByUser = $True - AllowLogCollectionOnInstallFailure = $True - AllowDeviceUseBeforeProfileAndAppInstallComplete = $True - InstallProgressTimeoutInMinutes = 25 - CustomErrorMessage = 'FakeStringValue' - AllowDeviceUseOnInstallFailure = $True - } - ExtractHardwareHash = $True - Id = 'FakeStringValue' - Language = 'FakeStringValue' - ManagementServiceAppId = 'FakeStringValue' - OutOfBoxExperienceSettings = @{ - HideEULA = $True - HideEscapeLink = $True - HidePrivacySettings = $True - DeviceUsageType = 'singleUser' - SkipKeyboardSelectionPage = $True - UserType = 'administrator' - } - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsAutopilotDeploymentProfileAzureADJoined.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsAutopilotDeploymentProfileAzureADJoined.Tests.ps1 index 3832eeec06..ed3c4b1860 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsAutopilotDeploymentProfileAzureADJoined.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsAutopilotDeploymentProfileAzureADJoined.Tests.ps1 @@ -46,6 +46,41 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.azureADWindowsAutopilotDeploymentProfile' + } + Description = 'FakeStringValue' + DeviceNameTemplate = 'FakeStringValue' + DeviceType = 'windowsPc' + DisplayName = 'FakeStringValue' + EnableWhiteGlove = $True + EnrollmentStatusScreenSettings = @{ + HideInstallationProgress = $True + BlockDeviceSetupRetryByUser = $True + AllowLogCollectionOnInstallFailure = $True + AllowDeviceUseBeforeProfileAndAppInstallComplete = $True + InstallProgressTimeoutInMinutes = 25 + CustomErrorMessage = 'FakeStringValue' + AllowDeviceUseOnInstallFailure = $True + } + ExtractHardwareHash = $True + Id = 'FakeStringValue' + Language = 'FakeStringValue' + ManagementServiceAppId = 'FakeStringValue' + OutOfBoxExperienceSettings = @{ + HideEULA = $True + HideEscapeLink = $True + HidePrivacySettings = $True + DeviceUsageType = 'singleUser' + SkipKeyboardSelectionPage = $True + UserType = 'administrator' + } + + } + } + Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfileAssignment -MockWith { } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -139,41 +174,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.azureADWindowsAutopilotDeploymentProfile' - } - Description = 'FakeStringValue' - DeviceNameTemplate = 'FakeStringValue' - DeviceType = 'windowsPc' - DisplayName = 'FakeStringValue' - EnableWhiteGlove = $True - EnrollmentStatusScreenSettings = @{ - HideInstallationProgress = $True - BlockDeviceSetupRetryByUser = $True - AllowLogCollectionOnInstallFailure = $True - AllowDeviceUseBeforeProfileAndAppInstallComplete = $True - InstallProgressTimeoutInMinutes = 25 - CustomErrorMessage = 'FakeStringValue' - AllowDeviceUseOnInstallFailure = $True - } - ExtractHardwareHash = $True - Id = 'FakeStringValue' - Language = 'FakeStringValue' - ManagementServiceAppId = 'FakeStringValue' - OutOfBoxExperienceSettings = @{ - HideEULA = $True - HideEscapeLink = $True - HidePrivacySettings = $True - DeviceUsageType = 'singleUser' - SkipKeyboardSelectionPage = $True - UserType = 'administrator' - } - - } - } } It 'Should return Values from the Get method' { @@ -221,44 +221,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.azureADWindowsAutopilotDeploymentProfile' - } - Description = 'FakeStringValue' - DeviceNameTemplate = 'FakeStringValue' - DeviceType = 'windowsPc' - DisplayName = 'FakeStringValue' - EnableWhiteGlove = $True - EnrollmentStatusScreenSettings = @{ - HideInstallationProgress = $True - BlockDeviceSetupRetryByUser = $True - AllowLogCollectionOnInstallFailure = $True - AllowDeviceUseBeforeProfileAndAppInstallComplete = $True - InstallProgressTimeoutInMinutes = 25 - CustomErrorMessage = 'FakeStringValue' - AllowDeviceUseOnInstallFailure = $True - } - ExtractHardwareHash = $True - Id = 'FakeStringValue' - Language = 'FakeStringValue' - ManagementServiceAppId = 'FakeStringValue' - OutOfBoxExperienceSettings = @{ - HideEULA = $True - HideEscapeLink = $True - HidePrivacySettings = $True - DeviceUsageType = 'singleUser' - SkipKeyboardSelectionPage = $True - UserType = 'administrator' - } - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -277,7 +241,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { BlockDeviceSetupRetryByUser = $True AllowLogCollectionOnInstallFailure = $True AllowDeviceUseBeforeProfileAndAppInstallComplete = $True - InstallProgressTimeoutInMinutes = 25 + InstallProgressTimeoutInMinutes = 30 # Updated property CustomErrorMessage = 'FakeStringValue' AllowDeviceUseOnInstallFailure = $True } -ClientOnly) @@ -296,26 +260,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { - return @{ - Description = 'FakeStringValue' - DeviceNameTemplate = 'FakeStringValue' - DeviceType = 'windowsPc' - DisplayName = 'FakeStringValue' - EnrollmentStatusScreenSettings = @{ - InstallProgressTimeoutInMinutes = 7 - CustomErrorMessage = 'FakeStringValue' - } - Id = 'FakeStringValue' - Language = 'FakeStringValue' - ManagementServiceAppId = 'FakeStringValue' - OutOfBoxExperienceSettings = @{ - DeviceUsageType = 'singleUser' - UserType = 'administrator' - } - } - } } It 'Should return Values from the Get method' { @@ -339,42 +283,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsAutopilotDeploymentProfile -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.azureADWindowsAutopilotDeploymentProfile' - } - Description = 'FakeStringValue' - DeviceNameTemplate = 'FakeStringValue' - DeviceType = 'windowsPc' - DisplayName = 'FakeStringValue' - EnableWhiteGlove = $True - EnrollmentStatusScreenSettings = @{ - HideInstallationProgress = $True - BlockDeviceSetupRetryByUser = $True - AllowLogCollectionOnInstallFailure = $True - AllowDeviceUseBeforeProfileAndAppInstallComplete = $True - InstallProgressTimeoutInMinutes = 25 - CustomErrorMessage = 'FakeStringValue' - AllowDeviceUseOnInstallFailure = $True - } - ExtractHardwareHash = $True - Id = 'FakeStringValue' - Language = 'FakeStringValue' - ManagementServiceAppId = 'FakeStringValue' - OutOfBoxExperienceSettings = @{ - HideEULA = $True - HideEscapeLink = $True - HidePrivacySettings = $True - DeviceUsageType = 'singleUser' - SkipKeyboardSelectionPage = $True - UserType = 'administrator' - } - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsInformationProtectionPolicyWindows10MdmEnrolled.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsInformationProtectionPolicyWindows10MdmEnrolled.Tests.ps1 index ef5dbe4656..ef22358242 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsInformationProtectionPolicyWindows10MdmEnrolled.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsInformationProtectionPolicyWindows10MdmEnrolled.Tests.ps1 @@ -47,6 +47,124 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceAppManagementMdmWindowsInformationProtectionPolicy -MockWith { + return @{ + AdditionalProperties = @{ + '@odata.type' = '#microsoft.graph.MdmWindowsInformationProtectionPolicy' + } + AzureRightsManagementServicesAllowed = $True + DataRecoveryCertificate = @{ + Description = 'FakeStringValue' + ExpirationDateTime = '2023-01-01T00:00:00.0000000+00:00' + SubjectName = 'FakeStringValue' + } + Description = 'FakeStringValue' + DisplayName = 'FakeStringValue' + EnforcementLevel = 'noProtection' + EnterpriseDomain = 'FakeStringValue' + EnterpriseInternalProxyServers = @( + @{ + DisplayName = 'FakeStringValue' + Resources = @('FakeStringValue') + } + ) + EnterpriseIPRanges = @( + @{ + DisplayName = 'FakeStringValue' + Ranges = @( + @{ + AdditionalProperties = @{ + cidrAddress = 'FakeStringValue' + upperAddress = 'FakeStringValue' + lowerAddress = 'FakeStringValue' + '@odata.type' = '#microsoft.graph.iPv4CidrRange' + } + } + ) + } + ) + EnterpriseIPRangesAreAuthoritative = $True + EnterpriseNetworkDomainNames = @( + @{ + DisplayName = 'FakeStringValue' + Resources = @('FakeStringValue') + } + ) + EnterpriseProtectedDomainNames = @( + @{ + DisplayName = 'FakeStringValue' + Resources = @('FakeStringValue') + } + ) + EnterpriseProxiedDomains = @( + @{ + DisplayName = 'FakeStringValue' + ProxiedDomains = @( + @{ + Proxy = 'FakeStringValue' + IpAddressOrFQDN = 'FakeStringValue' + } + ) + } + ) + EnterpriseProxyServers = @( + @{ + DisplayName = 'FakeStringValue' + Resources = @('FakeStringValue') + } + ) + EnterpriseProxyServersAreAuthoritative = $True + ExemptApps = @( + @{ + Description = 'FakeStringValue' + AdditionalProperties = @{ + binaryName = 'FakeStringValue' + binaryVersionLow = 'FakeStringValue' + binaryVersionHigh = 'FakeStringValue' + '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' + } + Denied = $True + PublisherName = 'FakeStringValue' + ProductName = 'FakeStringValue' + DisplayName = 'FakeStringValue' + } + ) + IconsVisible = $True + Id = 'FakeStringValue' + IndexingEncryptedStoresOrItemsBlocked = $True + NeutralDomainResources = @( + @{ + DisplayName = 'FakeStringValue' + Resources = @('FakeStringValue') + } + ) + ProtectedApps = @( + @{ + Description = 'FakeStringValue' + AdditionalProperties = @{ + binaryName = 'FakeStringValue' + binaryVersionLow = 'FakeStringValue' + binaryVersionHigh = 'FakeStringValue' + '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' + } + Denied = $True + PublisherName = 'FakeStringValue' + ProductName = 'FakeStringValue' + DisplayName = 'FakeStringValue' + } + ) + ProtectionUnderLockConfigRequired = $True + RevokeOnUnenrollDisabled = $True + SmbAutoEncryptedFileExtensions = @( + @{ + DisplayName = 'FakeStringValue' + Resources = @('FakeStringValue') + } + ) + + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -281,124 +399,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMdmWindowsInformationProtectionPolicy -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.MdmWindowsInformationProtectionPolicy' - } - AzureRightsManagementServicesAllowed = $True - DataRecoveryCertificate = @{ - Description = 'FakeStringValue' - ExpirationDateTime = '2023-01-01T00:00:00.0000000+00:00' - SubjectName = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - EnforcementLevel = 'noProtection' - EnterpriseDomain = 'FakeStringValue' - EnterpriseInternalProxyServers = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseIPRanges = @( - @{ - DisplayName = 'FakeStringValue' - Ranges = @( - @{ - AdditionalProperties = @{ - cidrAddress = 'FakeStringValue' - upperAddress = 'FakeStringValue' - lowerAddress = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.iPv4CidrRange' - } - } - ) - } - ) - EnterpriseIPRangesAreAuthoritative = $True - EnterpriseNetworkDomainNames = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProtectedDomainNames = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProxiedDomains = @( - @{ - DisplayName = 'FakeStringValue' - ProxiedDomains = @( - @{ - Proxy = 'FakeStringValue' - IpAddressOrFQDN = 'FakeStringValue' - } - ) - } - ) - EnterpriseProxyServers = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProxyServersAreAuthoritative = $True - ExemptApps = @( - @{ - Description = 'FakeStringValue' - AdditionalProperties = @{ - binaryName = 'FakeStringValue' - binaryVersionLow = 'FakeStringValue' - binaryVersionHigh = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' - } - Denied = $True - PublisherName = 'FakeStringValue' - ProductName = 'FakeStringValue' - DisplayName = 'FakeStringValue' - } - ) - IconsVisible = $True - Id = 'FakeStringValue' - IndexingEncryptedStoresOrItemsBlocked = $True - NeutralDomainResources = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - ProtectedApps = @( - @{ - Description = 'FakeStringValue' - AdditionalProperties = @{ - binaryName = 'FakeStringValue' - binaryVersionLow = 'FakeStringValue' - binaryVersionHigh = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' - } - Denied = $True - PublisherName = 'FakeStringValue' - ProductName = 'FakeStringValue' - DisplayName = 'FakeStringValue' - } - ) - ProtectionUnderLockConfigRequired = $True - RevokeOnUnenrollDisabled = $True - SmbAutoEncryptedFileExtensions = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - - } - } } It 'Should return Values from the Get method' { @@ -519,127 +519,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMdmWindowsInformationProtectionPolicy -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.MdmWindowsInformationProtectionPolicy' - } - AzureRightsManagementServicesAllowed = $True - DataRecoveryCertificate = @{ - Description = 'FakeStringValue' - ExpirationDateTime = '2023-01-01T00:00:00.0000000+00:00' - SubjectName = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - EnforcementLevel = 'noProtection' - EnterpriseDomain = 'FakeStringValue' - EnterpriseInternalProxyServers = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseIPRanges = @( - @{ - DisplayName = 'FakeStringValue' - Ranges = @( - @{ - AdditionalProperties = @{ - cidrAddress = 'FakeStringValue' - upperAddress = 'FakeStringValue' - lowerAddress = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.iPv4CidrRange' - } - } - ) - } - ) - EnterpriseIPRangesAreAuthoritative = $True - EnterpriseNetworkDomainNames = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProtectedDomainNames = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProxiedDomains = @( - @{ - DisplayName = 'FakeStringValue' - ProxiedDomains = @( - @{ - Proxy = 'FakeStringValue' - IpAddressOrFQDN = 'FakeStringValue' - } - ) - } - ) - EnterpriseProxyServers = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProxyServersAreAuthoritative = $True - ExemptApps = @( - @{ - Description = 'FakeStringValue' - AdditionalProperties = @{ - binaryName = 'FakeStringValue' - binaryVersionLow = 'FakeStringValue' - binaryVersionHigh = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' - } - Denied = $True - PublisherName = 'FakeStringValue' - ProductName = 'FakeStringValue' - DisplayName = 'FakeStringValue' - } - ) - IconsVisible = $True - Id = 'FakeStringValue' - IndexingEncryptedStoresOrItemsBlocked = $True - NeutralDomainResources = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - ProtectedApps = @( - @{ - Description = 'FakeStringValue' - AdditionalProperties = @{ - binaryName = 'FakeStringValue' - binaryVersionLow = 'FakeStringValue' - binaryVersionHigh = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' - } - Denied = $True - PublisherName = 'FakeStringValue' - ProductName = 'FakeStringValue' - DisplayName = 'FakeStringValue' - } - ) - ProtectionUnderLockConfigRequired = $True - RevokeOnUnenrollDisabled = $True - SmbAutoEncryptedFileExtensions = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - - } - } } - It 'Should return true from the Test method' { Test-TargetResource @testParams | Should -Be $true } @@ -692,7 +573,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { (New-CimInstance -ClassName MSFT_MicrosoftGraphwindowsInformationProtectionProxiedDomainCollection -Property @{ DisplayName = 'FakeStringValue' ProxiedDomains = (New-CimInstance -ClassName MSFT_MicrosoftGraphproxiedDomain -Property @{ - Proxy = 'FakeStringValue' + Proxy = 'DefinedProxy' # Updated property IpAddressOrFQDN = 'FakeStringValue' } -ClientOnly) } -ClientOnly) @@ -750,111 +631,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMdmWindowsInformationProtectionPolicy -MockWith { - return @{ - DataRecoveryCertificate = @{ - Description = 'FakeStringValue' - ExpirationDateTime = '2023-01-01T00:00:00.0000000+00:00' - SubjectName = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - EnforcementLevel = 'noProtection' - EnterpriseDomain = 'FakeStringValue' - EnterpriseInternalProxyServers = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseIPRanges = @( - @{ - DisplayName = 'FakeStringValue' - Ranges = @( - @{ - AdditionalProperties = @{ - cidrAddress = 'FakeStringValue' - upperAddress = 'FakeStringValue' - lowerAddress = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.iPv4CidrRange' - } - } - ) - } - ) - EnterpriseNetworkDomainNames = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProtectedDomainNames = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProxiedDomains = @( - @{ - DisplayName = 'FakeStringValue' - ProxiedDomains = @( - @{ - Proxy = 'FakeStringValue' - IpAddressOrFQDN = 'FakeStringValue' - } - ) - } - ) - EnterpriseProxyServers = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - ExemptApps = @( - @{ - AdditionalProperties = @{ - binaryName = 'FakeStringValue' - binaryVersionLow = 'FakeStringValue' - binaryVersionHigh = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' - } - PublisherName = 'FakeStringValue' - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - ProductName = 'FakeStringValue' - } - ) - Id = 'FakeStringValue' - NeutralDomainResources = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - ProtectedApps = @( - @{ - AdditionalProperties = @{ - binaryName = 'FakeStringValue' - binaryVersionLow = 'FakeStringValue' - binaryVersionHigh = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' - } - PublisherName = 'FakeStringValue' - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - ProductName = 'FakeStringValue' - } - ) - SmbAutoEncryptedFileExtensions = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - } - } } It 'Should return Values from the Get method' { @@ -878,125 +654,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceAppManagementMdmWindowsInformationProtectionPolicy -MockWith { - return @{ - AdditionalProperties = @{ - '@odata.type' = '#microsoft.graph.MdmWindowsInformationProtectionPolicy' - } - AzureRightsManagementServicesAllowed = $True - DataRecoveryCertificate = @{ - Description = 'FakeStringValue' - ExpirationDateTime = '2023-01-01T00:00:00.0000000+00:00' - SubjectName = 'FakeStringValue' - } - Description = 'FakeStringValue' - DisplayName = 'FakeStringValue' - EnforcementLevel = 'noProtection' - EnterpriseDomain = 'FakeStringValue' - EnterpriseInternalProxyServers = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseIPRanges = @( - @{ - DisplayName = 'FakeStringValue' - Ranges = @( - @{ - AdditionalProperties = @{ - cidrAddress = 'FakeStringValue' - upperAddress = 'FakeStringValue' - lowerAddress = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.iPv4CidrRange' - } - } - ) - } - ) - EnterpriseIPRangesAreAuthoritative = $True - EnterpriseNetworkDomainNames = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProtectedDomainNames = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProxiedDomains = @( - @{ - DisplayName = 'FakeStringValue' - ProxiedDomains = @( - @{ - Proxy = 'FakeStringValue' - IpAddressOrFQDN = 'FakeStringValue' - } - ) - } - ) - EnterpriseProxyServers = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - EnterpriseProxyServersAreAuthoritative = $True - ExemptApps = @( - @{ - Description = 'FakeStringValue' - AdditionalProperties = @{ - binaryName = 'FakeStringValue' - binaryVersionLow = 'FakeStringValue' - binaryVersionHigh = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' - } - Denied = $True - PublisherName = 'FakeStringValue' - ProductName = 'FakeStringValue' - DisplayName = 'FakeStringValue' - } - ) - IconsVisible = $True - Id = 'FakeStringValue' - IndexingEncryptedStoresOrItemsBlocked = $True - NeutralDomainResources = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - ProtectedApps = @( - @{ - Description = 'FakeStringValue' - AdditionalProperties = @{ - binaryName = 'FakeStringValue' - binaryVersionLow = 'FakeStringValue' - binaryVersionHigh = 'FakeStringValue' - '@odata.type' = '#microsoft.graph.windowsInformationProtectionDesktopApp' - } - Denied = $True - PublisherName = 'FakeStringValue' - ProductName = 'FakeStringValue' - DisplayName = 'FakeStringValue' - } - ) - ProtectionUnderLockConfigRequired = $True - RevokeOnUnenrollDisabled = $True - SmbAutoEncryptedFileExtensions = @( - @{ - DisplayName = 'FakeStringValue' - Resources = @('FakeStringValue') - } - ) - - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessDriverUpdateProfileWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessDriverUpdateProfileWindows10.Tests.ps1 index 05caad9230..8b63573ca7 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessDriverUpdateProfileWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessDriverUpdateProfileWindows10.Tests.ps1 @@ -43,6 +43,19 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return "Credentials" } + Mock -CommandName Invoke-MgGraphRequest -MockWith { + return @{ + value = @( + @{ + ApprovalType = 'manual' + DisplayName = 'FakeStringValue' + Description = 'FakeStringValue' + Id = 'FakeStringValue' + } + ) + } + } + # Mock Write-M365DSCHost to hide output during the tests Mock -CommandName Write-M365DSCHost -MockWith { } @@ -89,19 +102,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Invoke-MgGraphRequest -MockWith { - return @{ - value = @( - @{ - ApprovalType = 'manual' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - Id = 'FakeStringValue' - } - ) - } - } } It 'Should return Values from the Get method' { @@ -148,24 +148,13 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name "The IntuneWindowsUpdateForBusinessDriverUpdateProfileWindows10 exists and values are NOT in the desired state" -Fixture { BeforeAll { $testParams = @{ - ApprovalType = 'manual' + ApprovalType = 'automatic' # Updated property DisplayName = 'FakeStringValue' Description = 'FakeStringValue' Id = 'FakeStringValue' Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Invoke-MgGraphRequest -MockWith { - return @{ - value = @{ - ApprovalType = 'manual' - DisplayName = 'FakeStringValue1234' - Description = 'FakeStringValue' - Id = 'FakeStringValue' - } - } - } } It 'Should return Values from the Get method' { @@ -189,18 +178,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Invoke-MgGraphRequest -MockWith { - return @{ - value = @{ - ApprovalType = 'manual' - DisplayName = 'FakeStringValue' - Description = 'FakeStringValue' - Id = 'FakeStringValue' - } - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessQualityUpdateProfileWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessQualityUpdateProfileWindows10.Tests.ps1 index 6558b65abd..f9e027331b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessQualityUpdateProfileWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessQualityUpdateProfileWindows10.Tests.ps1 @@ -52,6 +52,19 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Mock -CommandName Write-Warning -MockWith { } + Mock -CommandName Get-MgBetaDeviceManagementWindowsQualityUpdateProfile -MockWith { + return @{ + Description = "Description" + DisplayName = "IntuneQualityUpdate" + ExpeditedUpdateSettings = @{ + DaysUntilForcedReboot = 0 + QualityUpdateRelease = "2024-06-11T00:00:00Z" + } + Id = "FakeStringValue" + RoleScopeTagIds = @("0") + } + } + $Script:exportedInstances =$null $Script:ExportMode = $false @@ -137,19 +150,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsQualityUpdateProfile -MockWith { - return @{ - Description = "Description" - DisplayName = "IntuneQualityUpdate" - ExpeditedUpdateSettings = @{ - DaysUntilForcedReboot = 0 - QualityUpdateRelease = "2024-06-11T00:00:00Z" - } - Id = "FakeStringValue" - RoleScopeTagIds = @("0") - } - } } It 'Should return Values from the Get method' { @@ -186,19 +186,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsQualityUpdateProfile -MockWith { - return @{ - Description = "Description" - DisplayName = "IntuneQualityUpdate" - ExpeditedUpdateSettings = @{ - DaysUntilForcedReboot = 0 - QualityUpdateRelease = "2024-06-11T00:00:00Z" - } - Id = "FakeStringValue" - RoleScopeTagIds = @("0") - } - } } It 'Should return true from the Test method' { @@ -219,7 +206,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Description = "Description" DisplayName = "IntuneQualityUpdate" ExpeditedUpdateSettings = (New-CimInstance -ClassName MSFT_MicrosoftGraphExpeditedWindowsQualityUpdateSettings -Property @{ - DaysUntilForcedReboot = 0 + DaysUntilForcedReboot = 1 # Updated property QualityUpdateRelease = "2024-06-11T00:00:00Z" } -ClientOnly) Id = "FakeStringValue" @@ -227,19 +214,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential; } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsQualityUpdateProfile -MockWith { - return @{ - Description = "Description" - DisplayName = "IntuneQualityUpdate" - ExpeditedUpdateSettings = @{ - DaysUntilForcedReboot = 1 #drift - QualityUpdateRelease = "2024-06-11T00:00:00Z" - } - Id = "FakeStringValue" - RoleScopeTagIds = @("0") - } - } } It 'Should return Values from the Get method' { @@ -263,19 +237,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementWindowsQualityUpdateProfile -MockWith { - return @{ - Description = "Description" - DisplayName = "IntuneQualityUpdate" - ExpeditedUpdateSettings = @{ - DaysUntilForcedReboot = 0 - QualityUpdateRelease = "2024-06-11T00:00:00Z" - } - Id = "FakeStringValue" - RoleScopeTagIds = @("0") - } - } } It 'Should Reverse Engineer resource from the Export method' { diff --git a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessRingUpdateProfileWindows10.Tests.ps1 b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessRingUpdateProfileWindows10.Tests.ps1 index 35de41d17a..170e34f92b 100644 --- a/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessRingUpdateProfileWindows10.Tests.ps1 +++ b/Tests/Unit/Microsoft365DSC/Microsoft365DSC.IntuneWindowsUpdateForBusinessRingUpdateProfileWindows10.Tests.ps1 @@ -40,6 +40,57 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { return 'Credentials' } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { + return @{ + AdditionalProperties = @{ + postponeRebootUntilAfterDeadline = $True + featureUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' + businessReadyUpdatesOnly = 'userDefined' + updateWeeks = 'userDefined' + qualityUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' + skipChecksBeforeRestart = $True + deadlineForFeatureUpdatesInDays = 25 + featureUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' + qualityUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' + scheduleImminentRestartWarningInMinutes = 25 + featureUpdatesDeferralPeriodInDays = 25 + driversExcluded = $True + featureUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' + deadlineForQualityUpdatesInDays = 25 + deliveryOptimizationMode = 'userDefined' + scheduleRestartWarningInHours = 25 + prereleaseFeatures = 'userDefined' + featureUpdatesPaused = $True + updateNotificationLevel = 'notConfigured' + automaticUpdateMode = 'userDefined' + allowWindows11Upgrade = $True + featureUpdatesRollbackWindowInDays = 25 + engagedRestartTransitionScheduleInDays = 25 + engagedRestartDeadlineInDays = 25 + qualityUpdatesDeferralPeriodInDays = 25 + qualityUpdatesPaused = $True + deadlineGracePeriodInDays = 25 + autoRestartNotificationDismissal = 'notConfigured' + installationSchedule = @{ + activeHoursStart = '00:00:00' + scheduledInstallTime = '00:00:00' + scheduledInstallDay = 'userDefined' + activeHoursEnd = '00:00:00' + '@odata.type' = '#microsoft.graph.windowsUpdateActiveHoursInstall' + } + engagedRestartSnoozeScheduleInDays = 25 + '@odata.type' = '#microsoft.graph.windowsUpdateForBusinessConfiguration' + qualityUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' + userPauseAccess = 'notConfigured' + userWindowsUpdateScanAccess = 'notConfigured' + microsoftUpdateServiceAllowed = $True + } + description = 'FakeStringValue' + displayName = 'FakeStringValue' + id = 'FakeStringValue' + } + } + Mock -CommandName Get-MgBetaDeviceManagementDeviceConfigurationAssignment -MockWith { } Mock -CommandName Update-DeviceConfigurationPolicyAssignment -MockWith { @@ -167,57 +218,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Absent' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - postponeRebootUntilAfterDeadline = $True - featureUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' - businessReadyUpdatesOnly = 'userDefined' - updateWeeks = 'userDefined' - qualityUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' - skipChecksBeforeRestart = $True - deadlineForFeatureUpdatesInDays = 25 - featureUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' - qualityUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' - scheduleImminentRestartWarningInMinutes = 25 - featureUpdatesDeferralPeriodInDays = 25 - driversExcluded = $True - featureUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' - deadlineForQualityUpdatesInDays = 25 - deliveryOptimizationMode = 'userDefined' - scheduleRestartWarningInHours = 25 - prereleaseFeatures = 'userDefined' - featureUpdatesPaused = $True - updateNotificationLevel = 'notConfigured' - automaticUpdateMode = 'userDefined' - allowWindows11Upgrade = $True - featureUpdatesRollbackWindowInDays = 25 - engagedRestartTransitionScheduleInDays = 25 - engagedRestartDeadlineInDays = 25 - qualityUpdatesDeferralPeriodInDays = 25 - qualityUpdatesPaused = $True - deadlineGracePeriodInDays = 25 - autoRestartNotificationDismissal = 'notConfigured' - installationSchedule = @{ - activeHoursStart = '00:00:00' - scheduledInstallTime = '00:00:00' - scheduledInstallDay = 'userDefined' - activeHoursEnd = '00:00:00' - '@odata.type' = '#microsoft.graph.windowsUpdateActiveHoursInstall' - } - engagedRestartSnoozeScheduleInDays = 25 - '@odata.type' = '#microsoft.graph.windowsUpdateForBusinessConfiguration' - qualityUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' - userPauseAccess = 'notConfigured' - userWindowsUpdateScanAccess = 'notConfigured' - microsoftUpdateServiceAllowed = $True - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -283,57 +283,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - postponeRebootUntilAfterDeadline = $True - featureUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' - businessReadyUpdatesOnly = 'userDefined' - updateWeeks = 'userDefined' - qualityUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' - skipChecksBeforeRestart = $True - deadlineForFeatureUpdatesInDays = 25 - featureUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' - qualityUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' - scheduleImminentRestartWarningInMinutes = 25 - featureUpdatesDeferralPeriodInDays = 25 - driversExcluded = $True - featureUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' - deadlineForQualityUpdatesInDays = 25 - deliveryOptimizationMode = 'userDefined' - scheduleRestartWarningInHours = 25 - prereleaseFeatures = 'userDefined' - featureUpdatesPaused = $True - updateNotificationLevel = 'notConfigured' - automaticUpdateMode = 'userDefined' - allowWindows11Upgrade = $True - featureUpdatesRollbackWindowInDays = 25 - engagedRestartTransitionScheduleInDays = 25 - engagedRestartDeadlineInDays = 25 - qualityUpdatesDeferralPeriodInDays = 25 - qualityUpdatesPaused = $True - deadlineGracePeriodInDays = 25 - autoRestartNotificationDismissal = 'notConfigured' - installationSchedule = @{ - activeHoursStart = '00:00:00' - scheduledInstallTime = '00:00:00' - scheduledInstallDay = 'userDefined' - activeHoursEnd = '00:00:00' - '@odata.type' = '#microsoft.graph.windowsUpdateActiveHoursInstall' - } - engagedRestartSnoozeScheduleInDays = 25 - '@odata.type' = '#microsoft.graph.windowsUpdateForBusinessConfiguration' - qualityUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' - userPauseAccess = 'notConfigured' - userWindowsUpdateScanAccess = 'notConfigured' - microsoftUpdateServiceAllowed = $True - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - } - } } It 'Should return true from the Test method' { @@ -344,7 +293,7 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Context -Name 'The IntuneWindowsUpdateForBusinessRingUpdateProfileWindows10 exists and values are NOT in the desired state' -Fixture { BeforeAll { $testParams = @{ - AllowWindows11Upgrade = $True + AllowWindows11Upgrade = $False # Updated property AutomaticUpdateMode = 'userDefined' AutoRestartNotificationDismissal = 'notConfigured' BusinessReadyUpdatesOnly = 'userDefined' @@ -390,50 +339,6 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { Ensure = 'Present' Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - automaticUpdateMode = 'userDefined' - deliveryOptimizationMode = 'userDefined' - deadlineForQualityUpdatesInDays = 7 - featureUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' - featureUpdatesDeferralPeriodInDays = 7 - scheduleImminentRestartWarningInMinutes = 7 - scheduleRestartWarningInHours = 7 - qualityUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' - deadlineForFeatureUpdatesInDays = 7 - updateWeeks = 'userDefined' - qualityUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' - businessReadyUpdatesOnly = 'userDefined' - featureUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' - featureUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' - qualityUpdatesDeferralPeriodInDays = 7 - updateNotificationLevel = 'notConfigured' - '@odata.type' = '#microsoft.graph.WindowsUpdateForBusinessConfiguration' - engagedRestartSnoozeScheduleInDays = 7 - installationSchedule = @{ - activeHoursStart = '00:00:00' - scheduledInstallTime = '00:00:00' - scheduledInstallDay = 'userDefined' - activeHoursEnd = '00:00:00' - '@odata.type' = '#microsoft.graph.windowsUpdateActiveHoursInstall' - } - autoRestartNotificationDismissal = 'notConfigured' - userWindowsUpdateScanAccess = 'notConfigured' - deadlineGracePeriodInDays = 7 - engagedRestartDeadlineInDays = 7 - userPauseAccess = 'notConfigured' - qualityUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' - engagedRestartTransitionScheduleInDays = 7 - prereleaseFeatures = 'userDefined' - featureUpdatesRollbackWindowInDays = 7 - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - } - } } It 'Should return Values from the Get method' { @@ -457,60 +362,8 @@ Describe -Name $Global:DscHelper.DescribeHeader -Fixture { $testParams = @{ Credential = $Credential } - - Mock -CommandName Get-MgBetaDeviceManagementDeviceConfiguration -MockWith { - return @{ - AdditionalProperties = @{ - postponeRebootUntilAfterDeadline = $True - featureUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' - businessReadyUpdatesOnly = 'userDefined' - updateWeeks = 'userDefined' - qualityUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' - skipChecksBeforeRestart = $True - deadlineForFeatureUpdatesInDays = 25 - featureUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' - qualityUpdatesPauseExpiryDateTime = '2023-01-01T00:00:00.0000000+00:00' - scheduleImminentRestartWarningInMinutes = 25 - featureUpdatesDeferralPeriodInDays = 25 - driversExcluded = $True - featureUpdatesPauseStartDate = '2023-01-01T00:00:00.0000000' - deadlineForQualityUpdatesInDays = 25 - deliveryOptimizationMode = 'userDefined' - scheduleRestartWarningInHours = 25 - prereleaseFeatures = 'userDefined' - featureUpdatesPaused = $True - updateNotificationLevel = 'notConfigured' - automaticUpdateMode = 'userDefined' - allowWindows11Upgrade = $True - featureUpdatesRollbackWindowInDays = 25 - engagedRestartTransitionScheduleInDays = 25 - engagedRestartDeadlineInDays = 25 - qualityUpdatesDeferralPeriodInDays = 25 - qualityUpdatesPaused = $True - deadlineGracePeriodInDays = 25 - autoRestartNotificationDismissal = 'notConfigured' - installationSchedule = @{ - AdditionalProperties = @{ - activeHoursStart = '00:00:00' - scheduledInstallTime = '00:00:00' - scheduledInstallDay = 'userDefined' - activeHoursEnd = '00:00:00' - '@odata.type' = '#microsoft.graph.windowsUpdateActiveHoursInstall' - } - } - engagedRestartSnoozeScheduleInDays = 25 - '@odata.type' = '#microsoft.graph.windowsUpdateForBusinessConfiguration' - qualityUpdatesRollbackStartDateTime = '2023-01-01T00:00:00.0000000+00:00' - userPauseAccess = 'notConfigured' - userWindowsUpdateScanAccess = 'notConfigured' - microsoftUpdateServiceAllowed = $True - } - description = 'FakeStringValue' - displayName = 'FakeStringValue' - id = 'FakeStringValue' - } - } } + It 'Should Reverse Engineer resource from the Export method' { $result = Export-TargetResource @testParams $result | Should -Not -BeNullOrEmpty