Skip to content

Commit

Permalink
Merge pull request microsoft#2231 from NikCharlebois/Various-Intune-F…
Browse files Browse the repository at this point in the history
…ixes

Added some missing Intune unit tests
  • Loading branch information
NikCharlebois authored Aug 29, 2022
2 parents 311b725 + 4835927 commit af1ca24
Show file tree
Hide file tree
Showing 31 changed files with 8,140 additions and 3,597 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function Get-TargetResource

$result = @{
Identity = $ResourceConfiguration.Identity
ResourcePropertySchema = $ResourceConfiguration.ResourcePropertySchema
ResourcePropertySchema = $ResourceConfiguration.ResourcePropertySchema
Credential = $Credential
Ensure = 'Present'
ApplicationId = $ApplicationId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function Get-TargetResource
[Parameter(Mandatory = $True)]
[System.String]
[ValidateSet('Absent', 'Present')]
$Ensure = $true,
$Ensure = "Present",

[Parameter()]
[System.Management.Automation.PSCredential]
Expand Down Expand Up @@ -143,12 +143,11 @@ function Get-TargetResource
$context=Get-MgContext
if($null -eq $context)
{
New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters -ErrorAction Stop
$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
-InboundParameters $PSBoundParameters -ProfileName 'beta' -ErrorAction Stop
}

Write-Verbose -Message "Select-MgProfile"
Select-MgProfile -Name 'beta'
#Ensure the proper dependencies are installed in the current environment.
Confirm-M365DSCDependencies

Expand Down Expand Up @@ -177,6 +176,12 @@ function Get-TargetResource
return $nullResult
}

if ($null -eq $policy)
{
Write-Verbose -Message "No Endpoint Protection Attack Surface Protection rules Policy {$DisplayName} was found"
return $nullResult
}

#Retrieve policy specific settings
[array]$settings = Get-MgDeviceManagementIntentSetting `
-DeviceManagementIntentId $Identity `
Expand Down Expand Up @@ -338,7 +343,7 @@ function Set-TargetResource
[Parameter(Mandatory = $True)]
[System.String]
[ValidateSet('Absent', 'Present')]
$Ensure = $true,
$Ensure = "Present",

[Parameter()]
[System.Management.Automation.PSCredential]
Expand Down Expand Up @@ -556,7 +561,7 @@ function Test-TargetResource
[Parameter(Mandatory = $True)]
[System.String]
[ValidateSet('Absent', 'Present')]
$Ensure = $true,
$Ensure = "Present",

[Parameter()]
[System.Management.Automation.PSCredential]
Expand Down Expand Up @@ -665,7 +670,7 @@ function Export-TargetResource

try
{
$policyTemplateID='0e237410-1367-4844-bd7f-15fb0f08943b'
$policyTemplateID = '0e237410-1367-4844-bd7f-15fb0f08943b'
[array]$policies = Get-MgDeviceManagementIntent `
-ErrorAction Stop `
-All:$true `
Expand Down
Loading

0 comments on commit af1ca24

Please sign in to comment.