IBM Cloud Docs
Active Directory

Active Directory

本部分将逐步完成创建 Active Directory 和域名服务器 (ADDNS) 服务器所需的构建任务。

订购虚拟服务器

以下规范的虚拟服务器适用于 ADDNS 服务器主机,可使用 使用 UI 创建虚拟服务器实例中的指示信息进行订购。

  • 概要文件: bx2-2x8
  • 类型: 公用
  • 操作系统: WIndows 2019
  • NIC 数量: 1
  • 数据卷:

连接到服务器

部署虚拟服务器后,您需要将浮动 IP 地址连接到该服务器,以便可以远程访问该服务器,请参阅 添加浮动 IP 地址

Refer to 连接到 Windows 实例 to access the Windows Administrator's password, however, in short the following commands are used from your laptop, where the instances command returns the <INSTANCE_ID> of the virtual server:

ibmcloud is instances
ibmcloud is instance-initialization-values <INSTANCE_ID> --private-key @~/.ssh/id_rsa

创建域

要创建域,请使用以下命令:

  • 使用 Install-WindowsFeature 命令在服务器上安装 AD 功能部件。
  • 配置 AD 林。 The WinThreshold value configures a Windows Server 2016 forest with the domain name of <Domain_Name>. e.g. sqlserver.test and <NB_Domain> e.g. sqlserver. Create a password for <Safe_Mode_Admin_Password> that adheres with your standards. 服务器重新启动并配置 DNS ,包括将 DNS 解析器设置为 161.26.0.10161.26.0.11 (因为已使用这些 DNS 服务器配置了虚拟服务器网络接口)。
$domainfull = "<Domain_Name>"
$domainnb = "<NB_Domain>"
$smpassword = "<Safe_Mode_Admin_Password>"
Install-WindowsFeature AD-Domain-Services -IncludeManagementTools
Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath “C:\Windows\NTDS” -DomainMode “WinThreshold” -DomainName $domainfull  -DomainNetbiosName $domainnb -ForestMode “WinThreshold” -InstallDns:$true -LogPath “C:\Windows\NTDS” -NoRebootOnCompletion:$false -SysvolPath “C:\Windows\SYSVOL”  -SafeModeAdministratorPassword (ConvertTo-SecureString $smpassword -AsPlainText -Force)-Force:$true

创建组和用户

以下 Powershell 命令将创建名为 SQL Admins的新 AD 组,并将密码为 <Password> 的新用户 sqluser1 添加到 SQL Admins 组。 suffix 是域名的后缀,例如 comlocal:

$password = "<Password>"
$domainnb = "<NB_Domain>"
$dnssuffix = "<suffix>"
$path = "CN=Users,DC=" + $domainnb + ",DC=" + $dnssuffix
New-ADGroup -Name "SQL Admins" -SamAccountName SQLAdmins -GroupCategory Security -GroupScope Global -DisplayName "SQL Administrators" -Path $path -Description "Members of this group are SQL Administrators"
$secpassword = ConvertTo-SecureString $password -AsPlainText -Force
New-ADUser -Name "sqluser1" -AccountPassword $secpassword -Enabled $true
Add-ADGroupMember -Identity SQLAdmins -Members sqluser1

以下 Powershell 命令将创建名为 SQL Service的新 AD 组,并将密码为 <Password> 的新用户 sqlsvc 添加到 SQL Service 组。 suffix 是域名的后缀,例如 comlocal:

$password = "<Password>"
$domainnb = "<NB_Domain>"
$dnssuffix = "<suffix>"
$path = "CN=Users,DC=" + $domainnb + ",DC=" + $dnssuffix
New-ADGroup -Name "SQL Service" -SamAccountName SQLService -GroupCategory Security -GroupScope Global -DisplayName "SQL Service" -Path $path -Description "Members of this group are services accounts for SQL"
$secpassword = ConvertTo-SecureString $password -AsPlainText -Force
New-ADUser -Name "sqlsvc" -AccountPassword $secpassword -Enabled $true
Add-ADGroupMember -Identity SQLService -Members sqlsvc

如果要使用备用服务帐户,请参阅 受管服务帐户,组管理服务帐户和虚拟帐户

配置 NTP 服务器

要从 IBM Cloud NTP 服务器自动同步时间,请运行以下命令:

w32tm /config /manualpeerlist:"161.26.0.6" /syncfromflags:MANUAL /update
net stop w32time
net start w32time
w32tm /query /status