Azure / Azure/azure-powershell

Get-AzADGroup -Select groupTypes returns non-standard GroupType property and hides groupTypes

Aperta
#28,362 0 commenti 0 reazioni 1 assegnatario Rivendicata da @isra-fel Vedi su GitHub
Azure PS Team customer-reported Graph.Microsoft potential-pruning question
Lingua principale
C#
Stelle
4.8k
Fork
4.3k
Merge medio
2g 17h
PR unite (30g)
51

Descrizione

### Description

When running:

```powershell
Get-AzADGroup -Select @("id", "displayName", "groupTypes")

The returned object does not expose the groupTypes property (plural), which is the correct property according to the Microsoft Graph API schema.

Instead, a property named GroupType (singular) is returned, which is undocumented and does not exist in Graph.

This is confusing because:

groupTypes is a valid Graph field (e.g., ["Unified"])

GroupType appears to be a synthetic alias or transformation

GroupType cannot be used in -Select because Graph does not recognize it

groupTypes is not accessible after the call because it is hidden or dropped

Expected behavior

The cmdlet should:

Either expose the actual groupTypes property (as per the Graph API)

Or clearly document that groupTypes is mapped to GroupType in PowerShell

Actual behavior

$g = Get-AzADGroup -Select @("id", "displayName", "groupTypes")
$g | Get-Member

Results:

No groupTypes property is visible

A GroupType property (non-standard) is present instead

This causes confusion and inconsistency with Graph documentation

Impact

This behavior causes confusion and breaks expected logic when:

Filtering or grouping by group type

Writing predictable scripts across API layers

Using Graph-native property names

It creates a gap between what is selected via Graph (groupTypes) and what is returned in PowerShell (GroupType) without explanation.

### Issue script & Debug output

```PowerShell
[CmdletBeginProcessing]: Starting command
CmdletBeginProcessing:
CmdletProcessRecordStart:
Client side pagination is enabled for this cmdlet
CmdletGetPipeline:
CmdletBeforeAPICall:
URLCreated: /groups?$select=id%2CdisplayName%2CgroupTypes
RequestCreated: /v1.0/groups?$select=id%2CdisplayName%2CgroupTypes
HeaderParametersAdded:
============================ HTTP REQUEST ============================

HTTP Method:
GET

Absolute Uri:
https://graph.microsoft.com/v1.0/groups?$select=id%2CdisplayName%2CgroupTypes

Headers:
x-ms-client-request-id : f99a3995-2675-4752-8708-ab99fbacd9fb
CommandName : &
FullCommandName : Get-AzADGroup_List
ParameterSetName : __AllParameterSets
User-Agent : AzurePowershell/v0.0.0,PSVersion/v5.1.22621.5624,Az.MSGraph/7.4.0

Body:

BeforeCall:
============================ HTTP RESPONSE ============================

Status Code:
OK

Headers:
Transfer-Encoding : chunked
Strict-Transport-Security : max-age=31536000
request-id : 94af8b58-7538-473c-95f9-968803642670
client-request-id : 94af8b58-7538-473c-95f9-968803642670
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"France Central","Slice":"E","Ring":"5","ScaleUnit":"004","RoleInstance":"PA2PEPF00011C62"}}
x-ms-resource-unit : 1
OData-Version : 4.0
Cache-Control : no-cache
Date : Thu, 07 Aug 2025 19:53:41 GMT

Body:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups(id,displayName,groupTypes)",
"@odata.nextLink": "https://graph.microsoft.com/v1.0/groups?$select=id%2cdisplayName%2cgroupTypes&$skiptoken=RFNwdAIAAQAAACpHcm91cF8wMDQzMjBjNi1jZWZjLTQ1NzAtO
WNhMi0zMTJhZmY0NzhlYzcqR3JvdXBfMDA0MzIwYzYtY2VmYy00NTcwLTljYTItMzEyYWZmNDc4ZWM3AAAAAAAAAAAAAAA",
"value": [
{
"id": "000056ed-36dd-410b-b216-4560ee625f47",
"displayName": "048 MUTBUR1 GED RHPAIE MOD",
"groupTypes": []
},
{
"id": "00017df8-08d5-4c7f-99b8-13662ddc5ccd",
"displayName": "SAINT-DENIS",
"groupTypes": []
}
]
}

ResponseCreated:
BeforeResponseDispatch:

AppRoleAssignment :
Classification :
CreatedDateTime :
CreatedOnBehalfOf : {
}
DeletedDateTime :
Description :
DisplayName : 048 MUTBUR1 GED RHPAIE MOD
ExpirationDateTime :
GroupLifecyclePolicy :
GroupType : {}
HasMembersWithLicenseError :
Id : 000056ed-36dd-410b-b216-4560ee625f47
IsArchived :
IsAssignableToRole :
Mail :
MailEnabled :
MailNickname :
Member :
MemberOf :
MembersWithLicenseError :
MembershipRule :
MembershipRuleProcessingState :
OdataId :
OdataType :
Owner :
PermissionGrant :
PreferredDataLocation :
PreferredLanguage :
ProxyAddress :
RenewedDateTime :
SecurityEnabled :
SecurityIdentifier :
Theme :
Visibility :
AdditionalProperties : {}

Finally:
CmdletAfterAPICall:
[CmdletProcessRecordAsyncEnd]: Finish HTTP process
CmdletProcessRecordAsyncEnd:
CmdletProcessRecordEnd:
AzureQoSEvent: Module: Az.Resources:7.4.0; CommandName: Get-AzADGroup; PSVersion: 5.1.22621.5624; IsSuccess: True; Duration: 00:00:00.7980968;
SanitizeDuration: 00:00:00
```

### Environment data

```PowerShell
Name Value
---- -----
PSVersion 5.1.22621.5624
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22621.5624
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
```

### Module versions

```PowerShell
Name Version
---- -------
Az.SignalR 2.0.2
Az.Sql 5.3.0
Az.SqlVirtualMachine 2.3.1
Az.StackHCI 2.4.0
Az.StackHCIVM 1.0.4
Az.Storage 7.3.0
Az.StorageMover 1.4.0
Az.StorageSync 2.3.1
Az.StreamAnalytics 2.0.1
Az.Support 2.0.0
Az.Synapse 3.0.10
Az.TrafficManager 1.2.2
Az.Websites 3.2.1
Azure 5.1.2
Az.Accounts 3.0.4
Az.Advisor 2.0.1
Az.Aks 6.0.4
Az.AnalysisServices 1.1.5
Az.ApiManagement 4.0.4
Az.App 1.0.1
Az.AppConfiguration 1.3.2
Az.ApplicationInsights 2.2.5
Az.ArcResourceBridge 1.0.1
Az.Attestation 2.0.2
Az.Automanage 1.0.2
Az.Automation 1.10.0
Az.Batch 3.6.3
Az.Billing 2.0.4
Az.Cdn 3.2.2
Az.CloudService 2.0.1
Az.CognitiveServices 1.14.1
Az.Compute 8.3.0
Az.ConfidentialLedger 1.0.1
Az.ContainerInstance 4.0.2
Az.ContainerRegistry 4.2.1
Az.CosmosDB 1.14.5
Az.DataBoxEdge 1.1.1
Az.Databricks 1.9.0
Az.DataFactory 1.18.7
Az.DataLakeAnalytics 1.0.3
Az.DataLakeStore 1.3.2
Az.DataProtection 2.4.0
Az.DataShare 1.0.2
Az.DesktopVirtualization 4.3.1
Az.DevCenter 1.2.0
Az.DevTestLabs 1.0.3
Az.Dns 1.2.1
Az.DnsResolver 1.0.0
Az.ElasticSan 1.0.3
Az.EventGrid 2.0.0
Az.EventHub 5.0.0
Az.FrontDoor 1.11.1
Az.Functions 4.1.0
Az.HDInsight 6.2.0
Az.HealthcareApis 2.0.1
Az.IotHub 2.7.7
Az.KeyVault 6.1.0
Az.Kusto 2.3.1
Az.LoadTesting 1.0.1
Az.LogicApp 1.5.1
Az.MachineLearning 1.1.4
Az.MachineLearningServices 1.1.0
Az.Maintenance 1.4.3
Az.ManagedServiceIdentity 1.2.1
Az.ManagedServices 3.0.1
Az.MarketplaceOrdering 2.0.1
Az.Media 1.1.2
Az.Migrate 2.4.0
Az.Monitor 5.2.1
Az.MySql 1.2.1
Az.Network 7.8.1
Az.NetworkCloud 1.0.2
Az.Nginx 1.1.0
Az.NotificationHubs 1.1.3
Az.OperationalInsights 3.2.1
Az.Oracle 1.0.0
Az.PolicyInsights 1.6.5
Az.PostgreSql 1.1.2
Az.PowerBIEmbedded 2.0.0
Az.PrivateDns 1.0.5
Az.RecoveryServices 7.1.0
Az.RedisCache 1.10.0
Az.RedisEnterpriseCache 1.2.1
Az.Relay 2.0.1
Az.ResourceGraph 1.0.0
Az.ResourceMover 1.2.1
Az.Resources 7.4.0
Az.Security 1.7.0
Az.SecurityInsights 3.1.2
Az.ServiceBus 4.0.0
Az.ServiceFabric 3.3.4
AzureAD 2.0.2.118
AzureStackHCI 1.0.0.0
```

### Error output

```PowerShell
09:56:24 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].
09:56:24 - ResolveError begin processing with ParameterSet 'AnyErrorParameterSet'.
09:56:24 - using account id 'e75e7b8c-f5ce-4305-b384-fa19f6abfa0c'...
09:56:24 - [ConfigManager] Got nothing from [DisplayBreakingChangeWarning], Module = [], Cmdlet = []. Returning default value [True].
09:56:24 - [ConfigManager] Got nothing from [DisplaySecretsWarning], Module = [], Cmdlet = []. Returning default value [True].

HistoryId : 1

Message : Impossible de charger un ou plusieurs des types requis. Extrayez la propriété LoaderExceptions pour plus d'informations.
StackTrace : à System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
à System.Reflection.RuntimeModule.GetTypes()
à System.Reflection.Assembly.GetTypes()
à Microsoft.PowerShell.Commands.AddTypeCommand.LoadAssemblyFromPathOrName(List`1 generatedTypes)
à Microsoft.PowerShell.Commands.AddTypeCommand.EndProcessing()
à System.Management.Automation.CommandProcessorBase.Complete()
Exception : System.Reflection.ReflectionTypeLoadException
InvocationInfo : {Add-Type}
Line : Add-Type -Path $path -ErrorAction Ignore | Out-Null

Position : Au caractère C:\Program Files\WindowsPowerShell\Modules\Az.Accounts\3.0.4\Az.Accounts.psm1:84 : 13
+ Add-Type -Path $path -ErrorAction Ignore | Out-Null
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HistoryId : 1

09:56:24 - [ConfigManager] Got nothing from [DisplayRegionIdentified], Module = [], Cmdlet = []. Returning default value [True].
09:56:24 - [ConfigManager] Got nothing from [CheckForUpgrade], Module = [], Cmdlet = []. Returning default value [True].
AzureQoSEvent: Module: Az.Accounts:3.0.4; CommandName: Resolve-AzError; PSVersion: 5.1.22621.5624; IsSuccess: True; Duration: 00:00:00.0706011;
SanitizeDuration: 00:00:00.0012361
09:56:24 - [ConfigManager] Got nothing from [EnableDataCollection], Module = [], Cmdlet = []. Returning default value [True].
09:56:24 - ResolveError end processing.
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.