msgraph-sdk-powershell
msgraph-sdk-powershell copied to clipboard
Microsoft Graph PowerShell Module Administrative Unit endpoint is misconfigured
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_
Same as #2529?
Hi @benhaspalace ,
Can you please try to reproduce in Graph Explorer and also share the error message you are getting?
Looking at the API description linked from the cmdlet, the URL does contain the /directory path, https://learn.microsoft.com/en-us/graph/api/administrativeunit-update?view=graph-rest-beta&tabs=http
Thanks!
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.