Deleting SharePoint Online Site using PowerShell

Please note before you complete any of the below you will have to install and configure the SharePoint Online Management Shell. If more information is needed I have included the Microsoft TechNet Guide on setting this up:

  •  Open SharePoint Online Management Shell as an Admin
  •  Enter Connect-SPOService to connect to the O365 Tenant
  •  You will then be prompted to enter the URL for the Admin Center and log in using your O365 Credentials

URL: (Example)

  •  For my example I want to delete a O365 Group Site (Modern Site Collection) after completing  the first 3 steps. You would enter the below command

PS C:\Windows\System32> Remove-SPOsite

  • Then you would be prompted to enter the Identity of the site you would like to delete. I have included an example below

cmdlet Remove-SPOSite at command pipeline position 1

Supply values for the following parameters:

Identity:  (Example)

  • After pressing enter you have to confirm this action which can be done by Selecting Y below and pressing enter: Are you sure you want to perform this action? Performing the operation “Remove-SPOSite” on target[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is “Y”): Confirm


  • You will know the job has completed successfully if no red text appears and the next line reverts back to  “PS C:\Windows\System32>” again. You can verify in your Environment if the Site was deleted.

Using Microsoft Flow

Simply-put Flow is the modern version of “Workflows” that were found in previous versions of SharePoint.  Its completely cloud-based and is a simpler way of creating and automating the workflows across multiple applications. This allows for ease of use as in the past you had to hire developer who may take weeks to complete complex workflows.

As an example I have created a List in SharePoint Online entitled “Twitter Test”  that will be populated with data from Twitter post with a certain criteria.  The list has the following two columns that we will need to accomplish this goal.

  1. Twitter Username (Renamed from Title) this will display the Username or Twitter handle for the user that makes the post
  2. Tweet Text is the actual tweet that the user above sends out.

flow list

Create Flow

The next step is “Create from blank” > in the search bar that says “Search all connectors and triggers” enter Twitter  > Select the Trigger that says “When a new Tweet is posted”.

Trigger – cause (an event or situation) to happen or exist.

(If you haven’t already connected your Twitter account to Microsoft Flow, select Sign in to Twitter, and then provide your credentials. Please note you may have to Sign in to SharePoint as well.)

Under when a new tweet is posted there is a text box that you can enter your criteria in. For my example below anytime someone tweets the phrase #LSfather it will appear in the “Twitter List” from above.


The next step is to select the + icon >  Add an Action > Select SharePoint Create Item. Select the site address the list is associated with and the name of the list.


Once this information is selected you will see the columns from the list appear below Site Address and List Name.  In the Title field (renamed Username in the list)  we need to select a parameter which in this case is the User Name to display the twitter user name.

parameter – a numerical or other measurable factor forming one of a set that defines a system or sets the conditions of its operation. 

In the Tweet Text field we need to select the parameter Tweet Text which will populate with the text of the tweet that contains the “Search text” #LSFather.


Once this is completed press Save. Now we need to confirm if this flow is active and functioning. Navigate to tweeter and create a test Tweet with the “Search Text” field.


After the tweet is posted navigate to the list in SharePoint Online it may take up to 5 minutes but the tweet will have populated the correct fields.


That’s it, we’ve built our first flow in under 10 minutes.