Sample: Configure Claims (PowerShell)
Dynamics CRM 2011
[Applies to: Microsoft Dynamics CRM 2011]
This sample code is for Microsoft Dynamics CRM 2011, and can be found in the following location in the SDK download:
SampleCode\PS1\ConfigureClaims.ps1
Requirements
To set up the Microsoft Dynamics CRM PowerShell cmdlets, see Use PowerShell to Call the Deployment Web Service.
Demonstrates
The following script enables or disables claims authentication. You must specify the following parameters:
Enabled - A Boolean that specifies whether claims authentication is enabled or disabled.
EncryptionCertificate – An encryption certificate.
FederationMetadataUrl – A URL for federation metadata.
Example
param ( #optional params [boolean]$Enabled, [string]$EncryptionCertificate, [string]$FederationMetadataUrl ) $RemoveSnapInWhenDone = $False if (-not (Get-PSSnapin -Name Microsoft.Crm.PowerShell -ErrorAction SilentlyContinue)) { Add-PSSnapin Microsoft.Crm.PowerShell $RemoveSnapInWhenDone = $True } $ClaimsSettings = Get-CrmSetting -SettingType ClaimsSettings if($PSBoundParameters.ContainsKey('Enabled')) {$ClaimsSettings.Enabled = $Enabled} if($EncryptionCertificate) {$ClaimsSettings.EncryptionCertificate = $EncryptionCertificate} if($FederationMetadataUrl) {$ClaimsSettings.FederationMetadataUrl = $FederationMetadataUrl} Set-CrmSetting -Setting $ClaimsSettings $ClaimsSettings if($RemoveSnapInWhenDone) { Remove-PSSnapin Microsoft.Crm.PowerShell }
See Also
Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.
Community Additions
ADD
Show: