Hi ,
Welcome to the Support Portal. How can we help?

How do I delete a Workspace tenant?

Table of Contents



As an admin it is possible to delete a Workspace tenant from your instance. This is easily done by running our PowerShell script.



The Provisioning Key is required. Self-hosted Partners can find the $provisioningKey in: 

\inetpub\wwwroot\Workspace 365\Workspace 365\Configs\NDAW.Html.Front.config
The provisioning key is given during the launch of the Workspace. With this key you can manage your entire instance, e.g. create or delete tenants. This is highly sensitive information and should be known within your organization.



  • Open PowerShell ISE with administrator privileges.
  • Copy and paste the script below in Powershell. Adjust two values to your own parameters:
    • $hostname
    • $provisioningKey
  • Run the script.
  • You will be prompted with filling in the environment name (lowercase letters!).
  • Confirm by typing "yes" and the tenant will be deleted.

#Set TLS communication to only 1.2. Other is not supported. [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$hostName = 'DOMAIN' # Enter the hostname of the Workspace365, dont include https or the environment name.
$provisioningKey = 'KEY' # Enter the Provisioningskey which is located in the NDAW.HTML.Front.config
$environmentNameRaw = Read-Host -Prompt "Enter Environment Name"
$environmentName = $environmentNameRaw.ToLower() if (![string]::IsNullOrEmpty($environmentName)) { $confirmation = Read-Host -Prompt "Are you sure you want to delete the environment: $environmentName ?" if ($confirmation -eq "y" -or $confirmation -eq "Y" -or $confirmation -eq "Yes" -or $confirmation -eq "yes"){
Invoke-RestMethod -Method DELETE -Uri "https://$hostName/Provisioning/Environment/$environmentName/" -ContentType "application/json" -Header @{ 'ProvisioningKey' = $provisioningKey } -ErrorVariable RestError;
Write-Host "Succesfully deleted environment $environmentName" -ForegroundColor Green;
$HttpStatusCode = $RestError.ErrorRecord.Exception.Response.StatusCode.value__
$HttpStatusDescription = $RestError.ErrorRecord.Exception.Response.StatusDescription

Write-Host "Environment deletion failed with error code: $($HttpStatusCode) and error description: $($HttpStatusDescription)" -ForegroundColor Red;
} else {
Write-Host "Environment deletion of environment: $environmentName canceled" -ForegroundColor Yellow;
} }

Back to top