Navigation Bar

Friday 3 June 2011

Creating Secure Store Application using PowerShell for SharePoint 2010

Secure Store Application is enhanced version of SSO (in SharePoint 2007), which is use to store important information that can be used in the application. The information could be a connection string or user name or password.

It stores securely so you don't need to worry about the encryption and decryption. There are APIs to read values from it.

Yesterday one of my friend had some issue with creating Secure Store Application using PowerShell.

If you create an Secure Store Application from Central Admin, you can follow below steps to get it done:

Log on to Central Admin

Click Manage Service Applications

Click Secure Store Servie

Click New

Supply all you details and click OK. To set your connection string, following step as shown in below image:

Now the Secure Store Application is ready for use. When you do automated testing for deployment you need some scripting to create all these for you.

I am going to show you how we can get the same thing done using PowerShell script and we can use that script for deployment or creating staging or dev environment for projects.

$connectionStringField = New-SPSecureStoreApplicationField –Name “ConnectionString” -Type Generic –Masked:$false

$fields = $connectionStringField

$userClaim = New-SPClaimsPrincipal –Identity “youdomain\administrator” –IdentityType WindowsSamAccountName

$demoTargetApp = New-SPSecureStoreTargetApplication –Name “DemoApplicationID2” –FriendlyName “Demo Target Application 2” –ApplicationType Group

$app = New-SPSecureStoreApplication –ServiceContext http://uwsp2010dev-1 –TargetApplication $demoTargetApp –Fields $fields –Administrator $userClaim -CredentialsOwnerGroup $userClaim

Things to note is that you must pass CredentialsOwnerGroup, when you look in MSDN it says it is optional but its NOT.

No comments:

Post a Comment