Table of Contents

Introduction

This article will address the challenges around automation of SharePoint Online deployment.

Below artifacts can be developed through this technique,

You can combine any set of above artifacts into a WSP solution.

Tool Description

This tool is responsible for activating the mandatory features for any site other than Publishing and Installing or Upgrading the WSP Solution to SPO O365 tenant site collection.

Below are the features activated using this tool,

  1.  SharePoint Server Publishing Infrastructure
  2.  SharePoint Server Publishing 

You can also extend the logic for activation of other feature by calling below,

PowerShell
Enable-SPOFeature -sSiteColUrl $SiteURL -spoCtx $Context -sFeatureGuid $FeatureGuidServerPublishing -IsSiteScope $False

Use below parameters while calling the method:

Download Source

Click here to download Source

Environment Setup for a remote machine

In order to enable SharePoint Online PowerShell Script execution from your remote machine. Click here for setup steps

Authentication and Execution Model


  

As depicted in above model diagram shows how PowerShell based tool help to authenticate, connect to SPO and on validation it helps to execute the CSOM based commandlets and deploy the WSP to perform deployment of different artifacts as packaged. Below is the major component as depicted in the diagram:

  1. SharePoint Online Management Shell
  2. Authentication component - while connecting to SharePoint Online tenant
  3. Validated Admin enable to process the execution of SPO
  4. SharePoint Tenant - Site Collection  Targeted destination for deployment

Run Execution Command

Below is the command will be helpful to execute the tool. Kindly modify the parameters before execution

PowerShell
.\ApplyDesignPackageInstalltionAndUpgradeWSP.ps1 -User admin@xxxxxx.onmicrosoft.com -SiteURL "https://xxxxxx.sharepoint.com/sites/xxxxxx" -wspFullFilePath "C:\Amjad\<WSPBuildName>.wsp"  -WspFileName "<WSPBuildName>.wsp" -wspPackageName "<WSPBuildName>" -majorVersion 1 -minorVersion 0

 Parameters details are as below.

 The script can accept seven parameters from the command line:

  1. User
    •  mandatory - Administrator login ID for the tenant we are querying
  2. SiteURL
    •  mandatory - Destination Site URL for the tenant we are querying
  3. wspFullFilePath
    •  mandatory - Path of WSP location to upload from
  4. WspFileName
    •  mandatory - Name of WSP file   
  5. majorVersion
    •  Optional - majorVersion of the Build deployment or upgrade
  6. majorVersion
    •  Optional - minorVersion of the Build deployment or upgrade#