Skip to content

Microsoft Graph PowerShell Module Administrative Unit endpoint is misconfigured #2717

@benhaspalace

Description

@benhaspalace

Describe the bug

The Azure Portal web GUI uses the https://graph.microsoft.com/beta/administrativeUnits/ endpoint to manage the Administrative Units, but the 2.18.0 version Microsoft Graph Beta PowerShell module uses the https://graph.microsoft.com/beta/directory/administrativeUnits/ endpoint. With the added "/directory" the requests result in an InternalServerError with "The OData path is invalid." e.g. when Dynamic Group membership is set.

Expected behavior

Status: 204

How to reproduce

$NewParams = @{
DisplayName = " TEST Administrative unit"
Description = "Test Administrative unit Description"
}

$newAdminUnit = New-MgBetaDirectoryAdministrativeUnit -BodyParameter $NewParams -Debug

$UpdateParams = @{
# Assigned or Dynamic
MembershipType = "Dynamic"
# null or Edm.String
MembershipRule = '(user.companyName -eq "TEST Company 01")'
# Paused or On
MembershipRuleProcessingState = "On"
}

$updatedAdminUnit = Update-MgBetaDirectoryAdministrativeUnit -AdministrativeUnitId $newAdminUnit.Id -BodyParameter $UpdateParams -Debug

SDK Version

2.18.0

Latest version known to work for scenario above?

No response

Known Workarounds

$URI = "https://graph.microsoft.com/beta/administrativeUnits/$($newAdminUnit.Id)"
Invoke-MgRestMethod -Method PATCH -Uri $URI -Body $UpdateParams

Debug output

Click to expand log ```
</details>


### Configuration

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Windows 11 x64

### Other information

_No response_

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions