Setup: Existing ADFS 2.0 installation

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

Solution: Open Power Shell console and run this code

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

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

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

$claims = (Get-ADFSRelyingPartyTrust $SourceRelyingParty).IssuanceTransformRules
Get-AdfsRelyingPartyTrust $DestinationRelyingPartyTrust | Set-ADFSRelyingPartyTrust -TargetName $DestinationRelyingPartyTrust -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.