terraform-provider-azuread icon indicating copy to clipboard operation
terraform-provider-azuread copied to clipboard

Missing Terraform documentation for azuread_claims_mapping_policy definition ClaimsTransformations #question

Open gubi95 opened this issue 2 years ago • 2 comments

Hi. I have defined resource azuread_claims_mapping_policy like this:

resource "azuread_claims_mapping_policy" "test_app_for_saml_integration_claims_mapping" {
  display_name = "Claims Mapping for ${azuread_application.test_app_for_saml_integration[0].display_name}"
  definition = [
    jsonencode(
      {
        ClaimsMappingPolicy = {
          ClaimsSchema = [
            {
              ID            = "userprincipalname"
              SamlClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
              Source        = "user"
            },
            {
              ID            = "givenname"
              SamlClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname"
              Source        = "user"
            },
            {
              ID            = "surname"
              SamlClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname"
              Source        = "user"
            },
            {
              ID            = "mail"
              SamlClaimType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
              Source        = "user"
            }
          ]
          IncludeBasicClaimSet = "true"
          Version              = 1,
          ClaimsTransformations = [{
            Id = "to-lowercase",
            InputClaims = [{
              ClaimTypeReferenceId     = "userprincipalname"
              ClaimTypeReferenceSource = "user"
              TransformationClaimType  = "sourceClaim"
              TreatAsMultiValue        = false
            }]
            OutputClaims = [
              {
                ClaimTypeReferenceId    = "outputClaimuserprincipalname-ToLowercase"
                TransformationClaimType = "outputClaim"
              },
            ],
            TransformationMethod = "ToLowercase"
          }]
        }
      }
    )
  ]
}

I want to apply ToLowercase transformation on user.userprincipalname claim but when applying TF I got error: image

When I remove ClaimsTransformations array then error disappears.

Question: can anyone share docs where I can find how this JSON structure should look like or fill docs here: https://registry.terraform.io/providers/hashicorp/azuread/latest/docs/resources/claims_mapping_policy ?

Thanks!

gubi95 avatar Oct 13 '23 11:10 gubi95

Hi there, I don't want to hijack this issue, however since topic is pretty close, here my question. Where can I find the Id for the resource in order to do an import of an existing azuread_claims_mapping_policy? Thanks Jonas

jgschwendswica avatar Oct 27 '23 06:10 jgschwendswica

@jgschwendswica You can use Az Powershell, or call Microsoft Graph directly (e.g. https://graph.microsoft.com/v1.0/policies/claimsMappingPolicies). Try the Graph Explorer :)

manicminer avatar Oct 27 '23 12:10 manicminer