Skip to content

Get-MgBetaIdentityConditionalAccessPolicy does not return ExcludeGuestsOrExternalUsers "members" #3011

@jonwbstr

Description

@jonwbstr

Describe the bug

I want to create a conditional access policy that excludes a specific service provider, to generate the required JSON body I created the policy in the user interface and fetched the policy via Get-MgBetaIdentityConditionalAccessPolicy. However, the Microsoft.Graph.Beta.PowerShell.Models.MicrosoftGraphConditionalAccessPolicy does not contain the "members" property and values. I was able to find the body I need by using the -debug parameter. I suspect this issue affects include and exclude for more than just serviceproviders but have not confirmed that.

"excludeGuestsOrExternalUsers": {
        "guestOrExternalUserTypes": "serviceProvider",
        "externalTenants": {
          "@odata.type": "#microsoft.graph.conditionalAccessEnumeratedExternalTenants",
          "membershipKind": "enumerated",
          "members": [
            "xxxxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxxx"
          ]
        }
      }

Expected behavior

The Microsoft.Graph.Beta.PowerShell.Models.MicrosoftGraphConditionalAccessPolicy object should contain the excluded members.

How to reproduce

  1. Using the entra ID portal, create a conditional access policy with an excluded service provider
  2. Run the command $p = Get-MgBetaIdentityConditionalAccessPolicy -id
  3. Look for the tenantID that was excluded and you will see that it is not present. It should be at:
    $p.conditions.users.ExcludeGuestsOrExternalUsers

SDK Version

2.24.0

Latest version known to work for scenario above?

No response

Known Workarounds

None

Debug output

Click to expand log ```
</details>


### Configuration

Name                           Value
----                           -----
PSVersion                      7.4.3
PSEdition                      Core
GitCommitId                    7.4.3
OS                             Microsoft Windows 10.0.14393
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

### Other information
No other information

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions