Skip to content

Commit

Permalink
Merge branch 'Dev' into AAD_AppSecretSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
ykuijs authored Nov 22, 2024
2 parents edc9625 + 3be30c2 commit 2be84c3
Show file tree
Hide file tree
Showing 20 changed files with 236 additions and 89 deletions.
20 changes: 20 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,23 @@
- Fixes #123
- Fixes #124
-->

#### Task list

<!--
To aid community reviewers in reviewing and merging your PR, please take the time to run
through the below checklist and make sure your PR has everything updated as required.
Change to [x] for each task in the task list that applies to your PR. For those task that
don't apply to you PR, leave those as is.
-->

- [ ] Added an entry to the change log under the Unreleased section of the file CHANGELOG.md.
Entry should say what was changed and how that affects users (if applicable), and
reference the issue being resolved (if applicable).
- [ ] Resource parameter descriptions added/updated in the schema.mof.
- [ ] Resource documentation added/updated in README.md.
- [ ] Resource settings.json file contains all required permissions.
- [ ] Examples appropriately added/updated.
- [ ] Unit tests added/updated.
- [ ] New/changed code adheres to [DSC Community Style Guidelines](https://dsccommunity.org/styleguidelines).
19 changes: 16 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

# UNRELEASED

* AAD - Added ApplicationSecret auth method to multiple resources
* PR #5409
* AAD
* Added ApplicationSecret auth method to multiple resources
* MISC
* Removed hardcoded Graph urls and replaced by MSCloudLoginAssistant values.

# 1.24.1120.1

* AADAdminConsentRequestPolicy
* Added error handling to Group display name retrieval to prevent errors
when an assigned group no longer exists.
Expand Down Expand Up @@ -75,6 +80,8 @@
* Initial release.
* SCPolicyConfig
* Fixed an issue extracting empty groups properties.
* TeamsMeetingPolicy
* FIXES #5442(https://github.com/microsoft/Microsoft365DSC/issues/5442)
* TeamsUpdateManagementPolicy
* Added conversion of the UpdateTimeOfDay parameter to the local culture format
so that the comparison will work consistently.
Expand Down Expand Up @@ -106,7 +113,13 @@
* IntuneAntivirusPolicyWindows10SettingCatalog
* Update properties to be upper-case.
Fixes [#5373](https://github.com/microsoft/Microsoft365DSC/issues/5373)
* IntuneSecurityBaselineMicrosoftEdge
* IntuneDeviceConfigurationCustomPolicyWindows10
* Fixed issue where `Value`, from `OmaSettings`, could not be compared
correctly if it was boolean and set to `$False`
FIXES [#5384](https://github.com/microsoft/Microsoft365DSC/issues/5384)
* IntuneEndpointDetectionAndResponsePolicyWindows10
* Remove changed property name from export.
FIXES [#5300](https://github.com/microsoft/Microsoft365DSC/issues/5300)* IntuneSecurityBaselineMicrosoftEdge
* Deprecate property `authschemes` and replace with `AuthSchemes_AuthSchemes`
* M365DSCDRGUtil
* Restrict CIM instance access to properties that appear multiple times.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ function Set-TargetResource
{
Write-Verbose -Message "Adding new owner {$($diff.InputObject)} to AAD Group {$($currentGroup.DisplayName)}"
$ownerObject = @{
'@odata.id' = "https://graph.microsoft.com/v1.0/directoryObjects/{$($directoryObject.Id)}"
'@odata.id' = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "v1.0/directoryObjects/{$($directoryObject.Id)}"
}
try
{
Expand Down Expand Up @@ -751,15 +751,15 @@ function Set-TargetResource
{
Write-Verbose -Message "Adding new member {$($diff.InputObject)} to AAD Group {$($currentGroup.DisplayName)}"
$memberObject = @{
'@odata.id' = "https://graph.microsoft.com/v1.0/directoryObjects/{$($directoryObject.Id)}"
'@odata.id' = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "v1.0/directoryObjects/{$($directoryObject.Id)}"
}
New-MgGroupMemberByRef -GroupId ($currentGroup.Id) -BodyParameter $memberObject | Out-Null
}
elseif ($diff.SideIndicator -eq '<=')
{
Write-Verbose -Message "Removing new member {$($diff.InputObject)} to AAD Group {$($currentGroup.DisplayName)}"
$memberObject = @{
'@odata.id' = "https://graph.microsoft.com/v1.0/directoryObjects/{$($directoryObject.Id)}"
'@odata.id' = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "v1.0/directoryObjects/{$($directoryObject.Id)}"
}
Remove-MgGroupMemberDirectoryObjectByRef -GroupId ($currentGroup.Id) -DirectoryObjectId ($directoryObject.Id) | Out-Null
}
Expand Down Expand Up @@ -809,7 +809,7 @@ function Set-TargetResource
{
Write-Verbose -Message "Adding AAD group {$($groupAsMember.DisplayName)} as member of AAD group {$($currentGroup.DisplayName)}"
$groupAsMemberObject = @{
"@odata.id"= "https://graph.microsoft.com/v1.0/directoryObjects/$($groupAsMember.Id)"
"@odata.id"= $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "v1.0/directoryObjects/$($groupAsMember.Id)"
}
New-MgBetaGroupMemberByRef -GroupId ($currentGroup.Id) -Body $groupAsMemberObject | Out-Null
}
Expand Down Expand Up @@ -863,9 +863,6 @@ function Set-TargetResource
if ($memberOfgroup.psobject.Typenames -match 'Group')
{
Write-Verbose -Message "Adding AAD group {$($currentGroup.DisplayName)} as member of AAD group {$($memberOfGroup.DisplayName)}"
#$memberOfObject = @{
# "@odata.id"= "https://graph.microsoft.com/v1.0/groups/{$($group.Id)}"
#}
New-MgGroupMember -GroupId ($memberOfGroup.Id) -DirectoryObject ($currentGroup.Id) | Out-Null
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function Set-TargetResource
foreach ($provider in $IdentityProviders)
{
$params = @{
"@odata.id" = "https://graph.microsoft.com/beta/identityProviders/$($provider)"
"@odata.id" = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "beta/identityProviders/$($provider)"
}

Write-Verbose -Message "Adding the Identity Provider with Id {$provider} to the newly created Azure AD Identity B2X User Flow with Id {$($newObj.Id)}"
Expand Down Expand Up @@ -318,7 +318,7 @@ function Set-TargetResource
{
$getConnector = Get-MgBetaIdentityApiConnector -Filter "DisplayName eq '$($ApiConnectorConfiguration.postFederationSignupConnectorName)'"
$params = @{
"@odata.id" = "https://graph.microsoft.com/beta/identity/apiConnectors/$($getConnector.Id)"
"@odata.id" = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "beta/identity/apiConnectors/$($getConnector.Id)"
}

Write-Verbose -Message "Updating the Post Federation Signup connector for Azure AD Identity B2X User Flow with Id {$($currentInstance.Id)}"
Expand All @@ -330,7 +330,7 @@ function Set-TargetResource
{
$getConnector = Get-MgBetaIdentityApiConnector -Filter "DisplayName eq '$($ApiConnectorConfiguration.postAttributeCollectionConnectorName)'"
$params = @{
"@odata.id" = "https://graph.microsoft.com/beta/identity/apiConnectors/$($getConnector.Id)"
"@odata.id" = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "beta/identity/apiConnectors/$($getConnector.Id)"
}

Write-Verbose -Message "Updating the Post Attribute Collection connector for Azure AD Identity B2X User Flow with Id {$($currentInstance.Id)}"
Expand All @@ -344,7 +344,7 @@ function Set-TargetResource
foreach ($provider in $providersToAdd)
{
$params = @{
"@odata.id" = "https://graph.microsoft.com/beta/identityProviders/$($provider)"
"@odata.id" = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "beta/identityProviders/$($provider)"
}

Write-Verbose -Message "Adding the Identity Provider with Id {$provider} to the Azure AD Identity B2X User Flow with Id {$($currentInstance.Id)}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,15 @@ function Set-TargetResource
"@context" = '#$delta'
value = @(@{})
}
Invoke-MgGraphRequest -Uri https://graph.microsoft.com/beta/networkAccess/connectivity/remoteNetworks/$($currentInstance.Id)/forwardingProfiles -Method Patch -Body $params
Invoke-MgGraphRequest -Uri "$($Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl)beta/networkAccess/connectivity/remoteNetworks/$($currentInstance.Id)/forwardingProfiles" -Method Patch -Body $params

#adding forwarding profiles if required
if ($forwardingProfilesList.Count -gt 0) {
$params = @{
"@context" = '#$delta'
value = $forwardingProfilesList
}
Invoke-MgGraphRequest -Uri https://graph.microsoft.com/beta/networkAccess/connectivity/remoteNetworks/$($currentInstance.Id)/forwardingProfiles -Method Patch -Body $params
Invoke-MgGraphRequest -Uri "$($Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl)beta/networkAccess/connectivity/remoteNetworks/$($currentInstance.Id)/forwardingProfiles" -Method Patch -Body $params
}
}
elseif ($Ensure -eq 'Absent' -and $currentInstance.Ensure -eq 'Present')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,15 +423,15 @@ function Set-TargetResource
{
$value = $presentationValue.clone()
$value = Rename-M365DSCCimInstanceParameter -Properties $value -KeyMapping $keyToRename
$value.add('[email protected]', "https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')/presentations('$($presentationValue.presentationDefinitionId)')")
$value.add('[email protected]', $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')/presentations('$($presentationValue.presentationDefinitionId)')")
$value.remove('PresentationDefinitionId')
$value.remove('PresentationDefinitionLabel')
$value.remove('id')
$complexPresentationValues += $value
}
}
$complexDefinitionValue = @{
'[email protected]' = "https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')"
'[email protected]' = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')"
enabled = $definitionValue.Enabled
presentationValues = $complexPresentationValues
}
Expand Down Expand Up @@ -519,15 +519,15 @@ function Set-TargetResource
{
$value = $presentationValue.clone()
$value = Rename-M365DSCCimInstanceParameter -Properties $value -KeyMapping $keyToRename
$value.add('[email protected]', "https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')/presentations('$($presentationValue.presentationDefinitionId)')")
$value.add('[email protected]', "$($Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl)beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')/presentations('$($presentationValue.presentationDefinitionId)')")
$value.remove('PresentationDefinitionId')
$value.remove('PresentationDefinitionLabel')
$value.remove('id')
$complexPresentationValues += $value
}
}
$complexDefinitionValue = @{
'[email protected]' = "https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')"
'[email protected]' = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')"
enabled = $definitionValue.Enabled
presentationValues = $complexPresentationValues
}
Expand All @@ -553,7 +553,7 @@ function Set-TargetResource
$currentPresentationValue = $currentDefinitionValue.PresentationValues | Where-Object { $_.PresentationDefinitionId -eq $presentationValue.presentationDefinitionId }
$value = $presentationValue.clone()
$value = Rename-M365DSCCimInstanceParameter -Properties $value -KeyMapping $keyToRename
$value.add('[email protected]', "https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')/presentations('$($presentationValue.presentationDefinitionId)')")
$value.add('[email protected]', "$($Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl)beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')/presentations('$($presentationValue.presentationDefinitionId)')")
$value.remove('PresentationDefinitionId')
$value.remove('PresentationDefinitionLabel')
$value.remove('id')
Expand All @@ -563,7 +563,7 @@ function Set-TargetResource
}
$complexDefinitionValue = @{
id = $currentDefinitionValue.Id
'[email protected]' = "https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')"
'[email protected]' = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "beta/deviceManagement/groupPolicyDefinitions('$($definitionValue.Definition.Id)')"
enabled = $definitionValue.Enabled
presentationValues = $complexPresentationValues
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function Get-TargetResource
AccessTokens = $AccessTokens
#endregion
}

$assignmentsValues = Get-MgBetaDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId $Id
$assignmentResult = @()
if ($assignmentsValues.Count -gt 0)
Expand Down Expand Up @@ -521,7 +521,7 @@ function Set-TargetResource
}

#region resource generator code
$CreateParameters.Add("[email protected]", "https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations('$RootCertificateId')")
$CreateParameters.Add("[email protected]", "$($Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl)beta/deviceManagement/deviceConfigurations('$RootCertificateId')")
$CreateParameters.Add("@odata.type", "#microsoft.graph.windows81SCEPCertificateProfile")
$policy = New-MgBetaDeviceManagementDeviceConfiguration -BodyParameter $CreateParameters
$assignmentsHash = ConvertTo-IntunePolicyAssignment -IncludeDeviceFilter:$true -Assignments $Assignments
Expand Down Expand Up @@ -1030,10 +1030,10 @@ function Update-DeviceConfigurationPolicyRootCertificateId
[System.String]
$RootCertificateId
)

$Uri = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/deviceManagement/deviceConfigurations('$DeviceConfigurationPolicyId')/microsoft.graph.windows81SCEPCertificateProfile/rootCertificate/`$ref"
$ref = @{
'@odata.id' = "https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations('$RootCertificateId')"
'@odata.id' = $Global:MSCloudLoginAssistant.MicrosoftGraph.ResourceUrl + "beta/deviceManagement/deviceConfigurations('$RootCertificateId')"
}

Invoke-MgGraphRequest -Method PUT -Uri $Uri -Body ($ref|ConvertTo-Json) -ErrorAction Stop
Expand Down
Loading

0 comments on commit 2be84c3

Please sign in to comment.