< Back

Copy-ADFSClaimRule

Fri Jan 10, 2020 7:22 pm

NAME Copy-ADFSClaimRule



SYNOPSIS

This script allows quick duplication of Relying Party trusts, either within or across farms.





SYNTAX

Copy-ADFSClaimRule [-SourceRelyingPartyTrustName] <String> [-DestinationRelyingPartyTrustName] <String>

[-SourceADFSServer <String>] [-DestinationADFSServer <String>] [-Credential <PSCredential>] [<CommonParameters>]





DESCRIPTION

Copies all claim rules from one RPT to another within a farm, which is useful for testing claims in "all-in-one

scenarios". It can also duplicate rules across farms for more complete testing scenarios, allowing

pulling/pushing of settings between dev/test/prod.





PARAMETERS

-SourceRelyingPartyTrustName <String>



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-DestinationRelyingPartyTrustName <String>



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SourceADFSServer <String>



Required? false

Position? named

Default value $env:COMPUTERNAME

Accept pipeline input? false

Accept wildcard characters? false



-DestinationADFSServer <String>



Required? false

Position? named

Default value $env:COMPUTERNAME

Accept pipeline input? false

Accept wildcard characters? false



-Credential <PSCredential>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Copy-ADFSClaimRule ProdRule TestRule



This command duplicates the settings from `ProdRule` into `TestRule`. If `TestRule` doesn't exist, it will error

as each RPT requires a unique identifier that cannot be copied.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Copy-ADFSClaimRule -SourceRelyingPartyTrustName QA -DestinationRelyingPartyTrustName QA -SourceADFSServer

server01 -DestinationADFSServer server02



This will copy the "QA" rule exactly between the two servers listed, creating the rule if it is missing. Note

that this command should be run on the primary server of each farm.

Either ADFSServer value can be omitted and the local host will be the assumed machine.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Copy-ADFSClaimRule QA QA -SourceADFSServer server01 -DestinationADFSServer server02 -Credential $mycreds



when running Powershell remotely, many auth methods do not allow passthrough authentication. The `credential`

param allows passing through credentials, which can be generated via `get-credential` cmdlet.











RELATED LINKS