Closed
Description
Describe the bug
I am trying to unfederate a domain / set the domain to "Managed".
Usually, I do this by running the command
Update-MgDomain -DomainId $domain -AuthenticationType "Managed
But this seems to fail. This worked on 2.25, 2.26.0 (I think? I am not sure), but fails on 2.26.1.
Expected behavior
I am able to run the following command successfully.
Update-MgDomain -DomainId $domain -AuthenticationType "Managed
How to reproduce
Run
Update-MgDomain -DomainId $domain -AuthenticationType "Managed
Where $domain
is the domain you are trying to set to managed authentication.
SDK Version
2.26.1
Latest version known to work for scenario above?
2.25
Known Workarounds
No workarounds at this moment.
Debug output
PS C:\Windows\System32> # Convert Domain to Managed Authentication
Update-MgDomain -DomainId $domain -AuthenticationType "Managed" -Debug
DEBUG: [CmdletBeginProcessing]: - Update-MgDomain begin processing with parameterSet 'UpdateExpanded'.
DEBUG: [Authentication]: - AuthType: 'Delegated', TokenCredentialType: 'InteractiveBrowser', ContextScope: 'CurrentUser', AppName: 'Microsoft Graph Command Line Tools'.
DEBUG: [Authentication]: - Scopes: [DeviceManagementConfiguration.ReadWrite.All, Directory.AccessAsUser.All, Directory.ReadWrite.All, Domain.ReadWrite.All, email, Group.ReadWrite.All, openid,
Organization.Read.All, Policy.ReadWrite.DeviceConfiguration, profile, User.Read, User.Read.All, User.ReadWrite.All].
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
PATCH
Absolute Uri:
https://graph.microsoft.com/v1.0/domains/byndidharry.net
Headers:
FeatureFlag : 00000003
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.26100; en-US),PowerShell/5.1.26100.2161
SdkVersion : graph-powershell/2.26.1
client-request-id : 4b8094d2-3873-4f0c-8729-2113a886a125
Body:
{
"authenticationType": "Managed"
}
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
BadRequest
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 1f85ec84-a787-4e40-9d20-a91d06af7e0c
client-request-id : 4b8094d2-3873-4f0c-8729-2113a886a125
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada Central","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"YT2PEPF000001A6"}}
x-ms-resource-unit : 1
Cache-Control : no-cache
Date : Wed, 26 Feb 2025 15:54:34 GMT
Body:
{
"error": {
"code": "Request_BadRequest",
"message": "The read criteria match more than one object.",
"innerError": {
"date": "2025-02-26T15:54:34",
"request-id": "1f85ec84-a787-4e40-9d20-a91d06af7e0c",
"client-request-id": "4b8094d2-3873-4f0c-8729-2113a886a125"
}
}
}
Update-MgDomain : The read criteria match more than one object.
Status: 400 (BadRequest)
ErrorCode: Request_BadRequest
Date: 2025-02-26T15:54:34
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 1f85ec84-a787-4e40-9d20-a91d06af7e0c
client-request-id : 4b8094d2-3873-4f0c-8729-2113a886a125
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"Canada Central","Slice":"E","Ring":"3","ScaleUnit":"002","RoleInstance":"YT2PEPF000001A6"}}
x-ms-resource-unit : 1
Cache-Control : no-cache
Date : Wed, 26 Feb 2025 15:54:34 GMT
At line:2 char:1
+ Update-MgDomain -DomainId $domain -AuthenticationType "Managed" -Debu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: ({ DomainId = by...ftGraphDomain }:<>f__AnonymousType83`3) [Update-MgDomain_UpdateExpanded], Exception
+ FullyQualifiedErrorId : Request_BadRequest,Microsoft.Graph.PowerShell.Cmdlets.UpdateMgDomain_UpdateExpanded
DEBUG: [CmdletEndProcessing]: - Update-MgDomain end processing.
Configuration
Windows Powershell
Other information
No response