Skip to content

Commit

Permalink
Update Odata refrences to Graph.microsoft.com
Browse files Browse the repository at this point in the history
Fixes #5342
  • Loading branch information
mpoulson committed Nov 6, 2024
1 parent 3df0f27 commit 4cc761c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@
AADAuthenticationMethodPolicyExternal, AADEnrichedAuditLogs
FIXES [#5340](https://github.com/microsoft/Microsoft365DSC/issues/5340)
IntuneDeviceManagementEnrollmentAndroidGooglePlay, IntuneAppleMDMPushNotificationCertificate
* Fixes static OData refrences to graph.microsoft.com
AADApplication, AADEntitlementManagementAccessPackage, AADEntitlementManagementConnectedOrganization
AADServicePrincipal
FIXES [#5342] (https://github.com/microsoft/Microsoft365DSC/issues/534)
* DEPENDENCIES
* Updated Microsoft.Graph to version 2.24.0.
* Updated Microsoft.PowerApps.Administration.PowerShell to version 2.0.199.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ function Set-TargetResource
{
$Type = 'directoryObjects'
}
$ObjectUri = 'https://graph.microsoft.com/v1.0/{0}/{1}' -f $Type, $diff.InputObject
$ObjectUri = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + 'v1.0/{0}/{1}' -f $Type, $diff.InputObject
$ownerObject = @{
'@odata.id' = $ObjectUri
}
Expand Down Expand Up @@ -1136,7 +1136,7 @@ function Set-TargetResource
$onPremisesPublishingValue.Add('singleSignOnSettings', $singleSignOnValues)
$onPremisesPayload = ConvertTo-Json $onPremisesPublishingValue -Depth 10 -Compress
Write-Verbose -Message "Updating the OnPremisesPublishing settings for application {$($currentAADApp.DisplayName)} with payload: $onPremisesPayload"

$Uri = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/applications/$($currentAADApp.Id)/onPremisesPublishing"
Invoke-MgGraphRequest -Method 'PATCH' `
-Uri $Uri `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function Set-TargetResource
foreach ($incompatibleAccessPackage in $IncompatibleAccessPackages)
{
$ref = @{
'@odata.id' = "https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackages/$incompatibleAccessPackage"
'@odata.id' = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/identityGovernance/entitlementManagement/accessPackages/$incompatibleAccessPackage"
}

New-MgBetaEntitlementManagementAccessPackageIncompatibleAccessPackageByRef `
Expand All @@ -368,7 +368,7 @@ function Set-TargetResource
foreach ($IncompatibleGroup in $IncompatibleGroups)
{
$ref = @{
'@odata.id' = "https://graph.microsoft.com/beta/groups/$IncompatibleGroup"
'@odata.id' = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/groups/$IncompatibleGroup"
}

New-MgBetaEntitlementManagementAccessPackageIncompatibleGroupByRef `
Expand Down Expand Up @@ -485,7 +485,7 @@ function Set-TargetResource
foreach ($incompatibleAccessPackage in $toBeAdded.InputObject)
{
$ref = @{
'@odata.id' = "https://graph.microsoft.com/beta/identityGovernance/entitlementManagement/accessPackages/$incompatibleAccessPackage"
'@odata.id' = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/identityGovernance/entitlementManagement/accessPackages/$incompatibleAccessPackage"
}

New-MgBetaEntitlementManagementAccessPackageIncompatibleAccessPackageByRef `
Expand Down Expand Up @@ -522,7 +522,7 @@ function Set-TargetResource
{

$ref = @{
'@odata.id' = "https://graph.microsoft.com/beta/groups/$incompatibleGroup"
'@odata.id' = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/groups/$incompatibleGroup"
}

New-MgBetaEntitlementManagementAccessPackageIncompatibleGroupByRef `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ function Set-TargetResource
$directoryObjectType=$directoryObject.AdditionalProperties."@odata.type"
$directoryObjectType=($directoryObject.AdditionalProperties."@odata.type").split(".")|select-object -last 1
$directoryObjectRef=@{
"@odata.id" = "https://graph.microsoft.com/beta/$($directoryObjectType)s/$($sponsor)"
"@odata.id" = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/$($directoryObjectType)s/$($sponsor)"
}

New-MgBetaEntitlementManagementConnectedOrganizationExternalSponsorByRef `
Expand All @@ -459,7 +459,7 @@ function Set-TargetResource
$directoryObject = Get-MgBetaDirectoryObject -DirectoryObjectId $sponsor
$directoryObjectType=($directoryObject.AdditionalProperties."@odata.type").split(".")|select-object -last 1
$directoryObjectRef=@{
"@odata.id" = "https://graph.microsoft.com/beta/$($directoryObjectType)s/$($sponsor)"
"@odata.id" = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/$($directoryObjectType)s/$($sponsor)"
}

New-MgBetaEntitlementManagementConnectedOrganizationInternalSponsorByRef `
Expand Down Expand Up @@ -515,7 +515,7 @@ function Set-TargetResource
$directoryObjectType=$directoryObject.AdditionalProperties."@odata.type"
$directoryObjectType=($directoryObject.AdditionalProperties."@odata.type").split(".")|select-object -last 1
$directoryObjectRef=@{
"@odata.id" = "https://graph.microsoft.com/beta/$($directoryObjectType)s/$($sponsor)"
"@odata.id" = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/$($directoryObjectType)s/$($sponsor)"
}

New-MgBetaEntitlementManagementConnectedOrganizationExternalSponsorByRef `
Expand Down Expand Up @@ -553,7 +553,7 @@ function Set-TargetResource
$directoryObjectType=$directoryObject.AdditionalProperties."@odata.type"
$directoryObjectType=($directoryObject.AdditionalProperties."@odata.type").split(".")|select-object -last 1
$directoryObjectRef=@{
"@odata.id" = "https://graph.microsoft.com/beta/$($directoryObjectType)s/$($sponsor)"
"@odata.id" = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "beta/$($directoryObjectType)s/$($sponsor)"
}

New-MgBetaEntitlementManagementConnectedOrganizationInternalSponsorByRef `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ function Set-TargetResource
{
$userInfo = Get-MgUser -UserId $owner
$body = @{
'@odata.id' = "https://graph.microsoft.com/v1.0/directoryObjects/$($userInfo.Id)"
'@odata.id' = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "v1.0/directoryObjects/$($userInfo.Id)"
}
Write-Verbose -Message "Adding new owner {$owner}"
$newOwner = New-MgServicePrincipalOwnerByRef -ServicePrincipalId $newSP.Id -BodyParameter $body
Expand Down Expand Up @@ -701,7 +701,7 @@ function Set-TargetResource
if ($diff.SideIndicator -eq '=>')
{
$body = @{
'@odata.id' = "https://graph.microsoft.com/v1.0/directoryObjects/$($userInfo.Id)"
'@odata.id' = $Global:MSCloudLoginConnectionProfile.MicrosoftGraph.ResourceUrl + "v1.0/directoryObjects/$($userInfo.Id)"
}
Write-Verbose -Message "Adding owner {$($userInfo.Id)}"
New-MgServicePrincipalOwnerByRef -ServicePrincipalId $currentAADServicePrincipal.ObjectId `
Expand Down

0 comments on commit 4cc761c

Please sign in to comment.