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

Delete Workspace tenant

Table of Contents



As an admin it is possible to delete a Workspace from your instance. This is easily done by using the PowerShell script below. 

You can open PowerShell with administrator privileges, adjust two values and run the script below. After filling in the Global Admin account credentials, filling in the environment name and confirm, the tenant will be deleted. 

We recommend using this method when deleting tenants.
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.


Delete tenant script

As an admin it is possible to delete a Workspace from your instance. You need to update the $hostname and $provisioningKey to own parameters. The Provisioningskey is known internally.

#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