Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix limited Microsoft Graph results on Get #5456

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* Added support for AccessTokens.
* EXOExternalInOutlook
* Added support for AccessTokens.
* INTUNE
* Add parameter `-All` to Graph requests to fetch all policies on Get.
* IntuneAndroidManagedStoreAppConfiguration
* Initial release.
* MISC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function Get-TargetResource
Write-Verbose -Message "No Endpoint Protection Attack Surface Protection rules Policy with identity {$Identity} was found"
if (-not [String]::IsNullOrEmpty($DisplayName))
{
$policy = Get-MgBetaDeviceManagementIntent -Filter "DisplayName eq '$DisplayName'" -ErrorAction SilentlyContinue
$policy = Get-MgBetaDeviceManagementIntent -All -Filter "DisplayName eq '$DisplayName'" -ErrorAction SilentlyContinue
}

if(([array]$policy).count -gt 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function Get-TargetResource
Write-Verbose -Message "No Account Protection Local User Group Membership Policy with identity {$Identity} was found"
if (-not [String]::IsNullOrEmpty($DisplayName))
{
$policy = Get-MgBetaDeviceManagementConfigurationPolicy -Filter "Name eq '$DisplayName'" -ErrorAction SilentlyContinue
$policy = Get-MgBetaDeviceManagementConfigurationPolicy -All -Filter "Name eq '$DisplayName'" -ErrorAction SilentlyContinue

if(([array]$devicePolicy).Count -gt 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ function Get-TargetResource
if (-not [System.String]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementConfigurationPolicy `
-All `
-Filter "Name eq '$DisplayName'" `
-ErrorAction SilentlyContinue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ function Get-TargetResource
if (-not [System.String]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementConfigurationPolicy `
-All `
-Filter "Name eq '$DisplayName'" `
-ErrorAction SilentlyContinue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ function Get-TargetResource
if (-not [System.String]::IsNullOrEmpty($DisplayName))
{
$policy = Get-MgBetaDeviceManagementConfigurationPolicy `
-All `
-Filter "Name eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ function Get-TargetResource
if (-not [System.String]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementConfigurationPolicy `
-All `
-Filter "Name eq '$DisplayName'" `
-ErrorAction SilentlyContinue
}
Expand All @@ -199,7 +200,7 @@ function Get-TargetResource
-ErrorAction Stop

$policySettings = @{}
$policySettings = Export-IntuneSettingCatalogPolicySettings -Settings $settings -ReturnHashtable $policySettings
$policySettings = Export-IntuneSettingCatalogPolicySettings -Settings $settings -ReturnHashtable $policySettings

$results = @{
#region resource generator code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ function Get-TargetResource
if (-not [System.String]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementConfigurationPolicy `
-All `
-Filter "Name eq '$DisplayName'" `
-ErrorAction SilentlyContinue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$instance = Get-MgBetaDeviceAppManagementMobileAppCategory `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceAppManagementMobileAppConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function Get-TargetResource

try
{
$configPolicy = Get-MgBetaDeviceAppManagementTargetedManagedAppConfiguration -Filter "displayName eq '$DisplayName'" `
$configPolicy = Get-MgBetaDeviceAppManagementTargetedManagedAppConfiguration -All -Filter "displayName eq '$DisplayName'" `
-ErrorAction Stop
}
catch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function Get-TargetResource
if ($policy.Length -eq 0)
{
Write-Verbose -Message "No iOS App Protection Policy {$Identity} was found by Identity. Trying to retrieve by DisplayName"
[Array]$policy = Get-MgBetaDeviceAppManagementiOSManagedAppProtection -Filter "DisplayName eq '$DisplayName'" -ErrorAction SilentlyContinue
[Array]$policy = Get-MgBetaDeviceAppManagementiOSManagedAppProtection -All -Filter "DisplayName eq '$DisplayName'" -ErrorAction SilentlyContinue
}

if ($policy.Length -gt 1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function Get-TargetResource
try
{
#Retrieve policy general settings
$policy = Get-MgBetaDeviceManagementIntent -Filter "displayName eq '$DisplayName'" -ErrorAction Stop | Where-Object -FilterScript { $_.TemplateId -eq '63be6324-e3c9-4c97-948a-e7f4b96f0f20' }
$policy = Get-MgBetaDeviceManagementIntent -All -Filter "displayName eq '$DisplayName'" -ErrorAction Stop | Where-Object -FilterScript { $_.TemplateId -eq '63be6324-e3c9-4c97-948a-e7f4b96f0f20' }

if(([array]$policy).count -gt 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ function Get-TargetResource
if (-not [System.String]::IsNullOrEmpty($DisplayName))
{
$policy = Get-MgBetaDeviceManagementConfigurationPolicy `
-All `
-Filter "Name eq '$DisplayName' and templateReference/TemplateId eq '$templateReferenceId'" `
-ErrorAction SilentlyContinue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function Get-TargetResource {
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$instance = Get-MgBetaDeviceManagementDerivedCredential `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function Get-TargetResource

try
{
$category = Get-MgBetaDeviceManagementDeviceCategory -Filter "displayName eq '$DisplayName'"
$category = Get-MgBetaDeviceManagementDeviceCategory -Filter "displayName eq '$DisplayName'" -All

if ($null -eq $category)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function Get-TargetResource
$nullResult.Ensure = 'Absent'
try
{
$devicePolicy = Get-MgBetaDeviceManagementDeviceCompliancePolicy `
$devicePolicy = Get-MgBetaDeviceManagementDeviceCompliancePolicy -All `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { $_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.androidCompliancePolicy' -and `
$_.displayName -eq $($DisplayName) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ function Get-TargetResource
try
{
$devicePolicy = Get-MgBetaDeviceManagementDeviceCompliancePolicy `
-All `
-ErrorAction Stop | Where-Object `
-FilterScript {
$_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.androidDeviceOwnerCompliancePolicy' -and `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function Get-TargetResource
try
{
$devicePolicy = Get-MgBetaDeviceManagementDeviceCompliancePolicy `
-All `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { $_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.androidWorkProfileCompliancePolicy' -and `
$_.displayName -eq $($DisplayName) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ function Get-TargetResource
try
{
$devicePolicy = Get-MgBetaDeviceManagementDeviceCompliancePolicy `
-All `
-ErrorAction Stop | Where-Object `
-FilterScript { $_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.macOSCompliancePolicy' -and `
$_.displayName -eq $($DisplayName) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ function Get-TargetResource
try
{
$devicePolicy = Get-MgBetaDeviceManagementDeviceCompliancePolicy `
-All `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { $_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.windows10CompliancePolicy' -and `
$_.displayName -eq $($DisplayName) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function Get-TargetResource
try
{
$devicePolicy = Get-MgBetaDeviceManagementDeviceCompliancePolicy `
-All `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { $_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.iosCompliancePolicy' -and `
$_.displayName -eq $($DisplayName) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementGroupPolicyConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue
if ($null -eq $getValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ function Get-TargetResource
if (-not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
Expand Down Expand Up @@ -377,7 +378,7 @@ function Get-TargetResource
AccessTokens = $AccessTokens
#endregion
}

$assignmentsValues = Get-MgBetaDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId $Id
$assignmentResult = @()
if ($assignmentsValues.Count -gt 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue
}
Expand Down Expand Up @@ -152,7 +153,7 @@ function Get-TargetResource
AccessTokens = $AccessTokens
#endregion
}

$assignmentsValues = Get-MgBetaDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId $Id
$assignmentResult = @()
if ($assignmentsValues.Count -gt 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
Expand Down Expand Up @@ -190,7 +191,7 @@ function Get-TargetResource
AccessTokens = $AccessTokens
#endregion
}

$assignmentsValues = Get-MgBetaDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId $Id
$assignmentResult = @()
if ($assignmentsValues.Count -gt 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
Expand Down Expand Up @@ -342,7 +343,7 @@ function Get-TargetResource
AccessTokens = $AccessTokens
#endregion
}

$assignmentsValues = Get-MgBetaDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId $Id
$assignmentResult = @()
if ($assignmentsValues.Count -gt 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object -FilterScript {
$_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.windows10NetworkBoundaryConfiguration'
Expand Down Expand Up @@ -170,7 +171,7 @@ function Get-TargetResource
AccessTokens = $AccessTokens
#endregion
}

$assignmentsValues = Get-MgBetaDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId $Id
$assignmentResult = @()
if ($assignmentsValues.Count -gt 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
Expand Down Expand Up @@ -254,7 +255,7 @@ function Get-TargetResource
AccessTokens = $AccessTokens
#endregion
}

$assignmentsValues = Get-MgBetaDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId $Id
$assignmentResult = @()
if ($assignmentsValues.Count -gt 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementDeviceShellScript `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ExpandProperty "assignments" `
-ErrorAction SilentlyContinue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ function Get-TargetResource
if (-Not [string]::IsNullOrEmpty($DisplayName))
{
$getValue = Get-MgBetaDeviceManagementScript `
-All `
-Filter "DisplayName eq '$DisplayName'" `
-ErrorAction SilentlyContinue
if ($null -ne $getValue)
Expand Down Expand Up @@ -159,7 +160,7 @@ function Get-TargetResource
AccessTokens = $AccessTokens
#endregion
}

$assignmentsValues = Get-MgBetaDeviceManagementScriptAssignment -DeviceManagementScriptId $Id
$assignmentResult = @()
if ($assignmentsValues.Count -gt 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ function Get-TargetResource

if ($null -eq $getValue)
{
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration -Filter "DisplayName eq '$Displayname'" -ErrorAction SilentlyContinue | Where-Object `
$getValue = Get-MgBetaDeviceManagementDeviceConfiguration -All -Filter "DisplayName eq '$Displayname'" -ErrorAction SilentlyContinue | Where-Object `
-FilterScript { `
$_.AdditionalProperties.'@odata.type' -eq '#microsoft.graph.androidGeneralDeviceConfiguration' `
}
Expand Down
Loading
Loading