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

Support for managing claims mapping policies (azuread_claims_mapping_policy, azuread_claims_mapping_policy_assignment) #644

Closed
tiwood opened this issue Oct 25, 2021 · 2 comments · Fixed by #766

Comments

@tiwood
Copy link
Contributor

tiwood commented Oct 25, 2021

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

Description

We want to manage claim mappings within our Terraform configuration.

New or Affected Resource(s)

  • azuread_claims_mapping_policy
  • azuread_claims_mapping_policy_assignment

Potential Terraform Configuration

#// ref: https://docs.microsoft.com/en-us/graph/api/resources/claimsmappingpolicy?view=graph-rest-1.0
resource "azuread_claims_mapping_policy" "app" {
  version                 = 1
  display_name            = "foobar"
  include_basic_claim_set = true

  #// this can be repeated n times
  claim_mapping {
    source          = "user"            #// one of 'user', 'group'
    id              = "JobTitle"        #// conflicts with extension_id 
    extension_id    = "extension999999" #// conflicts with id
    saml_claim_type = "hisCoolJobTitle"
    jwt_claim_type  = "hisCoolJobTitle"
  }
}

#//ref: https://docs.microsoft.com/en-us/graph/api/serviceprincipal-post-claimsmappingpolicies?view=graph-rest-1.0&tabs=http
resource "azuread_claims_mapping_policy_assignment" "app" {
  service_princiapl_id     = azuread_service_principal.example.id
  claims_mapping_policy_id = azuread_claims_mapping_policy.app.id
}

References

https://docs.microsoft.com/en-us/graph/api/resources/claimsmappingpolicy?view=graph-rest-1.0
https://docs.microsoft.com/en-us/graph/api/resources/claimsmappingpolicy?view=graph-rest-1.0#properties-of-a-claims-mapping-policy-definition

@tiwood tiwood changed the title Support for managing service principal claims (aka claimsMappingPolicy) Support for managing claims mapping policies (azuread_claims_mapping_policy Oct 25, 2021
@tiwood tiwood changed the title Support for managing claims mapping policies (azuread_claims_mapping_policy Support for managing claims mapping policies (azuread_claims_mapping_policy) Oct 25, 2021
@tiwood tiwood changed the title Support for managing claims mapping policies (azuread_claims_mapping_policy) Support for managing claims mapping policies (azuread_claims_mapping_policy, azuread_claims_mapping_policy_assignment) Oct 25, 2021
@webframp
Copy link

webframp commented Feb 4, 2022

Our team internally has started some work to add this support since we have a need for it. Based on early work in the hamilton sdk we currently have an alpha quality functional resource that works like this to create a claims mapping policy:

resource "azuread_claims_mapping_policy" "test" {
  definition = [
    jsonencode(
      {
        ClaimsMappingPolicy = {
          ClaimsSchema = [
            {
              ID            = "employeeid"
              JwtClaimType  = "name"
              SamlClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
              Source        = "user"
            },
            {
              ID            = "tenantcountry"
              JwtClaimType  = "country"
              SamlClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country"
              Source        = "company"
            }
          ]
          IncludeBasicClaimSet = "true"
          Version              = 1
        }
      }
    ),
  ]
  description  = "hcl-created-policy"
  display_name = "hcl-create-policy"
}

Plan output is still a bit funny as it shows a diff every single time for the entire definition block, this is something we'll still need to improve before it's really ready but we'll be testing it as well as adding policy assignment support for service principals.

computeracer added a commit to o11n/terraform-provider-azuread that referenced this issue Feb 8, 2022
Adds support for the claims mapping policy resource so these can be
managed with Terraform.

Related to:
- manicminer/hamilton#147
- hashicorp#644
- https://docs.microsoft.com/en-us/graph/api/resources/claimsmappingpolicy?view=graph-rest-1.0
computeracer added a commit to o11n/terraform-provider-azuread that referenced this issue Feb 8, 2022
Adds support for the claims mapping policy assignment resource so
claims mapping policies can be assigned to a service principle
with Terraform.

Related to:
- manicminer/hamilton#147
- hashicorp#644
- https://docs.microsoft.com/en-us/graph/api/serviceprincipal-post-claimsmappingpolicies?view=graph-rest-1.0&tabs=http
dhohengassner pushed a commit to o11n/terraform-provider-azuread that referenced this issue Feb 23, 2022
Adds support for the claims mapping policy resource so these can be
managed with Terraform.

Related to:
- manicminer/hamilton#147
- hashicorp#644
- https://docs.microsoft.com/en-us/graph/api/resources/claimsmappingpolicy?view=graph-rest-1.0
dhohengassner pushed a commit to o11n/terraform-provider-azuread that referenced this issue Feb 23, 2022
Adds support for the claims mapping policy assignment resource so
claims mapping policies can be assigned to a service principle
with Terraform.

Related to:
- manicminer/hamilton#147
- hashicorp#644
- https://docs.microsoft.com/en-us/graph/api/serviceprincipal-post-claimsmappingpolicies?view=graph-rest-1.0&tabs=http
dhohengassner pushed a commit to o11n/terraform-provider-azuread that referenced this issue Feb 23, 2022
Adds support for the claims mapping policy assignment resource so
claims mapping policies can be assigned to a service principle
with Terraform.

Related to:
- manicminer/hamilton#147
- hashicorp#644
- https://docs.microsoft.com/en-us/graph/api/serviceprincipal-post-claimsmappingpolicies?view=graph-rest-1.0&tabs=http
@manicminer manicminer linked a pull request Mar 9, 2022 that will close this issue
computeracer added a commit to o11n/terraform-provider-azuread that referenced this issue Mar 11, 2022
Adds support for the claims mapping policy resource so these can be
managed with Terraform.

Related to:
- manicminer/hamilton#147
- hashicorp#644
- https://docs.microsoft.com/en-us/graph/api/resources/claimsmappingpolicy?view=graph-rest-1.0
computeracer added a commit to o11n/terraform-provider-azuread that referenced this issue Mar 11, 2022
Adds support for the claims mapping policy assignment resource so
claims mapping policies can be assigned to a service principle
with Terraform.

Related to:
- manicminer/hamilton#147
- hashicorp#644
- https://docs.microsoft.com/en-us/graph/api/serviceprincipal-post-claimsmappingpolicies?view=graph-rest-1.0&tabs=http
computeracer added a commit to o11n/terraform-provider-azuread that referenced this issue Mar 17, 2022
Adds support for the claims mapping policy assignment resource so
claims mapping policies can be assigned to a service principle
with Terraform.

Related to:
- manicminer/hamilton#147
- hashicorp#644
- https://docs.microsoft.com/en-us/graph/api/serviceprincipal-post-claimsmappingpolicies?view=graph-rest-1.0&tabs=http
computeracer added a commit to o11n/terraform-provider-azuread that referenced this issue Mar 17, 2022
Adds support for the claims mapping policy assignment resource so
claims mapping policies can be assigned to a service principle
with Terraform.

Related to:
- manicminer/hamilton#147
- hashicorp#644
- https://docs.microsoft.com/en-us/graph/api/serviceprincipal-post-claimsmappingpolicies?view=graph-rest-1.0&tabs=http
@manicminer manicminer linked a pull request Apr 7, 2022 that will close this issue
manicminer pushed a commit that referenced this issue Apr 8, 2022
Adds support for the claims mapping policy resource so these can be
managed with Terraform.

Related to:
- manicminer/hamilton#147
- #644
- https://docs.microsoft.com/en-us/graph/api/resources/claimsmappingpolicy?view=graph-rest-1.0
manicminer pushed a commit that referenced this issue Apr 8, 2022
Adds support for the claims mapping policy assignment resource so
claims mapping policies can be assigned to a service principle
with Terraform.

Related to:
- manicminer/hamilton#147
- #644
- https://docs.microsoft.com/en-us/graph/api/serviceprincipal-post-claimsmappingpolicies?view=graph-rest-1.0&tabs=http
@github-actions
Copy link

github-actions bot commented May 8, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants