programming4us
 
Applications Server
 

Packaging and Deploying Sharepoint 2013 Apps : Deploying an App (part 2) - Provider-Hosted App Deployment

2/8/2014 1:16:55 AM

2. Provider-Hosted App Deployment

Provider-hosted applications are the most complex of the three app types because hosting and running the application code is up to the developer, rather than allowing SharePoint and Azure do these things for you. However, with the increased complexity comes increased flexibility, because you manage your application’s back end. This means that making fixes or updates to it is straightforward, and the ultimate user for the application might never know or care to know about the changes being made to the application. Only if you make changes to the components of your app that reside within the SharePoint site itself would you need to issue an update to the application package in the app catalog or Marketplace. However, you should consider that you might need to deal with multi-tenancy issues, such as tenant specific–data partitioning, given that an app may be installed on multiple sites.

Deploying a Provider-hosted application happens in two main stages:

1. Deploying the application back end
2. Deploying the SharePoint application package

The application backend can theoretically be any technology and is not limited to Internet Information Server. The only stipulation is that the SharePoint farm or SharePoint Online must be able to communicate with it over HTTP (port 80) and HTTPS (port 443).

For on-premises applications, Provider-hosted applications are the only choice when back-end code is involved. This requires setting up server-to-server authentication .

Now try out deploying a Provider-hosted application in the following exercise using SharePoint Online and Windows Azure.


Deploying a Provider-Hosted App

In this example you create a very basic SharePoint Provider-hosted application using Visual Studio and Azure Web Sites. You need a SharePoint Online tenant set up as well as an Azure account with Azure Web Sites enabled. You also need to have the app catalog created from the previous exercise, “Creating a Private App Catalog in Office 365,” prior to starting this exercise.

1. Log into the Azure management portal and create a new Azure Web Site as shown in Figure 7. You must give it a unique URL, so remember to write it down because you will need it later on.

FIGURE 7

image

2. After the site is created, go into the Azure dashboard for the site and download the publishing profile for Visual Studio using the Download publish profile link. Save the file locally somewhere.

3. Navigate to SharePoint Online’s tenant admin screens by logging into: http://portal.microsoftonline.com, clicking the Admin menu in the top right of the homepage and then selecting SharePoint. Create a new SharePoint Developer site by clicking into the Site Collections management page, and then click the New button and select Private Site Collection, as shown in Figure 8.

FIGURE 8

image
4. Give your site a title; for example, My New Site, as well as a URL, such as mydevsite. Select the Developer Site template from the list of available templates, as shown in Figure 9, and then click OK.

FIGURE 9

image

5. After the site has been created, navigate to it and then navigate to the following page in the browser: https://<my SPO site url>.sharepoint.com/sites/mydevsite/_layouts/15/appregnew.aspx.

6. After the form appears, complete it by clicking the Generate button to create the client ID and secret for you.

7. Give your application a name such as My Awesome App.

8. In the App Domain box specify the exact URL for the Azure Web Site you created in step 1. The form should look like Figure 10.

FIGURE 10

image

9. Click Create to create the application registration.

10. Copy all the details provided about the application registration. Figure 11 shows an example.

FIGURE 11

image

11. Create a new SharePoint app in Visual Studio using the App for SharePoint 2013 template.

12. Enter the name of your app in the first box; for example, My Awesome App.

13. Enter the URL to your SharePoint Online development site.

14. Select Provider-hosted from the app type drop-down list. When it’s complete, the form should look similar to Figure 12.

FIGURE 12

image

15. Click Finish.

16. Right-click the Web project in the solution and select Publish as shown in Figure 13.

FIGURE 13

image

17. Click the Import button and select the profile file you downloaded from Azure previously. Download it from Azure if you skipped this step earlier. Validate the connection to make sure it’s working by clicking the Validate Connection button as shown in Figure 14.

FIGURE 14

image

18. Click Publish and let your site deploy. When the deployment finishes, a browser should pop up a screen like the one shown in Figure 15.

FIGURE 15

image

19. Go back into the Azure management dashboard for your site and click the Configure tab. Create the ClientId and ClientSecret app settings and copy in the App ID and App Secret you generated in step 10 (see Figure 16). Azure Web Sites reads them from here even if you have them in your web.config. Not configuring the settings in Azure will mean your app crashes.

FIGURE 16

image

20. Click the Save button to commit the settings to Azure.

21. Right-click the SharePoint app project in Visual Studio and choose Publish. If the Publish wizard is not already on the profile page, click profile in the left-side navigation to get to the Start screen.

22. Type a new profile name; for example, Office 365 Profile, and click Next.

23. On the Hosting page enter the full URL to your Azure Web Site, including the /pages/default.aspx; for example, https://cjsproviderhostedapp.azurewebsites.net/pages/default.aspx. See Figure 17.

FIGURE 17

image

24. Enter the App ID you generated into the Client ID field and the App Secret into the Client Secret field.

25. Click Next. A summary page appears like the one shown in Figure 18.

FIGURE 18

image

26. Click Finish. A new Windows Explorer window opens with your application package called MySharePointProviderHostedApp.app.

27. Open a browser window and navigate to the tenant admin portal for your Office 365 environment at: http://portal.microsoftonline.com.

28. Under the Admin menu in the top navigation, click SharePoint to go to the SharePoint Online tenant admin pages.

29. Click Apps in the left-side navigation.

30. Click the App Catalog link. The app catalog you created in the previous exercise appears.

31. Click the Distribute apps for SharePoint tile.

32. Click the New App button. You are prompted to pick the .app file for your application.

33. Click Browse and select the .app file that Visual Studio packaged for you in step 26. Click OK. A dialog appears asking for information about your application, as shown in Figure 19.

FIGURE 19

image

34. You are not required to enter any information, but you can enter the information if you want to, and then click Save. Your SharePointProviderHostedApp application appears in the app catalog.

35. Navigate to your development site in SharePoint Online.

36. Click Site Contents in the left-side navigation.

37. Click Add an App.

38. Click From Your Organization in the left-side navigation; you should see your newly added application listed.

39. Click the tile for the application. A prompt appears asking whether to trust your app.

40. Click Trust It, as shown in Figure 20. Your new app appears listed in the site contents.

FIGURE 20

image
41. Click it. You are redirected to your app and should see the title (whatever you called your site when you created it) of your site written to the page, as shown in Figure 21.

FIGURE 21

image

How It Works

In this exercise you created a rudimentary SharePoint Provider-hosted app that simply lists the name of the host site that app is installed in. You created, packaged, and deployed the code portion of your application to an Azure Web Sites site and configured the client ID and secret in the settings for that application. You then packaged and deployed the SharePoint app using Visual Studio’s Publish wizard. Once the packaging process was complete you uploaded the newly created app package to the app catalog in SharePoint Online.
Behind the scenes Visual Studio uses Web Deploy to deploy the app code to the Azure Web Site. When the application ran, it used the Client-Side Object Model (CSOM) combined with OAuth to call back to SharePoint and retrieve the name of the host Web SharePoint site. It did this using the client ID and secret you set up in the Azure settings along with the TokenHelper class provided in the app template project in Visual Studio.
 
Others
 
- Packaging and Deploying Sharepoint 2013 Apps : Deploying an App (part 1) - SharePoint-Hosted App Deployment
- Microsoft Lync Server 2013 Edge Server : Edge Server Administration (part 5) - Managing External Web Conferencing Features
- Microsoft Lync Server 2013 Edge Server : Edge Server Administration (part 4) - Managing Public Providers
- Microsoft Lync Server 2013 Edge Server : Edge Server Administration (part 3) - Managing XMPP Federation
- Microsoft Lync Server 2013 Edge Server : Edge Server Administration (part 2) - Assigning External Access Policies, Managing Federation
- Microsoft Lync Server 2013 Edge Server : Edge Server Administration (part 1) - Editing the Global External Access Policy, Creating a New External Access Policy
- Microsoft Lync Server 2013 Edge Server : Edge Server Configuration
- Packaging and Deploying Sharepoint 2013 Apps : Packaging and Publishing an App
- Packaging and Deploying Sharepoint 2013 Apps : Anatomy of an App (part 3) - Web Deploy Package, Database Package
- Packaging and Deploying Sharepoint 2013 Apps : Anatomy of an App (part 2) - Manifest and Assets, SharePoint Solution Package
 
 
REVIEW
 
- First look: Apple Watch

- 10 Amazing Tools You Should Be Using with Dropbox

- Sigma 24mm f/1.4 DG HSM Art

- Canon EF11-24mm f/4L USM

- Creative Sound Blaster Roar 2

- Alienware 17 - Dell's Alienware laptops

- Smartwatch : Wellograph

- Xiaomi Redmi 2
 
VIDEO TUTORIAL
 
- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 1)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 2)

- How to create your first Swimlane Diagram or Cross-Functional Flowchart Diagram by using Microsoft Visio 2010 (Part 3)
 
Popular tags
 
Video Tutorail Microsoft Access Microsoft Excel Microsoft OneNote Microsoft PowerPoint Microsoft Project Microsoft Visio Microsoft Word Active Directory Biztalk Exchange Server Microsoft LynC Server Microsoft Dynamic Sharepoint Sql Server Windows Server 2008 Windows Server 2012 Windows 7 Windows 8 Adobe Indesign Adobe Flash Professional Dreamweaver Adobe Illustrator Adobe After Effects Adobe Photoshop Adobe Fireworks Adobe Flash Catalyst Corel Painter X CorelDRAW X5 CorelDraw 10 QuarkXPress 8 windows Phone 7 windows Phone 8 BlackBerry Android Ipad Iphone iOS
 
Top 10
 
- How To Install Android Market & Google Apps On Kindle Fire
- How To Make Ubuntu Look Like Windows 7
- How To Add A New Account in MS Outlook 2013
- Get Android & Mac OS X Style Gadgets For Windows 7 & Windows 8 With XWidget
- How To Activate Microsoft Office 2013
- How To Install Actual Facebook App On Kindle Fire
- How To Create, View And Edit Microsoft Office Files On Kindle Fire
- Download Attractive Business PowerPoint Templates For Free At SlideHunter
- How To Use And Enable Hibernate & Sleep Mode In Windows 8
- How To Get Microsoft Office 2013 Trial Product Key From Microsoft