Friday, April 4, 2014

Setting Up Extranet - Part 2


a.       Double-click sysadmin.

b.      If you don’t see accounts listed there then you need to add them first in Logins. Right-click Logins node and select New Login. Enter Login name and click Search. Click OK if login name is found otherwise click Check Names to find the login and then click OK.
c.       Click OK.
d.      Login has been added. Now it’s time to add it to the server roles. Expand Server Roles node, then double-click sysadmin node.
e.      Click Add.
f.        Enter Login name and click Check Names. Click Ok to add login to the role. 

Repeat these steps to add the second login. One was Walisystems\spservice account that was especially for SharePoint. Second was WaliSystems\Administrator account that STS application pool uses.

To add these accounts directly to the database permissions (instead of adding them in sysadmin role), do the following:

a.       Expand aspnetdb database node.
b.      Expand Security node.
c.       Right-click Users and select New User.
d.      Enter User name. Enter same in the Login name and click ellipsis. Enter login name, click Check Names then click Ok.
e.      Check following options in both Owned Schemas and Database role membership boxes:

Ø  Aspnet_Membership_FullAccess
Ø  Aspnet_Personalization_FullAccess
Ø  Aspnet_Profile_FullAccess
Ø  Aspnet_Roles_FullAccess
Ø  Aspnet_WebEvent_FullAccess



2.       Now that accounts have been added, next step is to add data. I will show you two methods for adding data, one using the MembershipSeeder tool and second adding users manually. First, I will show you how to use MembershipSeeder tool.

Add Users Using MembershipSeeder Tool


3.        Download MembershipSeeder.zip from following location:


4.       Unzip package and go to MembershipSeeder > Bin > Release folder and run MembershipSeeder.exe.




5.       Click Configure to enter database name. Enter your database name. Click OK. Close the application and re-open.
6.       To add users, click Create in the Membership section. You can change the default values. By default, username prefix is user. All usernames will have this prefix. Password can also be changed. Enter your domain name in the Email Suffix.  By default, application will show your server’s FQDN. Finally enter number of users that you want to create. Default number is 50. If you want to create only one user, check Only create or delete 1  user; don’t use the # of Users field. This will only create one user. If you chose more than one user, then application will create all users with user prefix. For example, you created two users, usernames will be user1 and user2. You can also delete users by clicking the Delete button.






Figure: aspnet_Users table
7.       To add roles, enter Role name. You can change User Prefix, # of Users, and Start Num. Click Create to create the role. I needed to add an admin role, therefore, I entered Admin in the Role field. I changed User Prefix to Admin and # of Users to 1. Start Num should be 1 if this is first admin you are adding.

Figure: aspnet_Roles table
8.       To change password, use Password and Properties section. To find a user, use Find User section. To see all roles, click Get Roles button. To see all users, click Get Users button. To add user to a role, click Add to Role button.

Add Users Manually


9.       If you have access to the tool, then why would you add users manually? This process will help you understand the database structure and you will learn what data needs to go to what tables. In SQL Server Management Studio, click New Query button.

Figure: New Query button
10.   You need three GUIDs, one for ApplicationId, one for RoleId and one for UserId. We will add just one user for now. For every new application, role and user you need a new GUID. That’s where data tool comes in handy (discussed above). Now, we will generate GUIDs manually in the SQL script window. In the script window, write following command and click Execute button. Run this command thrice to create three GUIDs and note them down, you will need them when adding data to tables.
Select newid()
11.   Right-click aspnet_Applications table and select Edit Top 200 Rows. Add following data in new row:
Column
Value
ApplicationName
Fba
LoweredApplicationName
fba
ApplicationId
9f369fb1-9480-4d8a-bb44-7838a3c2afab
Description
fba

12.   Add following data to the aspnet_Roles table.
Column
Value
ApplicationId
9f369fb1-9480-4d8a-bb44-7838a3c2afab
RoleId
9f369fb1-9480-4d8a-bb44-7838a3c2afaa
RoleName
Admin
LoweredRoleName
admin
Description
Admin Role

13.   Add following data to the aspnet_Users table.
Column
Value
ApplicationId
9F369FB1-9480-4D8A-BB44-7838A3C2AFAB
UserId
9F369FB1-9480-4D8A-BB44-7838A3C2AFAC
UserName
saif
LoweredUserName
Saif
MobileAlias
NULL
IsAnonymous
0
LastActivityDate
2012-12-23

14.   Add following data to the aspnet_UsersInRoles table.


Column
Value
UserId
9F369FB1-9480-4D8A-BB44-7838A3C2AFAC
RoleId
9F369FB1-9480-4D8A-BB44-7838A3C2AFAA

No comments:

Post a Comment