chelnak
8/5/2016 - 8:57 AM

Create a vRA tenant with a local user and add a directory

Create a vRA tenant with a local user and add a directory

# --- Create the tenant
New-vRATenant -Name Tenant01 -Description "This is tenant 01" -URLName tenant01 -ContactEmail tenantadmin@company.com -ID tenant01

# --- Create a local user
New-vRAUserPrincipal -PrincipalId tenantadmin@vsphere.local -Tenant Tenant01 -FirstName tenant -LastName admin -EmailAddress tenantadmin@company.com -Description "Tenant admin local user" -Password password123

# --- Add local user as a tenant and iaas admin
Add-vRAPrincipalToTenantRole -TenantId Tenant01 -PrincipalId tenantadmin@vsphere.local -RoleId CSP_TENANT_ADMIN
Add-vRAPrincipalToTenantRole -TenantId Tenant01 -PrincipalId tenantadmin@vsphere.local -RoleId COM_VMWARE_IAAS_IAAS_ADMINISTRATOR

# --- Add a directory to the new tenant
$JSON = @"
{
  "name" : "Tenant01",
  "description" : "Tenant01",
  "alias" : "",
  "type" : "AD",
  "userNameDn" : "CN=svc_account,OU=Users,OU=Tenant01,OU=Tenants,DC=corp,DC=local",
  "groupBaseSearchDn" : "OU=Tenant01,OU=Tenants,DC=corp,DC=local",
  "password" : "P@ssword!",
  "url" : "ldap://dc01.corp.local:389",
  "userBaseSearchDn" : "OU=Tenant01,OU=Tenants,DC=corp,DC=local",
  "domain" : "corp.local",
  "domainAdminUsername" : "",
  "domainAdminPassword" : "",
  "subdomains" : [ "" ],
  "groupBaseSearchDns" : [ "OU=Tenant01,OU=Tenants,DC=corp,DC=local" ],
  "userBaseSearchDns" : [ "OU=Tenant01,OU=Tenants,DC=corp,DC=local" ],
  "certificate" : "",
  "trustAll" : true,
  "useGlobalCatalog" : false
}
"@
$JSON | New-vRATenantDirectory -ID Tenant01