Azure 파일 공유에 대한 AD DS 인증 사용

이 문서에서는 Azure 파일 공유에 인증하기 위해 온-프레미스 Active Directory(AD) 자격 증명을 사용하기 위해 스토리지 계정에서 AD DS(Active Directory Domain Services) 인증을 사용하도록 설정하는 프로세스를 설명합니다.

Important

AD DS 인증을 사용하도록 설정하기 전에 개요 문서에서 지원되는 시나리오 및 요구 사항을 이해하고 필요한 필수 구성 요소를 완료해야 합니다. Active Directory 환경이 여러 포리스트에 걸쳐 있는 경우 여러 Active Directory 포리스트에서 Azure Files 사용을 참조하세요.

Azure 파일 공유에 대해 SMB를 통한 온-프레미스 AD DS 인증을 사용하도록 설정하려면 AD DS에 스토리지 계정을 등록한 후 Azure 스토리지 계정에 필요한 도메인 속성을 설정해야 합니다. AD DS에 스토리지 계정을 등록하려면 AD DS에서 이를 나타내는 컴퓨터 계정(또는 서비스 로그온 계정)을 만듭니다. 이 프로세스는 AD DS에서 온-프레미스 Windows 파일 서버를 나타내는 계정을 만드는 것과 같다고 볼 수 있습니다. 스토리지 계정에서 해당 기능을 사용하도록 설정하면 계정에 있는 모든 신규 및 기존 파일 공유에 적용됩니다.

적용 대상

파일 공유 유형 SMB NFS
표준 파일 공유(GPv2), LRS/ZRS Yes No
표준 파일 공유(GPv2), GRS/GZRS Yes No
프리미엄 파일 공유(FileStorage), LRS/ZRS Yes No

AzFilesHybrid PowerShell 모듈은 Azure Files 배포하고 구성하기 위한 cmdlet을 제공합니다. 여기에는 스토리지 계정을 온-프레미스 Active Directory에 조인하고 DNS 서버를 구성하는 도메인에 대한 cmdlet이 포함되어 있습니다. cmdlet은 필요한 수정을 수행하고 기능을 활성화합니다. cmdlet의 일부는 온-프레미스 AD DS와 상호 작용하여 cmdlet이 수행하는 작업을 설명하기 때문에 변경 내용이 규정 준수 및 보안 정책과 일치하는지 확인하고 cmdlet을 실행할 수 있는 적절한 권한이 있는지 확인할 수 있습니다. AzFilesHybrid 모듈을 사용하는 것이 좋긴 하지만 그렇게 할 수 없는 경우 수동 단계를 제공합니다.

Important

AES-256 Kerberos 암호화는 이제 AzFilesHybrid 모듈에서 지원하는 유일한 암호화 방법입니다. RC4 암호화를 사용하려면 옵션 2: 수동으로 사용 작업 수행을 참조하세요. 이전에 RC4를 기본 암호화 방법으로 사용하고 AES-256을 지원하도록 업데이트하려는 이전 AzFilesHybrid 버전(v0.2.2 이하)으로 기능을 사용하도록 설정한 경우 Azure Files SMB 인증 문제 해결을 참조하세요.

필수 조건

  • .NET Framework 4.7.2 이상이 설치되어 있지 않으면 지금 설치합니다. AzFilesHybrid 모듈을 성공적으로 가져오기 위해 필요합니다.
  • Azure PowerShell(Az 모듈) 및 Az.Storage가 설치되어 있는지 확인합니다. AzFilesHybrid를 사용하려면 Az.PowerShell 2.8.0 이상 및 Az.Storage 4.3.0 이상이 있어야 합니다.
  • Active Directory PowerShell 모듈을 설치합니다.

AzFilesHybrid 모듈 다운로드

최신 버전의 AzFilesHybrid 모듈을 다운로드하고 압축을 풉니다.

Join-AzStorageAccount 실행

Join-AzStorageAccount cmdlet은 지정된 스토리지 계정을 대신하여 오프라인 도메인 가입과 동일한 기능을 수행합니다. 아래 스크립트는 이 cmdlet을 사용하여 AD 도메인에 컴퓨터 계정을 만듭니다. 컴퓨터 계정을 사용할 수 없는 경우에는 스크립트를 변경하여 서비스 로그온 계정을 만들 수 있습니다. AzFilesHybrid 버전 0.2.5부터 서비스 로그온 계정으로 AES-256 암호화를 사용할 수 있습니다.

cmdlet에서 만든 AD DS 계정은 스토리지 계정을 나타냅니다. 암호 만료를 적용하는 OU(조직 구성 단위)에서 AD DS 계정을 만든 경우 최대 암호 사용 기간 전에 암호를 업데이트해야 합니다. 해당 날짜 이전에 계정 암호를 업데이트하지 않으면 Azure 파일 공유에 액세스할 때 인증 오류가 발생합니다. 암호를 업데이트하는 방법을 알아보려면 AD DS 계정 암호 업데이트를 참조하세요.

Important

Join-AzStorageAccount cmdlet은 AD의 스토리지 계정(파일 공유)을 나타내는 AD 계정을 만듭니다. 컴퓨터 계정 또는 서비스 로그온 계정으로 등록하도록 선택할 수 있습니다. 자세한 내용은 FAQ를 참조하세요. 서비스 로그온 계정 암호는 AD 도메인 또는 OU에 설정된 기본 암호 만료 기간이 있는 경우 AD에서 만료될 수 있습니다. 컴퓨터 계정 암호 변경은 AD가 아닌 클라이언트 컴퓨터에 의해 구동되기 때문에 클라이언트 컴퓨터는 기본적으로 30일마다 암호를 변경하지만 AD에서는 만료되지 않습니다. 두 계정 유형 모두에 대해 구성된 암호 만료 기간을 확인하고 최대 암호 사용 기간 전에 AD 계정의 스토리지 계정 ID 암호를 업데이트하도록 계획하는 것이 좋습니다. AD에서 새 AD 조직 구성 단위를 만들고 이에 따라 컴퓨터 계정 또는 서비스 로그온 계정에 대한 암호 만료 정책을 사용하지 않도록 설정할 수 있습니다.

대상 AD(예: 도메인 관리자)에서 컴퓨터 계정 또는 서비스 로그온 계정을 생성할 권한이 있는 온-프레미스 AD DS 자격 증명을 사용하여 온-프레미스 AD DS에 도메인을 조인한 디바이스에서 PowerShell 5.1에 아래 스크립트를 실행해야 합니다. 최소 권한 원칙을 따르려면 온-프레미스 AD DS 자격 증명에 다음 Azure 역할이 있어야 합니다.

  • 대상 스토리지 계정이 있는 리소스 그룹의 읽기 권한자입니다.
  • AD DS에 조인할 스토리지 계정의 기여자입니다.

AD DS에서 스토리지 계정에 조인하는 데 사용되는 계정이 대상 리소스가 있는 Azure 구독의 소유자 또는 기여자인 경우 해당 계정은 이미 조인을 수행할 수 있으며 추가 할당이 필요하지 않습니다.

AD DS 자격 증명에는 대상 AD에서 컴퓨터 계정 또는 서비스 로그온 계정을 만들 수 있는 권한도 있어야 합니다. 스크립트를 실행하기 전에 자리 표시자 값을 사용자 고유의 값으로 바꿉니다.

# Change the execution policy to unblock importing AzFilesHybrid.psm1 module
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

# Navigate to where AzFilesHybrid is unzipped and stored and run to copy the files into your path
.\CopyToPSPath.ps1 

# Import AzFilesHybrid module
Import-Module -Name AzFilesHybrid

# Login to Azure using a credential that has either storage account owner or contributor Azure role 
# assignment. If you are logging into an Azure environment other than Public (ex. AzureUSGovernment) 
# you will need to specify that.
# See https://learn.microsoft.com/azure/azure-government/documentation-government-get-started-connect-with-ps
# for more information.
Connect-AzAccount

# Define parameters
# $StorageAccountName is the name of an existing storage account that you want to join to AD
# $SamAccountName is the name of the to-be-created AD object, which is used by AD as the logon name 
# for the object. It must be 15 characters or less and has certain character restrictions.
# Make sure that you provide the SamAccountName without the trailing '$' sign.
# See https://learn.microsoft.com/windows/win32/adschema/a-samaccountname for more information.
$SubscriptionId = "<your-subscription-id-here>"
$ResourceGroupName = "<resource-group-name-here>"
$StorageAccountName = "<storage-account-name-here>"
$SamAccountName = "<sam-account-name-here>"
$DomainAccountType = "<ComputerAccount|ServiceLogonAccount>" # Default is set as ComputerAccount
# If you don't provide the OU name as an input parameter, the AD identity that represents the 
# storage account is created under the root directory.
$OuDistinguishedName = "<ou-distinguishedname-here>"
# Encryption method is AES-256 Kerberos.

# Select the target subscription for the current session
Select-AzSubscription -SubscriptionId $SubscriptionId 

# Register the target storage account with your active directory environment under the target OU 
# (for example: specify the OU with Name as "UserAccounts" or DistinguishedName as 
# "OU=UserAccounts,DC=CONTOSO,DC=COM"). You can use this PowerShell cmdlet: Get-ADOrganizationalUnit 
# to find the Name and DistinguishedName of your target OU. If you are using the OU Name, specify it 
# with -OrganizationalUnitName as shown below. If you are using the OU DistinguishedName, you can set it 
# with -OrganizationalUnitDistinguishedName. You can choose to provide one of the two names to specify 
# the target OU. You can choose to create the identity that represents the storage account as either a 
# Service Logon Account or Computer Account (default parameter value), depending on your AD permissions 
# and preference. Run Get-Help Join-AzStorageAccountForAuth for more details on this cmdlet.

Join-AzStorageAccount `
        -ResourceGroupName $ResourceGroupName `
        -StorageAccountName $StorageAccountName `
        -SamAccountName $SamAccountName `
        -DomainAccountType $DomainAccountType `
        -OrganizationalUnitDistinguishedName $OuDistinguishedName

# You can run the Debug-AzStorageAccountAuth cmdlet to conduct a set of basic checks on your AD configuration 
# with the logged on AD user. This cmdlet is supported on AzFilesHybrid v0.1.2+ version. For more details on 
# the checks performed in this cmdlet, see Azure Files Windows troubleshooting guide.
Debug-AzStorageAccountAuth -StorageAccountName $StorageAccountName -ResourceGroupName $ResourceGroupName -Verbose

옵션 2: 수동으로 사용 설정 작업 수행

대부분의 고객은 위의 옵션 1을 선택하고 AzFilesHybrid PowerShell 모듈을 사용하여 Azure Files로 AD DS 인증을 사용하도록 설정해야 합니다. 그러나 Active Directory PowerShell을 사용하여 수동으로 단계를 실행하려는 경우 단계는 여기에 설명되어 있습니다.

Important

위의 Join-AzStorageAccount 스크립트를 이미 실행한 경우 기능을 사용하도록 설정했는지 확인 섹션으로 이동합니다. 이 경우 다음 수동 단계를 수행할 필요가 없습니다.

환경 확인

먼저, 환경의 상태를 확인합니다.

  • Active Directory PowerShell이 설치되어 있고 셸이 관리자 권한으로 실행되고 있는지 확인합니다.
  • Az.Storage 모듈을 설치하고, 없는 경우 설치합니다. 버전 2.0 이상이 필요합니다.
  • 해당 검사를 완료한 후 AD DS를 확인하여 이미 SPN/UPN을 사용하여 “cifs/your-storage-account-name-here.file.core.windows.net”과 같이 생성된 컴퓨터 계정(기본값) 또는 서비스 로그온 계정이 있는지 확인합니다. 계정이 존재하지 않는 경우 다음 섹션에 설명된 대로 계정을 만듭니다.

Important

이 섹션의 Windows Server Active Directory PowerShell cmdlet은 Windows PowerShell 5.1에서 실행해야 합니다. PowerShell 7.x 및 Azure Cloud Shell은 이 시나리오에서 작동하지 않습니다.

수동으로 AD에서 스토리지 계정을 나타내는 ID 만들기

이 계정을 수동으로 만들려면 먼저 스토리지 계정에 대한 새 Kerberos 키를 만들고 아래 PowerShell cmdlet을 사용하여 액세스 키를 가져옵니다. 이 키는 설치하는 동안에만 사용됩니다. 스토리지 계정에 대한 모든 제어 또는 데이터 평면 작업에는 사용할 수 없습니다.

# Create the Kerberos key on the storage account and get the Kerb1 key as the password for the AD identity 
# to represent the storage account
$ResourceGroupName = "<resource-group-name-here>"
$StorageAccountName = "<storage-account-name-here>"

New-AzStorageAccountKey -ResourceGroupName $ResourceGroupName -Name $StorageAccountName -KeyName kerb1
Get-AzStorageAccountKey -ResourceGroupName $ResourceGroupName -Name $StorageAccountName -ListKerbKey | where-object{$_.Keyname -contains "kerb1"}

cmdlet은 키 값을 반환해야 합니다. kerb1 키가 있으면 OU 아래의 AD에 컴퓨터 계정 또는 서비스 계정을 만들고 해당 키를 AD ID의 암호로 사용합니다.

  1. AD GUI에서 또는 Windows 명령줄에서 관리자 권한으로 Setspn 명령을 실행하여 SPN을 cifs/your-storage-account-name-here.file.core.windows.net으로 설정합니다(예제 텍스트를 스토리지 계정 이름으로, <ADAccountName>를 AD 계정 이름으로 바꿔야 함).

    Setspn -S cifs/your-storage-account-name-here.file.core.windows.net <ADAccountName>
    
  2. 사용자 계정이 있는 경우 AD 개체의 SPN과 일치하도록 UPN을 수정합니다(AD PowerShell cmdlet이 설치되어 있어야 하며 상승된 권한으로 PowerShell 5.1에서 cmdlet을 실행해야 합니다).

    Set-ADUser -Identity $UserSamAccountName -UserPrincipalName cifs/<StorageAccountName>.file.core.windows.net@<DNSRoot>
    
  3. AD 계정 암호를 kerb1 키 값으로 설정합니다.

    Set-ADAccountPassword -Identity servername$ -Reset -NewPassword (ConvertTo-SecureString -AsPlainText "kerb1_key_value_here" -Force)
    

OU에서 암호 만료를 적용하는 경우 Azure 파일 공유에 액세스할 때 인증 오류가 발생하지 않도록 최대 암호 사용 기간 전에 암호를 업데이트해야 합니다. 자세한 내용은 AD에서 스토리지 계정 ID의 암호 업데이트를 참조하세요.

새로 만든 ID의 SID를 유지합니다. SID는 다음 단계에 필요합니다. 스토리지 계정을 나타내는 생성된 ID는 Microsoft Entra ID와 동기화할 필요가 없습니다.

스토리지 계정에서 기능을 사용하도록 설정

도메인 속성에 대한 구성 세부 정보를 포함하도록 다음 명령을 수정한 다음, 이 명령을 실행하여 기능을 사용하도록 설정합니다. 다음 명령에 필요한 스토리지 계정 SID는 이전 섹션의 AD DS에서 만든 ID의 SID입니다. 후행 '$' 기호 없이 ActiveDirectorySamAccountName 속성을 제공해야 합니다.

# Set the feature flag on the target storage account and provide the required AD domain information
Set-AzStorageAccount `
        -ResourceGroupName "<your-resource-group-name>" `
        -Name "<your-storage-account-name>" `
        -EnableActiveDirectoryDomainServicesForFile $true `
        -ActiveDirectoryDomainName "<your-domain-dns-root>" `
        -ActiveDirectoryNetBiosDomainName "<your-domain-dns-root>" `
        -ActiveDirectoryForestName "<your-forest-name>" `
        -ActiveDirectoryDomainGuid "<your-guid>" `
        -ActiveDirectoryDomainsid "<your-domain-sid>" `
        -ActiveDirectoryAzureStorageSid "<your-storage-account-sid>" `
        -ActiveDirectorySamAccountName "<your-domain-object-sam-account-name>" `
        -ActiveDirectoryAccountType "<your-domain-object-account-type, the value could be 'Computer' or 'User'>"

AES-256 암호화를 사용하도록 설정하려면 이 섹션의 단계를 따릅니다. RC4 암호를 사용할 계획인 경우 이 섹션을 건너뜁니다.

Important

AES-256 암호화를 사용하도록 설정하려면 스토리지 계정을 나타내는 도메인 개체가 온-프레미스 AD 도메인의 컴퓨터 계정(기본값) 또는 서비스 로그온 계정이어야 합니다. 도메인 개체가 이러한 요구 사항을 충족하지 않는 경우 해당 도메인 개체를 삭제하고 새 도메인 개체를 만듭니다. 또한 개체의 msDS-SupportedEncryptionTypes 특성에 대한 쓰기 권한이 있어야 합니다.

AES-256 지원을 구성하기 위해 실행할 cmdlet은 스토리지 계정을 나타내는 도메인 개체가 컴퓨터 계정인지 아니면 서비스 로그온 계정(사용자 계정)인지에 따라 달라집니다. 어떤 경우든 AD PowerShell cmdlet이 설치되어 있어야 하며 PowerShell 5.1에서 상승된 권한으로 cmdlet을 실행해야 합니다.

컴퓨터 계정에서 AES-256 암호화를 사용하도록 설정하려면 다음 명령을 실행합니다. <domain-object-identity><domain-name>를 값으로 바꿉니다.

Set-ADComputer -Identity <domain-object-identity> -Server <domain-name> -KerberosEncryptionType "AES256"

서비스 로그온 계정에서 AES-256 암호화를 사용하도록 설정하려면 다음 명령을 실행합니다. <domain-object-identity><domain-name>를 값으로 바꿉니다.

Set-ADUser -Identity <domain-object-identity> -Server <domain-name> -KerberosEncryptionType "AES256"

위의 cmdlet을 실행한 후 다음 스크립트에서 <domain-object-identity>를 값으로 바꾼 다음, 스크립트를 실행하여 도메인 개체 암호를 새로 고칩니다.

$KeyName = "kerb1" # Could be either the first or second kerberos key, this script assumes we're refreshing the first
$KerbKeys = New-AzStorageAccountKey -ResourceGroupName $ResourceGroupName -Name $StorageAccountName -KeyName $KeyName
$KerbKey = $KerbKeys.keys | Where-Object {$_.KeyName -eq $KeyName} | Select-Object -ExpandProperty Value
$NewPassword = ConvertTo-SecureString -String $KerbKey -AsPlainText -Force

Set-ADAccountPassword -Identity <domain-object-identity> -Reset -NewPassword $NewPassword

Important

이전에 RC4 암호화를 사용하고 AES-256을 사용하도록 스토리지 계정을 업데이트한 경우 클라이언트에서 klist purge를 실행한 다음, 파일 공유를 다시 탑재하여 AES-256을 사용하여 새 Kerberos 티켓을 가져와야 합니다.

디버깅

필요한 경우, Debug-AzStorageAccountAuth cmdlet을 실행하여 로그온한 AD 사용자로 AD 구성에 대한 기본 검사 세트를 수행할 수 있습니다. 이 cmdlet은 AzFilesHybrid v0.1.2 이상 버전에서 지원됩니다. 이 cmdlet은 AD DS 인증에만 적용됩니다. Microsoft Entra Domain Services 또는 Microsoft Entra Kerberos 사용 스토리지 계정에는 작동하지 않습니다. 이 cmdlet에서 수행되는 검사에 대한 자세한 내용은 AD 자격 증명으로 Azure 파일 공유를 탑재할 수 없음을 참조하세요.

Debug-AzStorageAccountAuth -StorageAccountName $StorageAccountName -ResourceGroupName $ResourceGroupName -Verbose

기능을 사용하도록 설정했는지 확인

다음 스크립트를 사용하여 스토리지 계정에서 Active Directory를 사용하도록 설정되었는지 확인할 수 있습니다.

# Get the target storage account
$storageaccount = Get-AzStorageAccount `
        -ResourceGroupName "<your-resource-group-name-here>" `
        -Name "<your-storage-account-name-here>"

# List the directory service of the selected service account
$storageAccount.AzureFilesIdentityBasedAuth.DirectoryServiceOptions

# List the directory domain information if the storage account has enabled AD DS authentication for file shares
$storageAccount.AzureFilesIdentityBasedAuth.ActiveDirectoryProperties

성공한 경우 출력은 다음과 같습니다.

DomainName:<yourDomainHere>
NetBiosDomainName:<yourNetBiosDomainNameHere>
ForestName:<yourForestNameHere>
DomainGuid:<yourGUIDHere>
DomainSid:<yourSIDHere>
AzureStorageID:<yourStorageSIDHere>

다음 단계

이제 스토리지 계정에서 해당 AD DS를 사용하도록 설정했습니다. 기능을 사용하려면 공유 수준 권한을 할당해야 합니다.