Skip to content

Commit

Permalink
Merge pull request #5713 from NikCharlebois/Various-Fixes
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
NikCharlebois authored Feb 3, 2025
2 parents dc2b461 + 78df704 commit 36d9534
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change log for Microsoft365DSC

# UNRELEASED

* AADConditionalAccessPolicy
* Changed the InsiderRiskTypes property to a string array.

# 1.25.129.3

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

[Parameter()]
[ValidateSet('minor', 'moderate', 'elevated', 'unknownFutureValue')]
[System.String]
[System.String[]]
$InsiderRiskLevels,

#generic
Expand Down Expand Up @@ -649,6 +649,12 @@ function Get-TargetResource
}
}

$InsiderRiskLevelsValue = $null
if (-not [System.String]::IsNullOrEmpty($Policy.Conditions.InsiderRiskLevels))
{
$InsiderRiskLevelsValue = $Policy.Conditions.InsiderRiskLevels.Split(',')
}

$result = @{
DisplayName = $Policy.DisplayName
Id = $Policy.Id
Expand Down Expand Up @@ -727,7 +733,7 @@ function Get-TargetResource
TransferMethods = [System.String]$Policy.Conditions.AuthenticationFlows.TransferMethods
#Standard part
TermsOfUse = $termOfUseName
InsiderRiskLevels = $Policy.Conditions.InsiderRiskLevels
InsiderRiskLevels = $InsiderRiskLevelsValue
Ensure = 'Present'
Credential = $Credential
ApplicationSecret = $ApplicationSecret
Expand Down Expand Up @@ -968,7 +974,7 @@ function Set-TargetResource

[Parameter()]
[ValidateSet('minor', 'moderate', 'elevated', 'unknownFutureValue')]
[System.String]
[System.String[]]
$InsiderRiskLevels,

#generic
Expand Down Expand Up @@ -1687,7 +1693,7 @@ function Set-TargetResource

if ([String]::IsNullOrEmpty($InsiderRiskLevels) -eq $false)
{
$conditions.Add('insiderRiskLevels', $InsiderRiskLevels)
$conditions.Add('insiderRiskLevels', $($InsiderRiskLevels -join ','))
}

Write-Verbose -Message 'Set-Targetresource: process risk levels and app types'
Expand Down Expand Up @@ -2165,7 +2171,7 @@ function Test-TargetResource

[Parameter()]
[ValidateSet('minor', 'moderate', 'elevated', 'unknownFutureValue')]
[System.String]
[System.String[]]
$InsiderRiskLevels,

#generic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class MSFT_AADConditionalAccessPolicy : OMI_BaseResource
[Write, Description("Name of the associated authentication strength policy.")] String AuthenticationStrength;
[Write, Description("Names of the associated authentication flow transfer methods. Possible values are '', 'deviceCodeFlow', 'authenticationTransfer', or 'deviceCodeFlow,authenticationTransfer'.")] String TransferMethods;
[Write, Description("Authentication context class references.")] String AuthenticationContexts[];
[Write, Description("Insider risk levels conditions."), ValueMap{"minor", "moderate", "elevated", "unknownFutureValue"}, Values{"minor", "moderate", "elevated", "unknownFutureValue"}] String InsiderRiskLevels;
[Write, Description("Insider risk levels conditions."), ValueMap{"minor", "moderate", "elevated", "unknownFutureValue"}, Values{"minor", "moderate", "elevated", "unknownFutureValue"}] String InsiderRiskLevels[];
[Write, Description("Specify if the Azure AD CA Policy should exist or not."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Credentials for the Microsoft Graph delegated permissions."), EmbeddedInstance("MSFT_Credential")] string Credential;
[Write, Description("Id of the Azure Active Directory application to authenticate with.")] String ApplicationId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3126,7 +3126,7 @@ function Export-TargetResource
$Results.Remove('CompliantAppsList') | Out-Null
}
}
if ($Results.MediaContentRatingAustralia)
if ($Results.MediaContentRatingAustralia.Count -gt 0)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.MediaContentRatingAustralia -CIMInstanceName MicrosoftGraphmediacontentratingaustralia
if ($complexTypeStringResult)
Expand All @@ -3138,7 +3138,11 @@ function Export-TargetResource
$Results.Remove('MediaContentRatingAustralia') | Out-Null
}
}
if ($Results.MediaContentRatingCanada)
else
{
$Results.Remove('MediaContentRatingAustralia') | Out-Null
}
if ($Results.MediaContentRatingCanada.Count -gt 0)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.MediaContentRatingCanada -CIMInstanceName MicrosoftGraphmediacontentratingcanada
if ($complexTypeStringResult)
Expand All @@ -3150,7 +3154,11 @@ function Export-TargetResource
$Results.Remove('MediaContentRatingCanada') | Out-Null
}
}
if ($Results.MediaContentRatingFrance)
else
{
$Results.Remove('MediaContentRatingCanada') | Out-Null
}
if ($Results.MediaContentRatingFrance.Count -gt 0)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.MediaContentRatingFrance -CIMInstanceName MicrosoftGraphmediacontentratingfrance
if ($complexTypeStringResult)
Expand All @@ -3162,7 +3170,11 @@ function Export-TargetResource
$Results.Remove('MediaContentRatingFrance') | Out-Null
}
}
if ($Results.MediaContentRatingGermany)
else
{
$Results.Remove('MediaContentRatingFrance') | Out-Null
}
if ($Results.MediaContentRatingGermany.Count -gt 0)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.MediaContentRatingGermany -CIMInstanceName MicrosoftGraphmediacontentratinggermany
if ($complexTypeStringResult)
Expand All @@ -3174,7 +3186,11 @@ function Export-TargetResource
$Results.Remove('MediaContentRatingGermany') | Out-Null
}
}
if ($Results.MediaContentRatingIreland)
else
{
$Results.Remove('MediaContentRatingGermany') | Out-Null
}
if ($Results.MediaContentRatingIreland.Count -gt 0)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.MediaContentRatingIreland -CIMInstanceName MicrosoftGraphmediacontentratingireland
if ($complexTypeStringResult)
Expand All @@ -3186,7 +3202,11 @@ function Export-TargetResource
$Results.Remove('MediaContentRatingIreland') | Out-Null
}
}
if ($Results.MediaContentRatingJapan)
else
{
$Results.Remove('MediaContentRatingIreland') | Out-Null
}
if ($Results.MediaContentRatingJapan.Count -gt 0)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.MediaContentRatingJapan -CIMInstanceName MicrosoftGraphmediacontentratingjapan
if ($complexTypeStringResult)
Expand All @@ -3198,7 +3218,11 @@ function Export-TargetResource
$Results.Remove('MediaContentRatingJapan') | Out-Null
}
}
if ($Results.MediaContentRatingNewZealand)
else
{
$Results.Remove('MediaContentRatingJapan') | Out-Null
}
if ($Results.MediaContentRatingNewZealand.Count -gt 0)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.MediaContentRatingNewZealand -CIMInstanceName MicrosoftGraphmediacontentratingnewzealand
if ($complexTypeStringResult)
Expand All @@ -3210,7 +3234,11 @@ function Export-TargetResource
$Results.Remove('MediaContentRatingNewZealand') | Out-Null
}
}
if ($Results.MediaContentRatingUnitedKingdom)
else
{
$Results.Remove('MediaContentRatingNewZealand') | Out-Null
}
if ($Results.MediaContentRatingUnitedKingdom.Count -gt 0)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.MediaContentRatingUnitedKingdom -CIMInstanceName MicrosoftGraphmediacontentratingunitedkingdom
if ($complexTypeStringResult)
Expand All @@ -3222,7 +3250,11 @@ function Export-TargetResource
$Results.Remove('MediaContentRatingUnitedKingdom') | Out-Null
}
}
if ($Results.MediaContentRatingUnitedStates)
else
{
$Results.Remove('MediaContentRatingUnitedKingdom') | Out-Null
}
if ($Results.MediaContentRatingUnitedStates.Count -gt 0)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.MediaContentRatingUnitedStates -CIMInstanceName MicrosoftGraphmediacontentratingunitedstates
if ($complexTypeStringResult)
Expand All @@ -3234,6 +3266,10 @@ function Export-TargetResource
$Results.Remove('MediaContentRatingUnitedStates') | Out-Null
}
}
else
{
$Results.Remove('MediaContentRatingUnitedStates') | Out-Null
}
if ($Results.NetworkUsageRules)
{
$complexTypeStringResult = Get-M365DSCDRGComplexTypeToString -ComplexObject $Results.NetworkUsageRules -CIMInstanceName MicrosoftGraphiosnetworkusagerule
Expand Down

0 comments on commit 36d9534

Please sign in to comment.