AzureAD

Pulumi Official
Package maintained by Pulumi
v5.27.0 published on Wednesday, Aug 17, 2022 by Pulumi

ClaimsMappingPolicy

Manages a Claims Mapping Policy within Azure Active Directory.

API Permissions

The following API permissions are required in order to use this resource.

When authenticated with a service principal, this resource requires the following application roles: Policy.ReadWrite.ApplicationConfiguration and Policy.Read.All

When authenticated with a user principal, this resource requires one of the following directory roles: Application Administrator or Global Administrator

Example Usage

using System.Collections.Generic;
using System.Text.Json;
using Pulumi;
using AzureAD = Pulumi.AzureAD;

return await Deployment.RunAsync(() => 
{
    var myPolicy = new AzureAD.ClaimsMappingPolicy("myPolicy", new()
    {
        Definitions = new[]
        {
            JsonSerializer.Serialize(new Dictionary<string, object?>
            {
                ["ClaimsMappingPolicy"] = new Dictionary<string, object?>
                {
                    ["ClaimsSchema"] = new[]
                    {
                        new Dictionary<string, object?>
                        {
                            ["ID"] = "employeeid",
                            ["JwtClaimType"] = "name",
                            ["SamlClaimType"] = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
                            ["Source"] = "user",
                        },
                        new Dictionary<string, object?>
                        {
                            ["ID"] = "tenantcountry",
                            ["JwtClaimType"] = "country",
                            ["SamlClaimType"] = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country",
                            ["Source"] = "company",
                        },
                    },
                    ["IncludeBasicClaimSet"] = "true",
                    ["Version"] = 1,
                },
            }),
        },
        DisplayName = "My Policy",
    });

});
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-azuread/sdk/v5/go/azuread"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"ClaimsMappingPolicy": map[string]interface{}{
				"ClaimsSchema": []map[string]interface{}{
					map[string]interface{}{
						"ID":            "employeeid",
						"JwtClaimType":  "name",
						"SamlClaimType": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
						"Source":        "user",
					},
					map[string]interface{}{
						"ID":            "tenantcountry",
						"JwtClaimType":  "country",
						"SamlClaimType": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country",
						"Source":        "company",
					},
				},
				"IncludeBasicClaimSet": "true",
				"Version":              1,
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = azuread.NewClaimsMappingPolicy(ctx, "myPolicy", &azuread.ClaimsMappingPolicyArgs{
			Definitions: pulumi.StringArray{
				pulumi.String(json0),
			},
			DisplayName: pulumi.String("My Policy"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azuread.ClaimsMappingPolicy;
import com.pulumi.azuread.ClaimsMappingPolicyArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var myPolicy = new ClaimsMappingPolicy("myPolicy", ClaimsMappingPolicyArgs.builder()        
            .definitions(serializeJson(
                jsonObject(
                    jsonProperty("ClaimsMappingPolicy", jsonObject(
                        jsonProperty("ClaimsSchema", jsonArray(
                            jsonObject(
                                jsonProperty("ID", "employeeid"),
                                jsonProperty("JwtClaimType", "name"),
                                jsonProperty("SamlClaimType", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"),
                                jsonProperty("Source", "user")
                            ), 
                            jsonObject(
                                jsonProperty("ID", "tenantcountry"),
                                jsonProperty("JwtClaimType", "country"),
                                jsonProperty("SamlClaimType", "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country"),
                                jsonProperty("Source", "company")
                            )
                        )),
                        jsonProperty("IncludeBasicClaimSet", "true"),
                        jsonProperty("Version", 1)
                    ))
                )))
            .displayName("My Policy")
            .build());

    }
}
import pulumi
import json
import pulumi_azuread as azuread

my_policy = azuread.ClaimsMappingPolicy("myPolicy",
    definitions=[json.dumps({
        "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,
        },
    })],
    display_name="My Policy")
import * as pulumi from "@pulumi/pulumi";
import * as azuread from "@pulumi/azuread";

const myPolicy = new azuread.ClaimsMappingPolicy("myPolicy", {
    definitions: [JSON.stringify({
        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,
        },
    })],
    displayName: "My Policy",
});
resources:
  myPolicy:
    type: azuread:ClaimsMappingPolicy
    properties:
      definitions:
        - Fn::ToJSON:
            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
      displayName: My Policy

Create a ClaimsMappingPolicy Resource

new ClaimsMappingPolicy(name: string, args: ClaimsMappingPolicyArgs, opts?: CustomResourceOptions);
@overload
def ClaimsMappingPolicy(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        definitions: Optional[Sequence[str]] = None,
                        display_name: Optional[str] = None)
@overload
def ClaimsMappingPolicy(resource_name: str,
                        args: ClaimsMappingPolicyArgs,
                        opts: Optional[ResourceOptions] = None)
func NewClaimsMappingPolicy(ctx *Context, name string, args ClaimsMappingPolicyArgs, opts ...ResourceOption) (*ClaimsMappingPolicy, error)
public ClaimsMappingPolicy(string name, ClaimsMappingPolicyArgs args, CustomResourceOptions? opts = null)
public ClaimsMappingPolicy(String name, ClaimsMappingPolicyArgs args)
public ClaimsMappingPolicy(String name, ClaimsMappingPolicyArgs args, CustomResourceOptions options)
type: azuread:ClaimsMappingPolicy
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ClaimsMappingPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ClaimsMappingPolicyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ClaimsMappingPolicyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ClaimsMappingPolicyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ClaimsMappingPolicyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ClaimsMappingPolicy Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ClaimsMappingPolicy resource accepts the following input properties:

Definitions List<string>

A string collection containing a JSON string that defines the rules and settings for this policy

DisplayName string

The display name for this Claims Mapping Policy.

Definitions []string

A string collection containing a JSON string that defines the rules and settings for this policy

DisplayName string

The display name for this Claims Mapping Policy.

definitions List<String>

A string collection containing a JSON string that defines the rules and settings for this policy

displayName String

The display name for this Claims Mapping Policy.

definitions string[]

A string collection containing a JSON string that defines the rules and settings for this policy

displayName string

The display name for this Claims Mapping Policy.

definitions Sequence[str]

A string collection containing a JSON string that defines the rules and settings for this policy

display_name str

The display name for this Claims Mapping Policy.

definitions List<String>

A string collection containing a JSON string that defines the rules and settings for this policy

displayName String

The display name for this Claims Mapping Policy.

Outputs

All input properties are implicitly available as output properties. Additionally, the ClaimsMappingPolicy resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing ClaimsMappingPolicy Resource

Get an existing ClaimsMappingPolicy resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ClaimsMappingPolicyState, opts?: CustomResourceOptions): ClaimsMappingPolicy
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        definitions: Optional[Sequence[str]] = None,
        display_name: Optional[str] = None) -> ClaimsMappingPolicy
func GetClaimsMappingPolicy(ctx *Context, name string, id IDInput, state *ClaimsMappingPolicyState, opts ...ResourceOption) (*ClaimsMappingPolicy, error)
public static ClaimsMappingPolicy Get(string name, Input<string> id, ClaimsMappingPolicyState? state, CustomResourceOptions? opts = null)
public static ClaimsMappingPolicy get(String name, Output<String> id, ClaimsMappingPolicyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Definitions List<string>

A string collection containing a JSON string that defines the rules and settings for this policy

DisplayName string

The display name for this Claims Mapping Policy.

Definitions []string

A string collection containing a JSON string that defines the rules and settings for this policy

DisplayName string

The display name for this Claims Mapping Policy.

definitions List<String>

A string collection containing a JSON string that defines the rules and settings for this policy

displayName String

The display name for this Claims Mapping Policy.

definitions string[]

A string collection containing a JSON string that defines the rules and settings for this policy

displayName string

The display name for this Claims Mapping Policy.

definitions Sequence[str]

A string collection containing a JSON string that defines the rules and settings for this policy

display_name str

The display name for this Claims Mapping Policy.

definitions List<String>

A string collection containing a JSON string that defines the rules and settings for this policy

displayName String

The display name for this Claims Mapping Policy.

Import

Claims Mapping Policy can be imported using the id, e.g.

 $ pulumi import azuread:index/claimsMappingPolicy:ClaimsMappingPolicy my_policy 00000000-0000-0000-0000-000000000000

Package Details

Repository
https://github.com/pulumi/pulumi-azuread
License
Apache-2.0
Notes

This Pulumi package is based on the azuread Terraform Provider.