Setup: Existing ADFS 2.0 setup

Problem: You create a new Relying Party Trust and want to copy all the claim rules from similar RP

Solution: Open PowerShell console and run this code

Function Copy-Claims {
param (
[Parameter(Mandatory=$true)]
[Alias("SourceRP")]
$SourceRelyingParty,

[Parameter(Mandatory=$true)]
[Alias("DestRP")]
$DestinationRelyingParty
)

Add-PSSnapin Microsoft.Adfs.PowerShell | Out-Null

$claims = (Get-ADFSRelyingPartyTrust $SourceRelyingParty).IssuanceTransformRules
Get-AdfsRelyingPartyTrust $DestinationRelyingPartyTrust | Set-ADFSRelyingPartyTrust -IssuanceTransformRules $claims

}

After that issue the folowing command:

Copy-Claims <source>  <destination>

Tips:
Run this command to find out all RP names:

 Get-ADFSRelyingPartyTrust | select name 
Tagged:

Leave a Reply

Your email address will not be published.