List all failed site designs in your tenant

List all failed site designs in your tenant header image

At the SPC19 in Las Vegas, I had the chance to present on site designs. During the final discussion on the options for administrators, a nice question arose. How can I get an overview of all sites where site designs have failed.

PowerShell to the rescue

While the admin center does not show you the failed site designs, or sites that have failed designs. You can use PowerShell as there are some commands available for you. You can use the Get-SPOSiteDesignRun and Get-SPOSiteDesignRunStatus as described in a blog: How to find which site designs have been applied on a SharePoint site by Beau Cameron. So that and the discussion got me thinking: it shouldn’t be too hard to list all sites with ‘problems’. To achieve that you will have to do a few things:

  1. List all sites in your tenant
  2. List the site design for each sites
  3. Then list status information for each site design applied

Once you have done that you can apply easy filtering to select the info you need. Either you write all sites that have site designs that did not succeed. Or all site designs that have actual failures. Keep in mind that listing anything that is not ‘success’ will also list items that are not applied because they already were.

  Get-SPOSite -Limit All | ForEach-Object {
  $failedRuns = Get-SPOSiteDesignRun $_.Url | Get-SPOSiteDesignRunStatus | Where-Object {$_.OutcomeCode -ne "Success"};

  if($failedRuns) {
    Write-Output $_.Url
    $failedRuns
  }
}

The sample above will return you a list of all sites, and their non successful runs. The sample below will list all sites with an ‘actual’ error. This will filter out instances where no action was taken (NoOp).

Get-SPOSite -Limit All | ForEach-Object {
  $failedRuns = Get-SPOSiteDesignRun $_.Url | Get-SPOSiteDesignRunStatus | Where-Object {$_.OutcomeCode -eq "Failure"};

  if($failedRuns) {
    Write-Output $_.Url
    $failedRuns
  }
}

You can then use this information for further action. So I hope this will help you in getting some insights into Site designs and their actions that might cause trouble on your tenant. Or that it provides insights that you can pass on to Site Owners.

Loading comments…