다음을 통해 공유


빠른 시작: 이메일 통신 서비스 리소스 만들기 및 관리

첫 번째 Email Communication Service 리소스를 프로비저닝하여 이메일을 시작합니다. Azure Portal 또는 .NET 관리 클라이언트 라이브러리를 통해 이메일 통신 서비스 리소스를 프로비전합니다. 관리 클라이언트 라이브러리 및 Azure Portal을 사용하면 리소스를 만들고, 구성, 업데이트 및 삭제하고 Azure의 배포 및 관리 서비스인 Azure Resource Manager와 상호 연결할 수 있습니다. 클라이언트 라이브러리에서 사용할 수 있는 모든 함수를 Azure Portal에서 사용할 수 있습니다.

Warning

Azure Communication Services용 리소스와 리소스 그룹을 동시에 만들 수는 없습니다. 리소스를 만들 때 이미 만들어진 리소스 그룹을 사용해야 합니다.

필수 조건

포털을 사용하여 Email Communication Services 리소스 만들기

  1. Azure Portal을 열어 새 리소스를 만듭니다.

  2. Email Communication Services를 검색합니다.

    시장에서 Email Communication Service를 검색하는 방법을 보여 주는 스크린샷

  3. Email Communication Services를 선택하고 만들기를 누릅니다.

    Email Communication Service를 만들기 위한 링크 만들기를 보여 주는 스크린샷

  4. 기본 탭에서 필수 정보를 입력합니다.

    • 기존 Azure 구독을 선택합니다.

    • 기존 리소스 그룹을 선택하거나 새로 만들기 링크를 클릭하여 새 리소스 그룹을 만듭니다.

    • 리소스의 유효한 이름을 제공합니다.

    • 리소스가 활성화되어야 하는 지역을 선택합니다.

    • 데이터 위치로 미국을 선택합니다.

    • 태그를 추가하려면 다음: 태그 클릭

    • 이름/값 쌍을 추가합니다.

      Email Communication Service를 검토하고 만들기 위해 요약하는 방법을 보여 주는 스크린샷

  5. 다음: 검토 + 만들기를 클릭합니다.

  6. 유효성 검사가 통과될 때까지 기다린 다음 만들기를 클릭합니다.

  7. 배포가 완료되기를 기다린 다음 리소스로 이동하여 전자 메일 통신 서비스 개요를 엽니다.

    Email Communication Service 리소스의 개요를 보여 주는 스크린샷

필수 조건

Email Communication Services 리소스 만들기

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

az communication email create --name "<EmailServiceName>" --location "Global" --data-location "United States" --resource-group "<resourceGroup>"

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

az communication email create --name "<EmailServiceName>" --location "Global" --data-location "United States" --resource-group "<resourceGroup>" --subscription "<subscriptionId>"

다음 옵션을 사용하여 Email Communication Services 리소스를 구성할 수 있습니다.

  • 리소스 그룹
  • Email Communication Services 리소스의 이름
  • 리소스가 연결되는 지리적 위치

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

Email Communication Services 리소스 관리

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

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

az communication email update --name "<EmailServiceName>" --tags newTag="newVal2" --resource-group "<resourceGroup>" --subscription "<subscriptionId>"

특정 리소스 그룹의 모든 Email Communication Service 리소스를 나열하려면 다음 명령을 사용합니다.

az communication email list --resource-group "<resourceGroup>"

특정 Email Communication Service 리소스에 대한 모든 정보를 표시하려면 다음 명령을 사용합니다. 특정 구독을 대상으로 지정할 수도 있습니다.

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

az communication email show --name "<EmailServiceName>" --resource-group "<resourceGroup>" --subscription "<subscriptionId>"

리소스 정리

Email Communication Services 구독을 정리하고 제거하려면 리소스 또는 리소스 그룹을 삭제하면 됩니다. 다음 명령을 실행하여 이메일 통신 리소스를 삭제할 수 있습니다.

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

리소스 그룹을 삭제하면 해당 리소스 그룹에 연결된 다른 모든 리소스가 함께 삭제됩니다.

참고 항목

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

다른 명령에 대한 자세한 내용은 Email Communication 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 Communication Services와 통신하려면 먼저 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://learn.microsoft.com/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);

Azure 리소스와 상호 작용

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

다음 각 예에서는 기존 리소스 그룹에 Email Communication Services 리소스를 할당합니다.

리소스 그룹을 만들어야 하는 경우 Azure Portal 또는 Azure Resource Manager SDK를 사용하여 리소스 그룹을 만들 수 있습니다.

Email Services 리소스 만들기

Email Services 리소스를 만들 때 리소스 그룹 이름 및 리소스 이름을 지정합니다.

참고 항목

Location 속성은 항상 global이며, 공개 미리 보기 중에는 DataLocation 값이 UnitedStates여야 합니다.

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

// get the collection of this EmailServiceResource
EmailServiceResourceCollection collection = resourceGroupResource.GetEmailServiceResources();

// invoke the operation
string emailServiceName = "MyEmailServiceResource";
EmailServiceResourceData data = new EmailServiceResourceData(new AzureLocation("Global"))
{
    DataLocation = "United States",
};
ArmOperation<EmailServiceResource> lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, emailServiceName, data);
EmailServiceResource 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
EmailServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");

Email Communication Services 리소스 관리

Email Communication Services 리소스 업데이트

...
// 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);

// invoke the operation
EmailServiceResourcePatch patch = new EmailServiceResourcePatch()
{
    Tags =
    {
    ["newTag"] = "newVal",
    },
};
ArmOperation<EmailServiceResource> lro = await emailServiceResource.UpdateAsync(WaitUntil.Completed, patch);
EmailServiceResource 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
EmailServiceResourceData resourceData = result.Data;
// for demo we just print out the id
Console.WriteLine($"Succeeded on id: {resourceData.Id}");

리소스 그룹별로 모든 Email Communication Service 리소스 나열

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

// get the collection of this EmailServiceResource
EmailServiceResourceCollection collection = resourceGroupResource.GetEmailServiceResources();

// invoke the operation and iterate over the result
await foreach (EmailServiceResource 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
    EmailServiceResourceData resourceData = item.Data;
    // for demo we just print out the id
    Console.WriteLine($"Succeeded on id: {resourceData.Id}");
}

Console.WriteLine($"Succeeded");

구독별로 모든 Email Communication Service 리소스 나열

// this example assumes you already have this SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "11112222-3333-4444-5555-666677778888";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);

// invoke the operation and iterate over the result
await foreach (EmailServiceResource item in subscriptionResource.GetEmailServiceResourcesAsync())
{
    // 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
    EmailServiceResourceData 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);

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

Console.WriteLine($"Succeeded");

참고 항목

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

필수 조건

Email Communication Service 리소스 만들기

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

PS C:\> Connect-AzAccount

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

PS C:\> Install-Module Az.Communication

리소스를 만들려면 다음 명령을 실행합니다.

PS C:\> New-AzEmailService -ResourceGroupName ContosoResourceProvider1 -Name ContosoEmailServiceResource1 -DataLocation UnitedStates

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

PS C:\> New-AzEmailService -ResourceGroupName ContosoResourceProvider1 -Name ContosoEmailServiceResource1 -DataLocation UnitedStates -SubscriptionId SubscriptionID

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

  • 리소스 그룹
  • Email Communication Services 리소스의 이름
  • 리소스가 연결되는 지리적 위치

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

Email Communication Services 리소스 관리

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

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

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

특정 구독의 모든 Email Communication Services 리소스를 나열하려면 다음 명령을 사용합니다.

PS C:\> Get-AzEmailService -SubscriptionId SubscriptionID

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

PS C:\> Get-AzEmailService -Name ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1

리소스 정리

Email Communication Services를 정리하고 제거하려면 다음 명령을 실행하여 Email 통신 리소스를 삭제할 수 있습니다.

PS C:\> Remove-AzEmailService -Name ContosoEmailServiceResource1 -ResourceGroupName ContosoResourceProvider1

참고 항목

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

다음 단계