1

I have successfully configured for one web application. While adding the second web application using PowerShell script I have given wrong urn and now when I try to update the urn in SharePoint it throws the error

Exception calling "Add" with "2" argument(s): "An item with the same key has already been added.

The script which I used to update the second web application is below:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
 
 $sts = Get-SPTrustedIdentityTokenIssuer | where {$_.Name -eq "ADFS"}

 $uri = new-object System.Uri("https://contoso.com/")
 
 $sts.ProviderRealms.Add($uri, "urn:sharepoint:MyNewWebApplicationURL")
 
 $sts.Update();

1 Answer 1

0

Try to remove the existing URI (which you added incorrectly).

$sts.ProviderRealms.Remove($uri)

$sts.Update()

Now try to re add it with proper uri.

1
  • HI Waqas thank you , it wokred. how can I renew the token signing cert on SharePoint side , as I have two different tokenissuers in my environment. How to update without affecting the other one , Can you let me know. sorry for the different question here
    – SPLearner
    Aug 16, 2021 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.