I want a custom app to be installed by default whenever a site is created with a specific site collection/managed path/template and users from that site should not remove that app from that site. The best way to implement this is to create a feature stabling with custom site definition. Unfortunately, SharePoint Online does not support feature stabling or site definition.
Solution
As a SharePoint or global admin in Office 365, you can create an App Catalog site to make internally developed custom apps available for users to install when they browse apps under the From Your Organization filter on the Site Contents page. Site owners can then add these apps.
- The first step is to create the App Catalog site collection if it hasn’t already been created.
- Once the App Catalog has been provisioned, upload the first version(my first version: 1.0.0.0) of your app in the app catalog site.
- Install the first version of your app in the app catalog site.
- Select the ellipses ( …) next to the app, select the ellipses ( …) again in the callout to view the menu, and then select Deployment.
- Now you will be redirected to the “Manage App Deployments” page where in you can configure where you wish to install the app. App can be installed with Site Collections, Managed Paths and Site Templatesbased scopes.
- Configure the setting as per your requirement and click Ok (if required trust the app)
- In this example, I wanted to install my app in https://sharepointrider.sharepoint.com/sites/dev site collection under sites managed path with Developer Site templates only.
- Now the app should be installed in the above said sites
Note: If you notice, the app information callout’s footer section is rendered only with an About callout action and user can not remove the app from the site.
- Now upload the next version(1.0.0.1) of your app in the app catalog site
- Upgrade the app in the app catalog site
- Now your app should get upgraded automatically in the sites you configured in step # 4.
This approach provides the flexibility and governance for SharePoint add-in deployments.