

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

# Fornitura di un account del servizio Active Directory
<a name="provision-service-account"></a>

Se desideri aggiungere Amazon FSx for NetApp ONTAP SVMs al tuo dominio Active Directory locale, devi mantenere un account di servizio Active Directory valido per tutta la durata del FSx file system Amazon. Amazon FSx deve essere in grado di gestire completamente il file system ed eseguire attività che richiedono l'eliminazione e il ricongiungimento al dominio Active Directory, come la sostituzione di un file SVM fallito o l'applicazione di patch NetApp al software ONTAP. Mantieni aggiornata la configurazione di Active Directory, incluse le credenziali dell'account di servizio, in Amazon FSx.

Questo account di servizio deve disporre delle seguenti autorizzazioni in Active Directory:
+ Autorizzazioni per aggiungere computer al dominio
+ Nell'unità organizzativa (OU) a cui si sta entrando a far parte del file system, le autorizzazioni per:
  + Reimpostare le password
  + Impedisci agli account di leggere e scrivere dati
  + Scrivi sull'hostname DNS
  + Scrivi sul nome principale del servizio
  + Creazione ed eliminazione degli oggetti computer
  + Restrizioni relative all'account in lettura e scrittura

Un amministratore di dominio Active Directory può creare l'account del servizio manualmente utilizzando lo snap-in MMC **Active Directory User and Computers**. Per istruzioni, consulta [Delegare le autorizzazioni al tuo account di FSx servizio Amazon nella documentazione](https://docs.aws.amazon.com/fsx/latest/ONTAPGuide/self-managed-AD-best-practices.html#connect_delegate_privileges) FSx di ONTAP. Puoi anche configurare questo account a livello di codice. Ad esempio, è possibile utilizzare [PowerShell](https://learn.microsoft.com/en-us/powershell/), come illustrato nell'esempio seguente.

```
param(
    [string] $DomainName,
    [string] $Username, #Service Account username
    [string] $Firstname, #Service Account Firstname
    [string] $Lastname, #Service Account Lastname
    [string] $saOU, #OU where Service Account is created
    [string] $delegateOrganizationalUnit #OU where Service Account has delegation
)

#Retrieve Active Directory domain credentials of a Domain Admin
$DomainCredential = ...

#Import Active Directory PowerShell module
...

#Create Service Account in specified OU
New-Active DirectoryUser -Credential $DomainCredential -SamAccountName $Username -UserPrincipalName "$Username@$DomainName" -Name "$Firstname $Lastname" -GivenName $Firstname -Surname $Lastname -Enabled $True -ChangePasswordAtLogon $False -DisplayName "$Lastname, $Firstname" -Path $saOU -CannotChangePassword $True -PasswordNotRequired $True
$user = Get-Active Directoryuser -Identity $Username
$userSID = [System.Security.Principal.SecurityIdentifier] $user.SID

#Connect to Active Directory drive
Set-Location Active Directory:

$ACL = Get-Acl -Path $delegateOrganizationalUnit
$Identity = [System.Security.Principal.IdentityReference] $userSID

#GUID of Active Directory Class
$Computers = [GUID]"bf967a86-0de6-11d0-a285-00aa003049e2"
$ResetPassword = [GUID]"00299570-246d-11d0-a768-00aa006e0529"
$ValidatedDNSHostName = [GUID]"72e39547-7b18-11d1-adef-00c04fd8d5cd"
$ValidatedSPN = [GUID]"f3a64788-5306-11d1-a9c5-0000f80367c1"
$AccountRestrictions = [GUID]"4c164200-20c0-11d0-a768-00aa006e0529"

#Delegation list
$rules = @()
$rules += $(New-Object System.DirectoryServices.ActiveDirectoryAccessRule($Identity, "CreateChild, DeleteChild", "Allow", $Computers, "All"))
$rules += $(New-Object System.DirectoryServices.ActiveDirectoryAccessRule($Identity, "ExtendedRight", "Allow", $ResetPassword, "Descendents", $Computers))
$rules += $(New-Object System.DirectoryServices.ActiveDirectoryAccessRule($Identity, "ReadProperty, WriteProperty", "Allow", $AccountRestrictions, "Descendents", $Computers))
$rules += $(New-Object System.DirectoryServices.ActiveDirectoryAccessRule($userSID, "Self", "Allow", $ValidatedDNSHostName, "Descendents", $Computers))
$rules += $(New-Object System.DirectoryServices.ActiveDirectoryAccessRule($userSID, "Self", "Allow", $ValidatedSPN, "Descendents", $Computers))

#Set delegation
foreach($rule in $rules) {
    $ACL.AddAccessRule($rule)
}
Set-Acl -Path $delegateOrganizationalUnit -AclObject $ACL
```