Create workspace tenants

Follow

In workspace365 you can have multiple tenants within your instance!
These tenants are easily created with the powershell script posted below.

As an admin it is possible to create a workspace from your instance. You need to update the $hostname and $provisioningKey to your own parameters. You can find the $provisioningKey in: 

\inetpub\wwwroot\Workspace 365\Workspace 365\Configs\NDAW.Html.Front.config

As a partner you should be aware of your own hostname. Fill in the details in the script below and execute the .ps1 script.

###########################################################################
###########################################################################
#Copyright (C) New Day at Work B.V. - All Rights Reserved
#Unauthorized copying of this file, via any medium is strictly prohibited
#Proprietary and confidential
#Written by New Day at Work <contact@newdayatwork.com> , Januari 2017
#Copyright (C) New Day at Work B.V. - All Rights Reserved
#Unauthorized copying of this file, via any medium is strictly prohibited
#Proprietary and confidential
#Written by New Day at Work <contact@newdayatwork.com> , Januari 2017
###########################################################################
###########################################################################
#Prerequisites:
# - Microsoft Sign in Assistant, https://www.microsoft.com/en-us/download/details.aspx?id=28177
# - Azure AD Powershell module, http://go.microsoft.com/fwlink/p/?linkid=236297
# - Workspace365 instance hostname
# - Workspace365 instance provisioningskey
###########################################################################
###########################################################################
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$Credentials = Get-Credential

# Convert the password for W365 format
$SecurePassword = $Credentials.Password
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword)
$W365Password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)

$hostName = 'FILL IN HOSTNAME'
$provisioningKey = 'FILL IN PROVISIONING KEY'
$o365user = $Credentials.UserName
$o365password = "$W365Password"
$environmentNameRaw = Read-Host "Please enter the environmentname"
$environmentName = $environmentNameRaw.ToLower()

# Get the tenantname from Microsoft
Connect-MsolService -Credential $Credentials
$TenantName = (Get-MsolDomain | Where-Object {$_.Name -like '*.onmicrosoft.com'}).Name.Split('.')[0]
$Firstname = (Get-MsolUser -UserPrincipalName "$o365user").FirstName
$LastName = (Get-MsolUser -UserPrincipalName "$o365user").LastName
$SecondaryEmailAddress = (Get-MsolUser -UserPrincipalName "$o365user").AlternateEmailAddresses

if ([string]::IsNullOrWhiteSpace($LastName)) {
$LastName = 'Workspace 365'
}
if ([string]::IsNullOrWhiteSpace($SecondaryEmailAddress) -or ($SecondaryEmailAddress -eq $o365user)) {
$SecondaryEmailAddress = 'support@newdayatwork.com'
}
# Write-Output 'Omgeving wordt aangemaakt...'

$requestBody = @{
EnvironmentName = "$environmentName"
EmailAddress = "$o365user"
Password = "$o365password"
FirstName = "$Firstname"
LastName = "$LastName"
SecondaryEmailAddress = "$SecondaryEmailAddress"
}
$json = $requestBody | ConvertTo-Json

Invoke-RestMethod -Method Post -Uri "https://$hostName/Provisioning/Environment" -ContentType "application/json" -Header @{ 'ProvisioningKey' = $provisioningKey } -Body $json

# Write-Output 'Documenten instellen...'
$requestBody = @{
DefaultUrl = "https://$TenantName.sharepoint.com"
AuthenticationType = "Online"
}

$json = $requestBody | ConvertTo-Json

Invoke-RestMethod -Method Put -Uri "https://$hostName/Provisioning/$environmentName/SharePointSettings" -ContentType "application/json" -Header @{ 'ProvisioningKey' = $provisioningKey } -Body $json

# Write-Output 'Exchange instellen...'
$requestBody = @{
PowerShellUrl = "https://outlook.office365.com/powershell-liveid/"
ServerType = "Office365"
DefaultEwsUrl = "https://outlook.office365.com/EWS/Exchange.asmx"
}

$json = $requestBody | ConvertTo-Json

Invoke-RestMethod -Method Put -Uri "https://$hostName/Provisioning/$environmentName/ExchangeSettings" -ContentType "application/json" -Header @{ 'ProvisioningKey' = $provisioningKey } -Body $json

Write-host "Omgeving $environmentName succesvol aangemaakt" -ForegroundColor "Green"

 

 

Have more questions? Submit a request