빠른 시작: 이메일 통신 서비스에 Azure 관리되는 도메인를 추가하는 방법

이 빠른 시작에서는 Azure Communication Services의 이메일 통신 서비스에 Azure 관리되는 도메인을 프로비전하는 방법을 알아봅니다.

필수 조건

Azure 관리되는 도메인 프로비저닝

  1. 이메일 통신 리소스 만들기 시작에서 만든 이메일 통신 서비스 리소스의 개요 페이지를 엽니다.

  2. 다음 옵션 중 하나를 사용하여 Azure 관리되는 도메인을 만듭니다.

    • (옵션 1) 무료 Azure 하위 도메인 추가에서 원클릭 추가 단추를 클릭합니다. 3단계로 계속 진행합니다.

    무료 Azure 관리되는 도메인 추가를 강조 표시하는 스크린샷.

    • (옵션 2) 왼쪽 탐색 패널에서 도메인 프로비저닝을 클릭합니다.

    도메인 프로비전 탐색 페이지를 보여 주는 스크린샷.

    • 상단 탐색 모음에서 도메인 추가를 클릭합니다.
    • 드롭다운에서 Azure 도메인을 선택합니다.
  3. 배포가 완료될 때가지 기다립니다.

    배포 진행을 보여 주는 스크린샷.

  4. 도메인이 만들어지면 새 도메인이 포함된 목록 뷰가 표시됩니다.

    프로비전된 이메일 도메인 목록을 보여 주는 스크린샷.

  5. 프로비전된 도메인의 이름을 클릭하면 도메인 리소스 종류에 대한 개요 페이지가 열립니다.

    Azure 관리되는 도메인 개요 페이지를 보여 주는 스크린샷.

필수 조건

도메인 리소스 만들기

도메인 리소스를 만들려면 Azure CLI에 로그인합니다. 터미널에서 az login 명령을 실행하고 자격 증명을 제공하여 로그인할 수 있습니다. 리소스를 만들려면 다음 명령을 실행합니다.

az communication email domain create --domain-name AzureManagedDomain --email-service-name "<EmailServiceName>" --location "Global" --resource-group "<resourceGroup>" --domain-management AzureManaged

특정 구독을 선택하려는 경우 --subscription 플래그를 지정하고 구독 ID를 제공할 수도 있습니다.

az communication email domain create --domain-name AzureManagedDomain --email-service-name "<EmailServiceName>" --location "Global" --resource-group "<resourceGroup>" --domain-management AzureManaged --subscription "<subscriptionId>"

다음 옵션을 사용하여 도메인 리소스를 구성할 수 있습니다.

  • 리소스 그룹
  • Email Communication Services 리소스의 이름
  • 리소스가 연결되는 지리적 위치
  • 도메인 리소스의 이름:
    • Azure 도메인의 경우 이름은 AzureManagedDomain이어야 합니다.
  • 도메인 관리 속성의 값입니다.
    • Azure 도메인의 경우 값은 AzureManaged여야 합니다.

다음 단계에서는 도메인 리소스에 태그를 할당할 수 있습니다. 태그를 사용하여 도메인 리소스를 구성할 수 있습니다. 태그에 대한 자세한 내용은 리소스 태그 지정 설명서를 참조하세요.

도메인 리소스 관리

도메인 리소스에 태그를 추가하려면 다음 명령을 실행합니다. 특정 구독을 대상으로 지정할 수도 있습니다.

az communication email domain update --domain-name AzureManagedDomain --email-service-name "<EmailServiceName>" --resource-group "<resourceGroup>" --tags newTag="newVal1"

az communication email domain update --domain-name AzureManagedDomain --email-service-name "<EmailServiceName>" --resource-group "<resourceGroup>" --tags newTag="newVal1" --subscription "<subscriptionId>"

특정 이메일 통신 서비스의 모든 도메인 리소스를 나열하려면 다음 명령을 사용합니다.

az communication email domain list --email-service-name "<EmailServiceName>" --resource-group "<resourceGroup>"

특정 도메인 리소스에 대한 모든 정보를 표시하려면 다음 명령을 사용합니다.

az communication email domain show --domain-name AzureManagedDomain --email-service-name "<EmailServiceName>" --resource-group "<resourceGroup>"

도메인 리소스 정리

도메인 리소스를 정리하고 제거하려면 다음 명령을 실행하여 삭제할 수 있습니다.

az communication email domain delete --domain-name AzureManagedDomain --email-service-name "<EmailServiceName>" --resource-group "<resourceGroup>"

참고 항목

리소스 삭제는 영구적이며 리소스를 삭제하는 경우 이벤트 그리드 필터, 전화번호 또는 리소스에 연결된 기타 데이터를 포함한 데이터를 복구할 수 없습니다.

다른 명령에 대한 자세한 내용은 도메인 CLI를 참조하세요.

필수 조건

SDK 설치

먼저 C# 프로젝트에 Communication Services 관리 SDK를 포함합니다.

using Azure.ResourceManager.Communication;

구독 ID

Azure 구독의 ID를 알아야 합니다. 이는 포털에서 가져올 수 있습니다.

  1. Azure 계정에 로그인
  2. 왼쪽 사이드바에서 구독 선택
  3. 필요한 구독 선택
  4. 개요 클릭
  5. 구독 ID 선택

이 빠른 시작에서는 AZURE_SUBSCRIPTION_ID라는 환경 변수에 구독 ID를 저장했다고 가정합니다.

인증

도메인 리소스와 통신하려면 먼저 Azure에 자신을 인증해야 합니다.

클라이언트 인증

인증된 클라이언트를 만드는 기본 옵션은 DefaultAzureCredential을 사용하는 것입니다. 모든 관리 API는 동일한 엔드포인트를 통과하므로 리소스와 상호 작용하려면 최상위 ArmClient를 하나만 만들면 됩니다.

Azure에 인증하고 ArmClient를 만들려면 다음 코드를 수행합니다.

using System;
using System.Threading.Tasks;
using Azure;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Communication;
using Azure.ResourceManager.Resources;
...
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://video2.skills-academy.com/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);

Azure 리소스와 상호 작용

이제 인증이 완료되었습니다.

다음 각 예에서는 기존 이메일 통신 서비스에 도메인 리소스를 할당합니다.

이메일 통신 서비스를 만들어야 하는 경우 Azure Portal을 사용하여 만들 수 있습니다.

도메인 리소스 만들기

도메인 리소스를 만들 때 리소스 그룹 이름, 이메일 통신 서비스 이름, 리소스 이름 및 DomainManagement를 지정해야 합니다.

참고 항목

Location 속성은 항상 global입니다.

// this example assumes you already have this EmailServiceResource created on azure
// for more information of creating EmailServiceResource, please refer to the document of EmailServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string emailServiceName = "MyEmailServiceResource";
ResourceIdentifier emailServiceResourceId = EmailServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName);
EmailServiceResource emailServiceResource = client.GetEmailServiceResource(emailServiceResourceId);

// get the collection of this CommunicationDomainResource
CommunicationDomainResourceCollection collection = emailServiceResource.GetCommunicationDomainResources();

// invoke the operation
string domainName = "AzureManagedDomain";
CommunicationDomainResourceData data = new CommunicationDomainResourceData(new AzureLocation("Global"))
{
    DomainManagement = DomainManagement.AzureManaged,
};
ArmOperation<CommunicationDomainResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, domainName, data);            
CommunicationDomainResource result = lro.Value;

// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
CommunicationDomainResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");

도메인 리소스 관리

도메인 리소스 업데이트

...
// this example assumes you already have this CommunicationDomainResource created on azure
// for more information of creating CommunicationDomainResource, please refer to the document of CommunicationDomainResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string emailServiceName = "MyEmailServiceResource";
string domainName = "AzureManagedDomain";
ResourceIdentifier communicationDomainResourceId = CommunicationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName);
CommunicationDomainResource communicationDomainResource = client.GetCommunicationDomainResource(communicationDomainResourceId);

// invoke the operation
CommunicationDomainResourcePatch patch = new CommunicationDomainResourcePatch()
{
    Tags =
    {
    ["newTag"] = "newVal",
    },
};
ArmOperation<CommunicationDomainResource> lro = await communicationDomainResource.UpdateAsync(WaitUntil.Completed, patch);
CommunicationDomainResource result = lro.Value;

// the variable result is a resource, you could call other operations on this instance as well
// but just for demo, we get its data from this resource instance
CommunicationDomainResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");

이메일 서비스로 나열

// this example assumes you already have this EmailServiceResource created on azure
// for more information of creating EmailServiceResource, please refer to the document of EmailServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string emailServiceName = "MyEmailServiceResource";
ResourceIdentifier emailServiceResourceId = EmailServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName);
EmailServiceResource emailServiceResource = client.GetEmailServiceResource(emailServiceResourceId);

// get the collection of this CommunicationDomainResource
CommunicationDomainResourceCollection collection = emailServiceResource.GetCommunicationDomainResources();

// invoke the operation and iterate over the result
await foreach (CommunicationDomainResource item in collection.GetAllAsync())
{
    // the variable item is a resource, you could call other operations on this instance as well
    // but just for demo, we get its data from this resource instance
    CommunicationDomainResourceData resourceData = item.Data;
    // for demo we just print out the id
    Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}

Console.WriteLine($"Succeeded");

도메인 리소스 가져오기

// this example assumes you already have this EmailServiceResource created on azure
// for more information of creating EmailServiceResource, please refer to the document of EmailServiceResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string emailServiceName = "MyEmailServiceResource";
ResourceIdentifier emailServiceResourceId = EmailServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName);
EmailServiceResource emailServiceResource = client.GetEmailServiceResource(emailServiceResourceId);

// get the collection of this CommunicationDomainResource
CommunicationDomainResourceCollection collection = emailServiceResource.GetCommunicationDomainResources();

// invoke the operation
string domainName = "AzureManagedDomain";
bool result = await collection.ExistsAsync(domainName);

Console.WriteLine($"Succeeded: {result}");

도메인 리소스 정리

// this example assumes you already have this CommunicationDomainResource created on azure
// for more information of creating CommunicationDomainResource, please refer to the document of CommunicationDomainResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
string resourceGroupName = "MyResourceGroup";
string emailServiceName = "MyEmailServiceResource";
string domainName = "AzureManagedDomain";
ResourceIdentifier communicationDomainResourceId = CommunicationDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, emailServiceName, domainName);
CommunicationDomainResource communicationDomainResource = client.GetCommunicationDomainResource(communicationDomainResourceId);

// invoke the operation
await communicationDomainResource.DeleteAsync(WaitUntil.Completed);

Console.WriteLine($"Succeeded");

참고 항목

리소스 삭제는 영구적이며 리소스를 삭제하는 경우 이벤트 그리드 필터, 전화번호 또는 리소스에 연결된 기타 데이터를 포함한 데이터를 복구할 수 없습니다.

필수 조건

도메인 리소스 만들기

도메인 리소스를 만들려면 다음 명령을 사용하여 Connect-AzAccount를 사용하여 Azure 계정에 로그인하고 자격 증명을 제공합니다.

PS C:\> Connect-AzAccount

먼저 다음 명령을 사용하여 Azure Communication Services 모듈 Az.Communication을 설치해야 합니다.

PS C:\> Install-Module Az.Communication

다음 명령을 실행하여 Azure 관리되는 도메인 리소스를 만듭니다.

PS C:\> New-AzEmailServiceDomain -ResourceGroupName ContosoResourceProvider1 -EmailServiceName ContosoEmailServiceResource1 -Name AzureManagedDomain -DomainManagement AzureManaged

다음 옵션을 사용하여 도메인 리소스를 구성할 수 있습니다.

  • 리소스 그룹
  • Email Communication Services 리소스의 이름입니다.
  • 도메인 리소스의 이름:
    • Azure 도메인의 경우 이름은 AzureManagedDomain이어야 합니다.
  • 도메인 관리 속성의 값입니다.
    • Azure 도메인의 경우 값은 AzureManaged여야 합니다.

다음 단계에서는 도메인 리소스에 태그를 할당할 수 있습니다. 태그를 사용하여 도메인 리소스를 구성할 수 있습니다. 태그에 대한 자세한 내용은 리소스 태그 지정 설명서를 참조하세요.

도메인 리소스 관리

도메인 리소스에 태그를 추가하려면 다음 명령을 실행합니다. 특정 구독을 대상으로 지정할 수도 있습니다.

PS C:\> Update-AzEmailServiceDomain -Name AzureManagedDomain -EmailServiceName ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1 -Tag @{ExampleKey1="ExampleValue1"}

PS C:\> Update-AzEmailServiceDomain -Name AzureManagedDomain -EmailServiceName ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1 -Tag @{ExampleKey1="ExampleValue1"} -SubscriptionId SubscriptionID

특정 이메일 통신 서비스의 모든 도메인 리소스를 나열하려면 다음 명령을 사용합니다.

PS C:\> Get-AzEmailServiceDomain -EmailServiceName ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1

특정 도메인 리소스에 대한 모든 정보를 나열하려면 다음 명령을 사용합니다.

PS C:\> Get-AzEmailServiceDomain -Name AzureManagedDomain -EmailServiceName ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1

도메인 리소스 정리

도메인 리소스를 정리하고 제거하려면 다음 명령을 실행하여 도메인 리소스를 삭제할 수 있습니다.

PS C:\> Remove-AzEmailServiceDomain -Name AzureManagedDomain -EmailServiceName ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1

참고 항목

리소스 삭제는 영구적이며 리소스를 삭제하는 경우 이벤트 그리드 필터, 전화번호 또는 리소스에 연결된 기타 데이터를 포함한 데이터를 복구할 수 없습니다.

Azure 관리되는 도메인과 Custom Domain 비교

Azure 관리되는 도메인을 프로비전하기 전에 다음 표를 검토하여 요구 사항에 가장 적합한 도메인 형식을 결정합니다.

Azure 관리되는 도메인 사용자 지정 도메인
장점: - 설치가 빠르고 쉬움
- 도메인 확인이 필요하지 않음
- 이메일은 사용자 고유의 도메인에서 전송됨
단점: - 보낸 사람 도메인이 개인 설정되지 않았으므로 변경할 수 없음
- 보낸 사람 사용자 이름은 개인 설정될 수 없음
- 전송량이 매우 제한됨
- 참여 추적을 사용하도록 설정할 수 없음
- 도메인 레코드 확인 필요
- 확인을 위한 더 긴 설정

Azure 관리되는 도메인에 대한 보낸 사람 인증

Azure Communication Services는 이메일 인증 모범 사례에 설명된 대로 이메일에 필요한 이메일 인증 프로토콜을 자동으로 구성합니다.

이제 이메일 도메인에서 이메일을 보낼 준비가 되었습니다.

다음 단계