Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azuread_conditional_access_policy resource with external_tenants is not accepted by Graph API #1555

Open
sdx-jkataja opened this issue Oct 30, 2024 · 0 comments

Comments

@sdx-jkataja
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritise this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritise the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureAD Provider) Version

Terraform version: 1.9.5

Terraform Azure AD provider version 3.0.2

Affected Resource(s)

  • azuread_conditional_access_policy

Terraform Configuration Files

My intention is to create a Conditional Access Policy that excludes an external tenant

resource "azuread_conditional_access_policy" "example" {
..
  conditions {
..
    users {
 ..
     excluded_guests_or_external_users {
        guest_or_external_user_types = ["serviceProvider"]
        external_tenants {
          membership_kind = "enumerated"
          members = ["aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"]
        }
      }
    }
  }
}

Debug Output

Part of request body which Terraform AzureAD sends to Microsoft Graph API

{
  "@odata.type": "#microsoft.graph.conditionalAccessPolicy",
...
    "users": {
      "excludeGuestsOrExternalUsers": {
        "externalTenants": {
          "members": [
            "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
          ],
          "membershipKind": "enumerated"
        },
        "guestOrExternalUserTypes": "serviceProvider"
      },
...

Response body which Terraform AzureAD receives from Microsoft Graph API

{
  "error": {
    "code": "BadRequest",
    "message": "1007: Incoming ConditionalAccessPolicy object is null or does not match the schema of ConditionalAccessPolicy type. For examples, please see API documentation at https://docs.microsoft.com/en-us/graph/api/conditionalaccessroot-post-policies?view=graph-rest-1.0.",
    "innerError": {
      "date": "2024-10-29T16:10:00",
      "request-id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
      "client-request-id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
    }
  }
}

Panic Output

Expected Behavior

Conditional Access Policy is created

Actual Behavior

Conditional Access Policy results in Microsoft Graph API returning HTTP 400 Bad Request

Steps to Reproduce

  1. terraform apply

Important Factoids

References

@sdx-jkataja sdx-jkataja changed the title azuread_conditional_access_policy resource with external_tenants results in 400 Bad Request from Graph API azuread_conditional_access_policy resource with external_tenants is not accepted by Graph API Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant