Recently I was into a SharePoint 2013 overview training. Though the theory was fine, starting the actual App Development was a major hiccup, due to few changes that an experienced SharePoint developer would not expect.
As most of you would know by know, that SharePoint 2013 app development is supported in 2 ways:
- Napa tools development
Here the development environment is hosted inside a browser and no local installation is needed.
- Visual Studio 2012
Here you install VS 2012 and all the related tools (Office Developer Tools for Visual Studio 2012 and the SharePoint Client Components) on your local machine and do the development without installing SharePoint 2013 locally.
But how about the traditional way of development? Where you had SharePoint and Visual Studio and tools, everything locally and do the deployment and testing without much fuss? Remember, setting up a SharePoint developer workstation?
Well, that were the whole thing start getting a little complicated with SharePoint 2013. Let’s get to the story now.
Following the developer environment setup from a TechNet Blog, I created a new Windows Server 2012 VM with 16 GB RAM, a SQL Server 2012 VM, installed SharePoint 2013, installed VS 2012 and Office Developer Tools, had my developer site ready (oh! yes, you need to create a "developer" site because with VS 2012, you cannot deploy to any other site than a "developer" site, though not true for local deployments). Fun enough? More to come…
Mostly when developing on local machine, you are logged in using a single account, which is most likely also local windows administrator as well as system account for SharePoint 2013. That’s how I do it, if you do it differently, I would love to hear why !
Now you have the basic stuff in place, let’s start the App development for SharePoint 2013. I will try to cover the steps to create and deploy a "hello world" app on local SharePoint developer site directly through VS 2012. I would assume that by now you have everything installed on your local machine, including SharePoint 2013.
- Make sure you have SharePoint 2013 up and running on your local machine and have a developer site created. Then go ahead and launch VS 2012 and choose to create SharePoint 2013 App Project template.
- UAC – This is very thing you would notice (if you are on default UAC settings), even starting to develop the SharePoint 2013 app you need to start in elevated mode. Ok, most of us are now used to UAC prompts, so this gets out of way quickly.
- Now you get a familiar dialog asking for the Application name and site where to deploy it for debugging with an additional dropdown, asking for type of application you want to create based on the deployment model you choose. I chose SharePoint-Hosted app model.
- Now you are into the development mode and you get the skeleton code for the app in the solution.
- So we can just go ahead and deploy the skeleton app. You can directly hit F5 to deploy the app and open the URL or right-click on Project in Solution Explorer and select Deploy.
But the app did not deploy, rather I got the error:“Error occurred in deployment step ‘Install app for SharePoint’: The System Account cannot perform this action”.but isn’t System Account suppose to be the God account in SharePoint?
This is a security feature in the SharePoint 2013 that you cannot deploy an app using System Account. So what is the alternative?
Create another account and give permissions, so that it is NOT the system account. - So I did the following:
- Created a new account in AD as “admin1”
- Added “admin1” account into Farm Administrator’s group in Central Admin
- Added “admin1” account as Site Collection administrator to the target developer site
- Added “admin1” account into local administrators group
- After doing the steps, fired up VS 2012 using “admin1” credentials and created a new App for SharePoint 2013.
- In the “New App for SharePoint” dialog, I clicked on “Validate” button and this is what I get:
Rechecked that the user has got Farm Admin permissions and Site Collection administrator roles. But still same error. - I just ignored the error and click on Finish to create the App
- Then hit F5 to deploy and I get the following error:
Error occurred in deployment step ‘Uninstall app for SharePoint’: The local SharePoint server is not available. Check that the server is running and connected to the SharePoint farm.
That reaffirmed that some permissions are missing somewhere, as VS is not able to reach the SharePoint farm itself. - I decided to start by looking into event logs and found this error easily:
- Permissions are missing on Config DB, but won’t adding a user to Farm Administrators group give proper permissions? Looks like that is not the case.Then I remembered long ago I had written 1 KB article while at Microsoft, talking about permissions required for SharePoint Object Model.
- Next target, add “admin1” user as DBO on Config DB. Go back to SharePoint VM and hit F5 again. A new error pop’s up:
Error occurred in deployment step ‘Uninstall app for SharePoint’: Cannot connect to the SharePoint site: https://sp2013/sites/AppDev/. Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project. - Checking event viewer again revealed, that permissions are also needed on the Content DB for the Site Collection.
- Next, added “admin1” as DB_Owner for Content DB also. Go back to SharePoint VM and hit F5 again. Again a new error pops up:
Error occurred in deployment step ‘Install app for SharePoint’: We’re sorry, we weren’t able to complete the operation, please try again in a few minutes. If you see this message repeatedly, contact your administrator. - Checked event viewer, now AppMng_Service_DB requires permissions for “admin1” user. Back to SQL and give DB_Owner permissions on AppMng_Service_DB. Back to SharePoint, hit F5.
- Voilà! finally the app is deployed and opened up in the browser!
SQL database login for ‘SharePoint_Config_2013’ on instance ‘sql08’ failed. Additional error information from SQL Server is included below.
Login failed for user ‘DEVadmin1’.
Finally had the sample app up and running after grueling fight with the “new” environment for a few hours! Hope this helps you in the same way… Happy Apps!
Nice Article 🙂 But I have couple of concerns:
1. I don’t think DBA would give me explicit permissions just to deploy an App.
2. Is ther any workaround to this since this type of approach would need every App developer to have such permissions.
Hi Shriram,
I haven’t faced this issue when doing development for O365 but only when developing on local and deploying using F5 from within Visual Studio 2012.
Currently I do not have access to an evironment to test, but if you are doing local development and deploying apps by uploading to App catalog in SharePoint, you should not require explicit db permissions. Looks like only local SharePoint with F5 deployment would require these permissions.
Regards,
Manpreet
Good post and I like the way you highlight where you see each error before resolving it. Like you I hit all the same errors. However, I am also seeing a new one. I have ‘successfully’ deployed a default SharePoint hosted app to my test apps domain : appsdev.mydomain.com running on a vm. with my account ( added to administrators acc) . My app sits in the “Apps in Testing” but when you try to open it either in situ or or via VS2013 I am getting a 404 error .. I have yet to find the app web . I have deployed apps before in another environment but this a new test rig based on a client install.
Hi Daniel,
Thanks for liking the post. I haven’t come across this issue yet, but will try to dig around and provide you an update if I find something.
Regards,
Manpreet
Hi
I am also facing the same issue. Could you please explain the step 7 in more details?
I don’t know here can I change the default credentials and add the new user credentials
Hi Suresh,
Either you can do a right click on devenv.exe and select “Run as a different user” (https://www.thewindowsclub.com/how-to-run-as-different-user-in-windows-7) or login into the machine as “admin1” and start Visual Studio.
Let me know if this helps.
-Manpreet
Once I initially commented I clicked the Notify me when new feedback are added checkbox and now each time a remark is added I get four emails with the same comment. Is there any way you possibly can remove me from that service? Thanks! gegabgadafda